spree_api 3.6.6 → 3.7.0.rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/spree/api/main.js +36 -0
- data/app/assets/javascripts/spree/api/storefront/cart.js +49 -0
- data/app/controllers/concerns/spree/api/v2/storefront/order_concern.rb +48 -0
- data/app/controllers/spree/api/errors_controller.rb +9 -0
- data/app/controllers/spree/api/v1/checkouts_controller.rb +12 -0
- data/app/controllers/spree/api/v1/customer_returns_controller.rb +1 -0
- data/app/controllers/spree/api/v1/line_items_controller.rb +11 -10
- data/app/controllers/spree/api/v1/orders_controller.rb +6 -6
- data/app/controllers/spree/api/v1/product_properties_controller.rb +1 -0
- data/app/controllers/spree/api/v1/products_controller.rb +6 -6
- data/app/controllers/spree/api/v1/promotions_controller.rb +1 -0
- data/app/controllers/spree/api/v1/reimbursements_controller.rb +1 -0
- data/app/controllers/spree/api/v1/shipments_controller.rb +12 -3
- data/app/controllers/spree/api/v1/variants_controller.rb +5 -3
- data/app/controllers/spree/api/v2/base_controller.rb +94 -0
- data/app/controllers/spree/api/v2/storefront/account/credit_cards_controller.rb +55 -0
- data/app/controllers/spree/api/v2/storefront/account_controller.rb +33 -0
- data/app/controllers/spree/api/v2/storefront/cart_controller.rb +124 -0
- data/app/controllers/spree/api/v2/storefront/checkout_controller.rb +108 -0
- data/app/controllers/spree/api/v2/storefront/countries_controller.rb +57 -0
- data/app/controllers/spree/api/v2/storefront/products_controller.rb +87 -0
- data/app/controllers/spree/api/v2/storefront/taxons_controller.rb +82 -0
- data/app/helpers/spree/api/api_helpers.rb +1 -1
- data/app/helpers/spree/api/v2/collection_options_helpers.rb +37 -0
- data/app/models/doorkeeper/access_grant_decorator.rb +3 -0
- data/app/models/doorkeeper/access_token_decorator.rb +3 -0
- data/app/models/doorkeeper/application_decorator.rb +3 -0
- data/app/serializers/spree/v2/storefront/account/credit_card_serializer.rb +16 -0
- data/app/serializers/spree/v2/storefront/account_serializer.rb +29 -0
- data/app/serializers/spree/v2/storefront/address_serializer.rb +14 -0
- data/app/serializers/spree/v2/storefront/base_serializer.rb +9 -0
- data/app/serializers/spree/v2/storefront/cart_serializer.rb +40 -0
- data/app/serializers/spree/v2/storefront/country_serializer.rb +18 -0
- data/app/serializers/spree/v2/storefront/image_serializer.rb +11 -0
- data/app/serializers/spree/v2/storefront/line_item_serializer.rb +17 -0
- data/app/serializers/spree/v2/storefront/option_type_serializer.rb +13 -0
- data/app/serializers/spree/v2/storefront/option_value_serializer.rb +11 -0
- data/app/serializers/spree/v2/storefront/payment_method_serializer.rb +11 -0
- data/app/serializers/spree/v2/storefront/payment_serializer.rb +12 -0
- data/app/serializers/spree/v2/storefront/product_property_serializer.rb +14 -0
- data/app/serializers/spree/v2/storefront/product_serializer.rb +35 -0
- data/app/serializers/spree/v2/storefront/promotion_serializer.rb +12 -0
- data/app/serializers/spree/v2/storefront/shipment_serializer.rb +16 -0
- data/app/serializers/spree/v2/storefront/shipping_rate_serializer.rb +14 -0
- data/app/serializers/spree/v2/storefront/state_serializer.rb +11 -0
- data/app/serializers/spree/v2/storefront/taxon_image_serializer.rb +11 -0
- data/app/serializers/spree/v2/storefront/taxon_serializer.rb +28 -0
- data/app/serializers/spree/v2/storefront/taxonomy_serializer.rb +11 -0
- data/app/serializers/spree/v2/storefront/user_serializer.rb +11 -0
- data/app/serializers/spree/v2/storefront/variant_serializer.rb +21 -0
- data/app/views/spree/api/v1/orders/order.v1.rabl +1 -1
- data/config/initializers/doorkeeper.rb +20 -0
- data/config/locales/en.yml +4 -0
- data/config/routes.rb +51 -3
- data/db/migrate/20180320110726_create_doorkeeper_tables.rb +69 -0
- data/docs/oauth/index.yml +77 -0
- data/docs/v2/storefront/index.yaml +2444 -0
- data/lib/spree/api/engine.rb +9 -2
- data/lib/spree_api.rb +2 -0
- data/spree_api.gemspec +5 -1
- metadata +92 -7
@@ -0,0 +1,14 @@
|
|
1
|
+
module Spree
|
2
|
+
module V2
|
3
|
+
module Storefront
|
4
|
+
class ShippingRateSerializer < BaseSerializer
|
5
|
+
set_type :shipping_rate
|
6
|
+
|
7
|
+
attributes :name, :selected, :final_price, :display_final_price, :cost,
|
8
|
+
:display_cost, :tax_amount, :display_tax_amount, :shipping_method_id
|
9
|
+
|
10
|
+
attribute :free, &:free?
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Spree
|
2
|
+
module V2
|
3
|
+
module Storefront
|
4
|
+
class TaxonSerializer < BaseSerializer
|
5
|
+
set_type :taxon
|
6
|
+
|
7
|
+
attributes :name, :pretty_name, :permalink, :seo_title, :meta_title, :meta_description,
|
8
|
+
:meta_keywords, :left, :right, :position, :depth, :updated_at
|
9
|
+
|
10
|
+
attribute :is_root, &:root?
|
11
|
+
attribute :is_child, &:child?
|
12
|
+
attribute :is_leaf, &:leaf?
|
13
|
+
|
14
|
+
belongs_to :parent, record_type: :taxon, serializer: :taxon
|
15
|
+
belongs_to :taxonomy, record_type: :taxonomy
|
16
|
+
|
17
|
+
has_many :children, record_type: :child, serializer: :taxon
|
18
|
+
has_many :products, record_type: :product
|
19
|
+
|
20
|
+
has_one :image,
|
21
|
+
object_method_name: :icon,
|
22
|
+
id_method_name: :icon_id,
|
23
|
+
record_type: :taxon_image,
|
24
|
+
serializer: :taxon_image
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Spree
|
2
|
+
module V2
|
3
|
+
module Storefront
|
4
|
+
class VariantSerializer < BaseSerializer
|
5
|
+
set_type :variant
|
6
|
+
|
7
|
+
attributes :name, :sku, :price, :currency, :display_price, :weight, :height,
|
8
|
+
:width, :depth, :is_master, :options_text, :slug, :description,
|
9
|
+
:track_inventory
|
10
|
+
|
11
|
+
attribute :purchasable, &:purchasable?
|
12
|
+
attribute :in_stock, &:in_stock?
|
13
|
+
attribute :backorderable, &:backorderable?
|
14
|
+
|
15
|
+
belongs_to :product
|
16
|
+
has_many :images
|
17
|
+
has_many :option_values
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -6,5 +6,5 @@ node(:display_total) { |o| o.display_total.to_s }
|
|
6
6
|
node(:display_ship_total, &:display_ship_total)
|
7
7
|
node(:display_tax_total, &:display_tax_total)
|
8
8
|
node(:display_adjustment_total, &:display_adjustment_total)
|
9
|
-
node(:token, &:
|
9
|
+
node(:token, &:token)
|
10
10
|
node(:checkout_steps, &:checkout_steps)
|
@@ -0,0 +1,20 @@
|
|
1
|
+
Doorkeeper.configure do
|
2
|
+
orm :active_record
|
3
|
+
use_refresh_token
|
4
|
+
api_only
|
5
|
+
|
6
|
+
resource_owner_authenticator { current_spree_user }
|
7
|
+
|
8
|
+
resource_owner_from_credentials do
|
9
|
+
user = Spree.user_class.find_for_database_authentication(email: params[:username])
|
10
|
+
user if user&.valid_for_authentication? { user.valid_password?(params[:password]) }
|
11
|
+
end
|
12
|
+
|
13
|
+
admin_authenticator do |routes|
|
14
|
+
current_spree_user&.has_spree_role?('admin') || redirect_to(routes.root_url)
|
15
|
+
end
|
16
|
+
|
17
|
+
grant_flows %w(password)
|
18
|
+
|
19
|
+
access_token_methods :from_bearer_authorization, :from_access_token_param
|
20
|
+
end
|
data/config/locales/en.yml
CHANGED
@@ -29,3 +29,7 @@ en:
|
|
29
29
|
shipment_transfer_errors_occured: "Following errors occured while attempting this action:"
|
30
30
|
negative_quantity: "quantity is negative"
|
31
31
|
wrong_shipment_target: "target shipment is the same as original shipment"
|
32
|
+
|
33
|
+
v2:
|
34
|
+
cart:
|
35
|
+
wrong_quantity: "Quantity has to be greater than 0"
|
data/config/routes.rb
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
spree_path = Rails.application.routes.url_helpers.try(:spree_path, trailing_slash: true) || '/'
|
2
|
+
|
3
|
+
Rails.application.routes.draw do
|
4
|
+
use_doorkeeper scope: "#{spree_path}/spree_oauth"
|
5
|
+
end
|
6
|
+
|
1
7
|
Spree::Core::Engine.add_routes do
|
2
8
|
namespace :api, defaults: { format: 'json' } do
|
3
9
|
namespace :v1 do
|
@@ -122,20 +128,62 @@ Spree::Core::Engine.add_routes do
|
|
122
128
|
get '/taxons/products', to: 'taxons#products', as: :taxon_products
|
123
129
|
end
|
124
130
|
|
125
|
-
|
131
|
+
namespace :v2 do
|
132
|
+
namespace :storefront do
|
133
|
+
resource :cart, controller: :cart, only: %i[show create] do
|
134
|
+
post :add_item
|
135
|
+
patch :empty
|
136
|
+
delete 'remove_line_item/:line_item_id', to: 'cart#remove_line_item', as: :cart_remove_line_item
|
137
|
+
patch :set_quantity
|
138
|
+
patch :apply_coupon_code
|
139
|
+
delete 'remove_coupon_code/:coupon_code', to: 'cart#remove_coupon_code', as: :cart_remove_coupon_code
|
140
|
+
end
|
141
|
+
|
142
|
+
resource :checkout, controller: :checkout, only: %i[update] do
|
143
|
+
patch :next
|
144
|
+
patch :advance
|
145
|
+
patch :complete
|
146
|
+
post :add_store_credit
|
147
|
+
post :remove_store_credit
|
148
|
+
get :payment_methods
|
149
|
+
get :shipping_rates
|
150
|
+
end
|
151
|
+
|
152
|
+
resource :account, controller: :account, only: %i[show]
|
153
|
+
|
154
|
+
namespace :account do
|
155
|
+
resources :credit_cards, controller: :credit_cards, only: %i[index show]
|
156
|
+
end
|
157
|
+
|
158
|
+
resources :countries, only: %i[index]
|
159
|
+
get '/countries/:iso', to: 'countries#show', as: :country
|
160
|
+
resources :products, only: %i[index show]
|
161
|
+
resources :taxons, only: %i[index show]
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
get '/404', to: 'errors#render_404'
|
126
166
|
|
127
167
|
match 'v:api/*path', to: redirect { |params, request|
|
128
168
|
format = ".#{params[:format]}" unless params[:format].blank?
|
129
169
|
query = "?#{request.query_string}" unless request.query_string.blank?
|
130
170
|
|
131
|
-
"#{spree_path}api/v1/#{params[:path]}#{format}#{query}"
|
171
|
+
if request.path == "#{spree_path}api/v1/#{params[:path]}#{format}#{query}"
|
172
|
+
"#{spree_path}api/404"
|
173
|
+
else
|
174
|
+
"#{spree_path}api/v1/#{params[:path]}#{format}#{query}"
|
175
|
+
end
|
132
176
|
}, via: [:get, :post, :put, :patch, :delete]
|
133
177
|
|
134
178
|
match '*path', to: redirect { |params, request|
|
135
179
|
format = ".#{params[:format]}" unless params[:format].blank?
|
136
180
|
query = "?#{request.query_string}" unless request.query_string.blank?
|
137
181
|
|
138
|
-
"#{spree_path}api/v1/#{params[:path]}#{format}#{query}"
|
182
|
+
if request.path == "#{spree_path}api/v1/#{params[:path]}#{format}#{query}"
|
183
|
+
"#{spree_path}api/404"
|
184
|
+
else
|
185
|
+
"#{spree_path}api/v1/#{params[:path]}#{format}#{query}"
|
186
|
+
end
|
139
187
|
}, via: [:get, :post, :put, :patch, :delete]
|
140
188
|
end
|
141
189
|
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
class CreateDoorkeeperTables < ActiveRecord::Migration[5.1]
|
2
|
+
def change
|
3
|
+
create_table :spree_oauth_applications do |t|
|
4
|
+
t.string :name, null: false
|
5
|
+
t.string :uid, null: false
|
6
|
+
t.string :secret, null: false
|
7
|
+
t.text :redirect_uri, null: false
|
8
|
+
t.string :scopes, null: false, default: ''
|
9
|
+
t.boolean :confidential, null: false, default: true
|
10
|
+
t.timestamps null: false
|
11
|
+
end
|
12
|
+
|
13
|
+
add_index :spree_oauth_applications, :uid, unique: true
|
14
|
+
|
15
|
+
create_table :spree_oauth_access_grants do |t|
|
16
|
+
t.integer :resource_owner_id, null: false
|
17
|
+
t.references :application, null: false
|
18
|
+
t.string :token, null: false
|
19
|
+
t.integer :expires_in, null: false
|
20
|
+
t.text :redirect_uri, null: false
|
21
|
+
t.datetime :created_at, null: false
|
22
|
+
t.datetime :revoked_at
|
23
|
+
t.string :scopes
|
24
|
+
end
|
25
|
+
|
26
|
+
add_index :spree_oauth_access_grants, :token, unique: true
|
27
|
+
add_foreign_key(
|
28
|
+
:spree_oauth_access_grants,
|
29
|
+
:spree_oauth_applications,
|
30
|
+
column: :application_id
|
31
|
+
)
|
32
|
+
|
33
|
+
create_table :spree_oauth_access_tokens do |t|
|
34
|
+
t.integer :resource_owner_id
|
35
|
+
t.references :application
|
36
|
+
|
37
|
+
# If you use a custom token generator you may need to change this column
|
38
|
+
# from string to text, so that it accepts tokens larger than 255
|
39
|
+
# characters. More info on custom token generators in:
|
40
|
+
# https://github.com/doorkeeper-gem/doorkeeper/tree/v3.0.0.rc1#custom-access-token-generator
|
41
|
+
#
|
42
|
+
# t.text :token, null: false
|
43
|
+
t.string :token, null: false
|
44
|
+
|
45
|
+
t.string :refresh_token
|
46
|
+
t.integer :expires_in
|
47
|
+
t.datetime :revoked_at
|
48
|
+
t.datetime :created_at, null: false
|
49
|
+
t.string :scopes
|
50
|
+
|
51
|
+
# If there is a previous_refresh_token column,
|
52
|
+
# refresh tokens will be revoked after a related access token is used.
|
53
|
+
# If there is no previous_refresh_token column,
|
54
|
+
# previous tokens are revoked as soon as a new access token is created.
|
55
|
+
# Comment out this line if you'd rather have refresh tokens
|
56
|
+
# instantly revoked.
|
57
|
+
t.string :previous_refresh_token, null: false, default: ""
|
58
|
+
end
|
59
|
+
|
60
|
+
add_index :spree_oauth_access_tokens, :token, unique: true
|
61
|
+
add_index :spree_oauth_access_tokens, :resource_owner_id
|
62
|
+
add_index :spree_oauth_access_tokens, :refresh_token, unique: true
|
63
|
+
add_foreign_key(
|
64
|
+
:spree_oauth_access_tokens,
|
65
|
+
:spree_oauth_applications,
|
66
|
+
column: :application_id
|
67
|
+
)
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
openapi: 3.0.0
|
2
|
+
servers:
|
3
|
+
- url: 'http://localhost:3000/spree_oauth'
|
4
|
+
info:
|
5
|
+
version: 1.0.0
|
6
|
+
title: Spree OAuth 2.0 Authentication
|
7
|
+
description: >-
|
8
|
+
Spree uses the [Doorkeeper](https://github.com/doorkeeper-gem/doorkeeper) gem
|
9
|
+
for handling OAuth. This integration is built into `spree_api` gem.
|
10
|
+
paths:
|
11
|
+
'/token':
|
12
|
+
post:
|
13
|
+
description: >-
|
14
|
+
Creates or refreshes a Bearer token required to authorize calls API calls
|
15
|
+
tags:
|
16
|
+
- Token
|
17
|
+
operationId: Create or Refresh Token
|
18
|
+
responses:
|
19
|
+
'200':
|
20
|
+
description: Token was succesfully created or refreshed
|
21
|
+
content:
|
22
|
+
application/json:
|
23
|
+
schema:
|
24
|
+
$ref: '#/components/schemas/Token'
|
25
|
+
requestBody:
|
26
|
+
required: true
|
27
|
+
content:
|
28
|
+
application/x-www-form-urlencoded:
|
29
|
+
schema:
|
30
|
+
oneOf:
|
31
|
+
- $ref: '#/components/schemas/CreateTokenBody'
|
32
|
+
- $ref: '#/components/schemas/RefreshTokenBody'
|
33
|
+
components:
|
34
|
+
schemas:
|
35
|
+
Token:
|
36
|
+
properties:
|
37
|
+
access_token:
|
38
|
+
type: string
|
39
|
+
example: 2480c16561d1391ea81ca5336b651e9a29f4524f6dee8c7f3f02a600159189c3
|
40
|
+
token_type:
|
41
|
+
type: string
|
42
|
+
example: Bearer
|
43
|
+
default: Bearer
|
44
|
+
expires_in:
|
45
|
+
type: integer
|
46
|
+
example: 7200
|
47
|
+
description: 'Time (in seconds) after which the access token will expire'
|
48
|
+
refresh_token:
|
49
|
+
type: string
|
50
|
+
example: f5d78642252eeb3f3001f67b196ac21a27afc030462a54060b0ebbdae2b8dc9c
|
51
|
+
created_at:
|
52
|
+
type: integer
|
53
|
+
example: 1539863418
|
54
|
+
CreateTokenBody:
|
55
|
+
properties:
|
56
|
+
grant_type:
|
57
|
+
type: string
|
58
|
+
default: password
|
59
|
+
description: >-
|
60
|
+
Use `password` to create a token and `refresh_token` to refresh it
|
61
|
+
username:
|
62
|
+
type: string
|
63
|
+
description: User email address
|
64
|
+
example: 'spree@example.com'
|
65
|
+
password:
|
66
|
+
type: string
|
67
|
+
description: User password
|
68
|
+
example: 'spree123'
|
69
|
+
RefreshTokenBody:
|
70
|
+
properties:
|
71
|
+
grant_type:
|
72
|
+
type: string
|
73
|
+
default: refresh_token
|
74
|
+
refresh_token:
|
75
|
+
type: string
|
76
|
+
description: Rerefresh token obtained from the old created token
|
77
|
+
example: 27af95fd57a424e5d01aaf5eab1324a8d5c0ca57daf384fae39f811a5144330143301'
|
@@ -0,0 +1,2444 @@
|
|
1
|
+
openapi: 3.0.0
|
2
|
+
servers:
|
3
|
+
- url: 'http://localhost:3000/api/v2/storefront'
|
4
|
+
info:
|
5
|
+
version: 2.0.0
|
6
|
+
title: Storefront API
|
7
|
+
description: >-
|
8
|
+
<p>
|
9
|
+
Storefront API v2 is a modern REST API based on the
|
10
|
+
<a href="https://jsonapi.org/" target="_blank" rel="noopener">JSON API spec</a>
|
11
|
+
which provides you with necessary endpoints to build amazing user
|
12
|
+
intefaces either in JavaScript frameworks or native mobile libraries.
|
13
|
+
</p>
|
14
|
+
<p>
|
15
|
+
Please read our introduction to the API v2 [insert link here]
|
16
|
+
</p>
|
17
|
+
<p>
|
18
|
+
<a href="https://raw.githubusercontent.com/spree/spree/master/api/docs/v2/storefront/index.yaml" target="_blank" rel="noopener">
|
19
|
+
Import this documentation to Postman
|
20
|
+
</a>
|
21
|
+
</p>
|
22
|
+
paths:
|
23
|
+
'/account':
|
24
|
+
get:
|
25
|
+
description: >-
|
26
|
+
Returns current user information
|
27
|
+
tags:
|
28
|
+
- Account
|
29
|
+
operationId: 'Account Information'
|
30
|
+
parameters:
|
31
|
+
- $ref: '#/components/parameters/AccountIncludeParam'
|
32
|
+
- $ref: '#/components/parameters/SparseFieldsParam'
|
33
|
+
responses:
|
34
|
+
'200':
|
35
|
+
description: ok
|
36
|
+
content:
|
37
|
+
application/json:
|
38
|
+
schema:
|
39
|
+
$ref: '#/components/schemas/Account'
|
40
|
+
'403':
|
41
|
+
$ref: '#/components/responses/403Forbidden'
|
42
|
+
security:
|
43
|
+
- bearerAuth: []
|
44
|
+
|
45
|
+
'/account/credit_cards':
|
46
|
+
get:
|
47
|
+
description: >-
|
48
|
+
Returns a list of Credit Cards for the signed in User
|
49
|
+
tags:
|
50
|
+
- Account
|
51
|
+
operationId: 'Credit Cards list'
|
52
|
+
responses:
|
53
|
+
'200':
|
54
|
+
description: Listing user credit cards.
|
55
|
+
content:
|
56
|
+
application/json:
|
57
|
+
schema:
|
58
|
+
$ref: '#/components/schemas/CreditCardList'
|
59
|
+
'403':
|
60
|
+
$ref: '#/components/responses/403Forbidden'
|
61
|
+
security:
|
62
|
+
- bearerAuth: []
|
63
|
+
parameters:
|
64
|
+
- in: query
|
65
|
+
name: filter[payment_method_id]
|
66
|
+
schema:
|
67
|
+
type: integer
|
68
|
+
example: 2
|
69
|
+
description: Filter based on payment method ID
|
70
|
+
- $ref: '#/components/parameters/CreditCardIncludeParam'
|
71
|
+
- $ref: '#/components/parameters/SparseFieldsParam'
|
72
|
+
'/account/credit_cards/default':
|
73
|
+
get:
|
74
|
+
description: >-
|
75
|
+
Return the User's default Credit Card
|
76
|
+
tags:
|
77
|
+
- Account
|
78
|
+
operationId: 'Default Credit Card'
|
79
|
+
responses:
|
80
|
+
'200':
|
81
|
+
description: Listing user default credit card.
|
82
|
+
content:
|
83
|
+
application/json:
|
84
|
+
schema:
|
85
|
+
$ref: '#/components/schemas/CreditCard'
|
86
|
+
'403':
|
87
|
+
$ref: '#/components/responses/403Forbidden'
|
88
|
+
parameters:
|
89
|
+
- $ref: '#/components/parameters/CreditCardIncludeParam'
|
90
|
+
- $ref: '#/components/parameters/SparseFieldsParam'
|
91
|
+
security:
|
92
|
+
- bearerAuth: []
|
93
|
+
'/cart':
|
94
|
+
post:
|
95
|
+
description: >-
|
96
|
+
<p>Creates new Cart and returns it attributes.</p>
|
97
|
+
<br />
|
98
|
+
<p>
|
99
|
+
<strong>token</strong> attribute, can be used for authorization of all operations
|
100
|
+
on this particular Cart and Checkout.
|
101
|
+
</p>
|
102
|
+
tags:
|
103
|
+
- Cart
|
104
|
+
operationId: 'Create Cart'
|
105
|
+
responses:
|
106
|
+
'201':
|
107
|
+
description: Cart was successfully created
|
108
|
+
content:
|
109
|
+
application/json:
|
110
|
+
schema:
|
111
|
+
$ref: '#/components/schemas/Cart'
|
112
|
+
parameters:
|
113
|
+
- $ref: '#/components/parameters/CartIncludeParam'
|
114
|
+
- $ref: '#/components/parameters/SparseFieldsParam'
|
115
|
+
get:
|
116
|
+
description: Returns contents of the cart
|
117
|
+
tags:
|
118
|
+
- Cart
|
119
|
+
operationId: 'Get Cart'
|
120
|
+
responses:
|
121
|
+
'200':
|
122
|
+
description: Correct cart was returned
|
123
|
+
content:
|
124
|
+
application/json:
|
125
|
+
schema:
|
126
|
+
$ref: '#/components/schemas/Cart'
|
127
|
+
'404':
|
128
|
+
$ref: '#/components/responses/404NotFound'
|
129
|
+
security:
|
130
|
+
- orderToken: []
|
131
|
+
- bearerAuth: []
|
132
|
+
parameters:
|
133
|
+
- $ref: '#/components/parameters/CartIncludeParam'
|
134
|
+
- $ref: '#/components/parameters/SparseFieldsParam'
|
135
|
+
|
136
|
+
'/cart/add_item':
|
137
|
+
post:
|
138
|
+
description: >-
|
139
|
+
Adds a Product Variant to the Cart
|
140
|
+
<br />
|
141
|
+
<p>
|
142
|
+
Additional parameters passed in <strong>options</strong> hash
|
143
|
+
must be registered in <cite>config/initialiers/spree.rb</cite>, eg.
|
144
|
+
</p>
|
145
|
+
<br />
|
146
|
+
<blockquote>
|
147
|
+
Spree::PermittedAttributes.line_item_attributes << :foo
|
148
|
+
</blockquote>
|
149
|
+
tags:
|
150
|
+
- Cart
|
151
|
+
operationId: 'Add Item'
|
152
|
+
responses:
|
153
|
+
'200':
|
154
|
+
description: Item was added to the Cart successfully
|
155
|
+
content:
|
156
|
+
application/json:
|
157
|
+
schema:
|
158
|
+
$ref: '#/components/schemas/Cart'
|
159
|
+
'404':
|
160
|
+
$ref: '#/components/responses/404NotFound'
|
161
|
+
security:
|
162
|
+
- orderToken: []
|
163
|
+
- bearerAuth: []
|
164
|
+
parameters:
|
165
|
+
- $ref: '#/components/parameters/CartIncludeParam'
|
166
|
+
- $ref: '#/components/parameters/SparseFieldsParam'
|
167
|
+
requestBody:
|
168
|
+
required: true
|
169
|
+
content:
|
170
|
+
application/json:
|
171
|
+
schema:
|
172
|
+
type: object
|
173
|
+
properties:
|
174
|
+
variant_id:
|
175
|
+
type: string
|
176
|
+
quantity:
|
177
|
+
type: integer
|
178
|
+
options:
|
179
|
+
type: object
|
180
|
+
description: >-
|
181
|
+
Additional custom options.
|
182
|
+
You need to add them via
|
183
|
+
`Spree::PermittedAttributes.line_item_attributes << :foo`
|
184
|
+
in `config/initialiers/spree.rb`
|
185
|
+
example:
|
186
|
+
variant_id: "1"
|
187
|
+
quantity: 5
|
188
|
+
|
189
|
+
'/cart/set_quantity':
|
190
|
+
patch:
|
191
|
+
description: Sets the quantity of a given line item. It has to be a positive integer greater than 0.
|
192
|
+
tags:
|
193
|
+
- Cart
|
194
|
+
operationId: 'Set Quantity'
|
195
|
+
responses:
|
196
|
+
'200':
|
197
|
+
description: New quantity has been successfully set for a requested Line Item
|
198
|
+
content:
|
199
|
+
application/json:
|
200
|
+
schema:
|
201
|
+
$ref: '#/components/schemas/Cart'
|
202
|
+
'422':
|
203
|
+
description: Stock quantity is not sufficient for this request to be fulfielled
|
204
|
+
content:
|
205
|
+
application/json:
|
206
|
+
schema:
|
207
|
+
$ref: '#/components/schemas/Error'
|
208
|
+
security:
|
209
|
+
- orderToken: []
|
210
|
+
- bearerAuth: []
|
211
|
+
parameters:
|
212
|
+
- $ref: '#/components/parameters/CartIncludeParam'
|
213
|
+
- $ref: '#/components/parameters/SparseFieldsParam'
|
214
|
+
requestBody:
|
215
|
+
required: true
|
216
|
+
content:
|
217
|
+
application/json:
|
218
|
+
schema:
|
219
|
+
type: object
|
220
|
+
properties:
|
221
|
+
line_item_id:
|
222
|
+
type: string
|
223
|
+
quantity:
|
224
|
+
type: integer
|
225
|
+
example:
|
226
|
+
line_item_id: "1"
|
227
|
+
quantity: 5
|
228
|
+
|
229
|
+
'/cart/remove_line_item/{line_item_id}':
|
230
|
+
delete:
|
231
|
+
description: Removes Line Item from Cart
|
232
|
+
tags:
|
233
|
+
- Cart
|
234
|
+
operationId: 'Remove Line Item'
|
235
|
+
parameters:
|
236
|
+
- $ref: '#/components/parameters/LineItemId'
|
237
|
+
- $ref: '#/components/parameters/CartIncludeParam'
|
238
|
+
- $ref: '#/components/parameters/SparseFieldsParam'
|
239
|
+
responses:
|
240
|
+
'200':
|
241
|
+
description: Requested Line Item has been removed from the Cart
|
242
|
+
content:
|
243
|
+
application/json:
|
244
|
+
schema:
|
245
|
+
$ref: '#/components/schemas/Cart'
|
246
|
+
'404':
|
247
|
+
$ref: '#/components/responses/404NotFound'
|
248
|
+
security:
|
249
|
+
- orderToken: []
|
250
|
+
- bearerAuth: []
|
251
|
+
|
252
|
+
'/cart/empty':
|
253
|
+
patch:
|
254
|
+
description: Empties the Cart
|
255
|
+
tags:
|
256
|
+
- Cart
|
257
|
+
operationId: 'Empty Cart'
|
258
|
+
responses:
|
259
|
+
'200':
|
260
|
+
description: Cart has been successfully emptied
|
261
|
+
content:
|
262
|
+
application/json:
|
263
|
+
schema:
|
264
|
+
$ref: '#/components/schemas/Cart'
|
265
|
+
'404':
|
266
|
+
$ref: '#/components/responses/404NotFound'
|
267
|
+
security:
|
268
|
+
- orderToken: []
|
269
|
+
- bearerAuth: []
|
270
|
+
parameters:
|
271
|
+
- $ref: '#/components/parameters/CartIncludeParam'
|
272
|
+
- $ref: '#/components/parameters/SparseFieldsParam'
|
273
|
+
|
274
|
+
'/cart/apply_coupon_code':
|
275
|
+
patch:
|
276
|
+
description: Applies a coupon code to the Cart
|
277
|
+
tags:
|
278
|
+
- Cart
|
279
|
+
operationId: 'Apply Coupon Code'
|
280
|
+
responses:
|
281
|
+
'200':
|
282
|
+
description: Cuopon code was applied successfully
|
283
|
+
content:
|
284
|
+
application/json:
|
285
|
+
schema:
|
286
|
+
$ref: '#/components/schemas/Cart'
|
287
|
+
'422':
|
288
|
+
description: Coupon code couldn't be applied
|
289
|
+
content:
|
290
|
+
application/json:
|
291
|
+
schema:
|
292
|
+
$ref: '#/components/schemas/Error'
|
293
|
+
security:
|
294
|
+
- orderToken: []
|
295
|
+
- bearerAuth: []
|
296
|
+
parameters:
|
297
|
+
- $ref: '#/components/parameters/CartIncludeParam'
|
298
|
+
- $ref: '#/components/parameters/SparseFieldsParam'
|
299
|
+
requestBody:
|
300
|
+
required: true
|
301
|
+
content:
|
302
|
+
application/json:
|
303
|
+
schema:
|
304
|
+
type: object
|
305
|
+
properties:
|
306
|
+
coupon_code:
|
307
|
+
type: string
|
308
|
+
example: 'DISCOUNT10'
|
309
|
+
|
310
|
+
'/cart/remove_coupon_code/{coupon_code}':
|
311
|
+
delete:
|
312
|
+
description: Removes a coupon code from the Cart
|
313
|
+
tags:
|
314
|
+
- Cart
|
315
|
+
operationId: 'Remove Coupon Code'
|
316
|
+
parameters:
|
317
|
+
- name: coupon_code
|
318
|
+
in: path
|
319
|
+
required: true
|
320
|
+
description: Coupon code applied to Order
|
321
|
+
schema:
|
322
|
+
type: string
|
323
|
+
example: 'DISCOUNT10'
|
324
|
+
- $ref: '#/components/parameters/CartIncludeParam'
|
325
|
+
- $ref: '#/components/parameters/SparseFieldsParam'
|
326
|
+
responses:
|
327
|
+
'200':
|
328
|
+
description: Coupon code was removed successfully
|
329
|
+
content:
|
330
|
+
application/json:
|
331
|
+
schema:
|
332
|
+
$ref: '#/components/schemas/Cart'
|
333
|
+
'422':
|
334
|
+
description: Coupon code couldn't be removed
|
335
|
+
content:
|
336
|
+
application/json:
|
337
|
+
schema:
|
338
|
+
$ref: '#/components/schemas/Error'
|
339
|
+
security:
|
340
|
+
- orderToken: []
|
341
|
+
- bearerAuth: []
|
342
|
+
|
343
|
+
'/checkout':
|
344
|
+
patch:
|
345
|
+
description: >-
|
346
|
+
Updates the Checkout
|
347
|
+
<br />
|
348
|
+
<p>
|
349
|
+
You can run multiple Checkout updates with different data types.
|
350
|
+
</p>
|
351
|
+
<h3>1. Update the Customer information<h3>
|
352
|
+
<pre>PATCH /checkout</pre>
|
353
|
+
<br />
|
354
|
+
<pre>
|
355
|
+
order: {
|
356
|
+
email: 'john@snow.org',
|
357
|
+
bill_address_attributes: {
|
358
|
+
{
|
359
|
+
firstname: 'John',
|
360
|
+
lastname: 'Snow',
|
361
|
+
address1: '7735 Old Georgetown Road',
|
362
|
+
city: 'Bethesda',
|
363
|
+
phone: '3014445002',
|
364
|
+
zipcode: '20814',
|
365
|
+
state_name: 'MD',
|
366
|
+
country_id: 232
|
367
|
+
}
|
368
|
+
},
|
369
|
+
ship_address_attributes: {
|
370
|
+
{
|
371
|
+
firstname: 'John',
|
372
|
+
lastname: 'Snow',
|
373
|
+
address1: '7735 Old Georgetown Road',
|
374
|
+
city: 'Bethesda',
|
375
|
+
phone: '3014445002',
|
376
|
+
zipcode: '20814',
|
377
|
+
state_name: 'MD',
|
378
|
+
country_id: 232
|
379
|
+
}
|
380
|
+
}
|
381
|
+
}
|
382
|
+
</pre>
|
383
|
+
<h3>2. Fetch Shipping Rates</h3>
|
384
|
+
<pre>
|
385
|
+
GET /checkout/shipping_rates
|
386
|
+
</pre>
|
387
|
+
<br />
|
388
|
+
<p>
|
389
|
+
Order can have multiple Shipments, eg. some Items will be shipped right away,
|
390
|
+
and some needs to be backordered.
|
391
|
+
</p>
|
392
|
+
<p>
|
393
|
+
Each Shipment can have different Shipping Method/Rate selected.
|
394
|
+
</p>
|
395
|
+
|
396
|
+
<h3>3. Select shipping method(s)</h3>
|
397
|
+
<pre>PATCH /checkout</pre>
|
398
|
+
<br />
|
399
|
+
<pre>
|
400
|
+
order: {
|
401
|
+
shipments_attributes: {
|
402
|
+
'0' => { selected_shipping_rate_id: 1, id: 1}
|
403
|
+
}
|
404
|
+
}
|
405
|
+
</pre>
|
406
|
+
<br />
|
407
|
+
<p>
|
408
|
+
<code>selected_shipping_rate_id</code> is the ID of a Shipping Rate.
|
409
|
+
<code>id</code> is the ID of the Shipment itself. You can update multiple
|
410
|
+
Shipments at once.
|
411
|
+
</p>
|
412
|
+
<h3>4. Add Payment Source(s)</h3>
|
413
|
+
<pre>PATCH /checkout</pre>
|
414
|
+
<br />
|
415
|
+
<pre>
|
416
|
+
{
|
417
|
+
order: {
|
418
|
+
payments_attributes: [
|
419
|
+
{
|
420
|
+
payment_method_id: 1
|
421
|
+
}
|
422
|
+
]
|
423
|
+
},
|
424
|
+
payment_source: {
|
425
|
+
'1' => {
|
426
|
+
number: '4111111111111111',
|
427
|
+
month: '01',
|
428
|
+
year: '2022',
|
429
|
+
verification_value: '123',
|
430
|
+
name: 'John Doe'
|
431
|
+
}
|
432
|
+
}
|
433
|
+
}
|
434
|
+
</pre>
|
435
|
+
<br />
|
436
|
+
<p>
|
437
|
+
You can obtain <code>payment_method_id</code> by querying
|
438
|
+
<code>GET /checkout/payment_methods</code> endpoint.
|
439
|
+
</p>
|
440
|
+
<h3>5. Complete checkout</h3>
|
441
|
+
<pre>PATCH /checkout/complete</pre>
|
442
|
+
<br />
|
443
|
+
<p>
|
444
|
+
This will complete the Checout and will marke the Order as completed.
|
445
|
+
You cannot execute any operations on this Order anymore via Storefront API.
|
446
|
+
Further operations on the Order are possible via Platform API.
|
447
|
+
</p>
|
448
|
+
tags:
|
449
|
+
- Checkout
|
450
|
+
operationId: 'Update Checkout'
|
451
|
+
responses:
|
452
|
+
'200':
|
453
|
+
description: Checkout was updated
|
454
|
+
content:
|
455
|
+
application/json:
|
456
|
+
schema:
|
457
|
+
$ref: '#/components/schemas/Cart'
|
458
|
+
'422':
|
459
|
+
description: Checkout couldn't be updated
|
460
|
+
content:
|
461
|
+
application/json:
|
462
|
+
schema:
|
463
|
+
$ref: '#/components/schemas/Error'
|
464
|
+
'404':
|
465
|
+
$ref: '#/components/responses/404NotFound'
|
466
|
+
security:
|
467
|
+
- orderToken: []
|
468
|
+
- bearerAuth: []
|
469
|
+
parameters:
|
470
|
+
- $ref: '#/components/parameters/CartIncludeParam'
|
471
|
+
requestBody:
|
472
|
+
required: true
|
473
|
+
content:
|
474
|
+
application/json:
|
475
|
+
schema:
|
476
|
+
type: object
|
477
|
+
properties:
|
478
|
+
order:
|
479
|
+
type: object
|
480
|
+
properties:
|
481
|
+
email:
|
482
|
+
type: string
|
483
|
+
example: 'john@snow.org'
|
484
|
+
bill_address_attributes:
|
485
|
+
$ref: '#/components/schemas/AddressPayload'
|
486
|
+
ship_address_attributes:
|
487
|
+
$ref: '#/components/schemas/AddressPayload'
|
488
|
+
payments_attributes:
|
489
|
+
type: array
|
490
|
+
items:
|
491
|
+
type: object
|
492
|
+
properties:
|
493
|
+
payment_method_id:
|
494
|
+
type: number
|
495
|
+
example: 1
|
496
|
+
description: 'ID of selected payment method'
|
497
|
+
shipments_attributes:
|
498
|
+
type: object
|
499
|
+
payment_source:
|
500
|
+
type: object
|
501
|
+
|
502
|
+
'/checkout/next':
|
503
|
+
patch:
|
504
|
+
description: Goes to the next Checkout step
|
505
|
+
tags:
|
506
|
+
- Checkout
|
507
|
+
operationId: 'Checkout Next'
|
508
|
+
responses:
|
509
|
+
'200':
|
510
|
+
description: Checkout transitioned to the next step
|
511
|
+
content:
|
512
|
+
application/json:
|
513
|
+
schema:
|
514
|
+
$ref: '#/components/schemas/Cart'
|
515
|
+
'422':
|
516
|
+
description: Checkout couldn't transition to the next step
|
517
|
+
content:
|
518
|
+
application/json:
|
519
|
+
schema:
|
520
|
+
$ref: '#/components/schemas/Error'
|
521
|
+
'404':
|
522
|
+
$ref: '#/components/responses/404NotFound'
|
523
|
+
security:
|
524
|
+
- orderToken: []
|
525
|
+
- bearerAuth: []
|
526
|
+
parameters:
|
527
|
+
- $ref: '#/components/parameters/CartIncludeParam'
|
528
|
+
- $ref: '#/components/parameters/SparseFieldsParam'
|
529
|
+
|
530
|
+
'/checkout/advance':
|
531
|
+
patch:
|
532
|
+
description: Advances Checkout to the furthest Checkout step validation allows, until the Complete step
|
533
|
+
tags:
|
534
|
+
- Checkout
|
535
|
+
operationId: 'Advance Checkout'
|
536
|
+
responses:
|
537
|
+
'200':
|
538
|
+
description: Checkout was advanced to the furthest step
|
539
|
+
content:
|
540
|
+
application/json:
|
541
|
+
schema:
|
542
|
+
$ref: '#/components/schemas/Cart'
|
543
|
+
'422':
|
544
|
+
description: Checkout couldn't transition to the next step
|
545
|
+
content:
|
546
|
+
application/json:
|
547
|
+
schema:
|
548
|
+
$ref: '#/components/schemas/Error'
|
549
|
+
'404':
|
550
|
+
$ref: '#/components/responses/404NotFound'
|
551
|
+
security:
|
552
|
+
- orderToken: []
|
553
|
+
- bearerAuth: []
|
554
|
+
parameters:
|
555
|
+
- $ref: '#/components/parameters/CartIncludeParam'
|
556
|
+
- $ref: '#/components/parameters/SparseFieldsParam'
|
557
|
+
|
558
|
+
'/checkout/complete':
|
559
|
+
patch:
|
560
|
+
description: Completes the Checkout
|
561
|
+
tags:
|
562
|
+
- Checkout
|
563
|
+
operationId: 'Complete Checkout'
|
564
|
+
responses:
|
565
|
+
'200':
|
566
|
+
description: Checkout was completed
|
567
|
+
content:
|
568
|
+
application/json:
|
569
|
+
schema:
|
570
|
+
$ref: '#/components/schemas/Cart'
|
571
|
+
'422':
|
572
|
+
description: Checkout couldn't be completed
|
573
|
+
content:
|
574
|
+
application/json:
|
575
|
+
schema:
|
576
|
+
$ref: '#/components/schemas/Error'
|
577
|
+
'404':
|
578
|
+
$ref: '#/components/responses/404NotFound'
|
579
|
+
security:
|
580
|
+
- orderToken: []
|
581
|
+
- bearerAuth: []
|
582
|
+
parameters:
|
583
|
+
- $ref: '#/components/parameters/CartIncludeParam'
|
584
|
+
|
585
|
+
'/checkout/add_store_credit':
|
586
|
+
post:
|
587
|
+
description: Adds Store Credit payments if a user has any
|
588
|
+
tags:
|
589
|
+
- Checkout
|
590
|
+
operationId: 'Add Store Credit'
|
591
|
+
responses:
|
592
|
+
'200':
|
593
|
+
description: Store Credit payment created
|
594
|
+
content:
|
595
|
+
application/json:
|
596
|
+
schema:
|
597
|
+
$ref: '#/components/schemas/Cart'
|
598
|
+
'422':
|
599
|
+
description: Store Credit couldn't be created
|
600
|
+
content:
|
601
|
+
application/json:
|
602
|
+
schema:
|
603
|
+
$ref: '#/components/schemas/Error'
|
604
|
+
'404':
|
605
|
+
$ref: '#/components/responses/404NotFound'
|
606
|
+
security:
|
607
|
+
- orderToken: []
|
608
|
+
- bearerAuth: []
|
609
|
+
parameters:
|
610
|
+
- in: query
|
611
|
+
name: amount
|
612
|
+
description: >-
|
613
|
+
Amount of Store Credit to use.
|
614
|
+
As much as possible Store Credit will be applied if no amount is passed.
|
615
|
+
schema:
|
616
|
+
type: string
|
617
|
+
example: 100.0
|
618
|
+
- $ref: '#/components/parameters/CartIncludeParam'
|
619
|
+
- $ref: '#/components/parameters/SparseFieldsParam'
|
620
|
+
'/checkout/remove_store_credit':
|
621
|
+
post:
|
622
|
+
description: Remove Store Credit payments if any applied
|
623
|
+
tags:
|
624
|
+
- Checkout
|
625
|
+
operationId: 'Remove Store Credit'
|
626
|
+
responses:
|
627
|
+
'200':
|
628
|
+
description: Store Credit payment removed
|
629
|
+
content:
|
630
|
+
application/json:
|
631
|
+
schema:
|
632
|
+
$ref: '#/components/schemas/Cart'
|
633
|
+
'422':
|
634
|
+
description: Store Credit payments weren't removed
|
635
|
+
content:
|
636
|
+
application/json:
|
637
|
+
schema:
|
638
|
+
$ref: '#/components/schemas/Error'
|
639
|
+
'404':
|
640
|
+
$ref: '#/components/responses/404NotFound'
|
641
|
+
security:
|
642
|
+
- orderToken: []
|
643
|
+
- bearerAuth: []
|
644
|
+
parameters:
|
645
|
+
- $ref: '#/components/parameters/CartIncludeParam'
|
646
|
+
- $ref: '#/components/parameters/SparseFieldsParam'
|
647
|
+
|
648
|
+
'/checkout/payment_methods':
|
649
|
+
get:
|
650
|
+
description: >-
|
651
|
+
Returns a list of available Payment Methods
|
652
|
+
tags:
|
653
|
+
- Checkout
|
654
|
+
operationId: 'Payment Methods'
|
655
|
+
responses:
|
656
|
+
'200':
|
657
|
+
description: Returns a list of available Payment Methods
|
658
|
+
content:
|
659
|
+
application/json:
|
660
|
+
schema:
|
661
|
+
$ref: '#/components/schemas/PaymentMethodsList'
|
662
|
+
'404':
|
663
|
+
$ref: '#/components/responses/404NotFound'
|
664
|
+
security:
|
665
|
+
- orderToken: []
|
666
|
+
- bearerAuth: []
|
667
|
+
|
668
|
+
'/checkout/shipping_rates':
|
669
|
+
get:
|
670
|
+
description: >-
|
671
|
+
Returns a list of available Shipping Rates for Checkout.
|
672
|
+
Shipping Rates are grouped against Shipments.
|
673
|
+
Each checkout cna have multiple Shipments eg. some products are available
|
674
|
+
in stock and will be send out instantly and some needs to be backordered.
|
675
|
+
tags:
|
676
|
+
- Checkout
|
677
|
+
operationId: 'Shipping Rates'
|
678
|
+
responses:
|
679
|
+
'200':
|
680
|
+
description: Returns a list of available Shipping Rates for Checkout
|
681
|
+
content:
|
682
|
+
application/json:
|
683
|
+
schema:
|
684
|
+
$ref: '#/components/schemas/ShippingRatesList'
|
685
|
+
'404':
|
686
|
+
$ref: '#/components/responses/404NotFound'
|
687
|
+
security:
|
688
|
+
- orderToken: []
|
689
|
+
- bearerAuth: []
|
690
|
+
|
691
|
+
'/products':
|
692
|
+
get:
|
693
|
+
description: >-
|
694
|
+
Returns a list of Products
|
695
|
+
tags:
|
696
|
+
- Products
|
697
|
+
operationId: 'Products List'
|
698
|
+
parameters:
|
699
|
+
- $ref: '#/components/parameters/FilterByIds'
|
700
|
+
- in: query
|
701
|
+
name: filter[price]
|
702
|
+
schema:
|
703
|
+
type: string
|
704
|
+
example: 10,100
|
705
|
+
description: Filter Prodcuts based on price (minimum, maximum range)
|
706
|
+
- in: query
|
707
|
+
name: filter[taxons]
|
708
|
+
schema:
|
709
|
+
type: string
|
710
|
+
example: 1,2,3,4,5,6,7,8,9,10,11
|
711
|
+
description: Filter Prodcuts based on taxons (IDs of categories, brands, etc)
|
712
|
+
- in: query
|
713
|
+
name: filter[name]
|
714
|
+
schema:
|
715
|
+
type: string
|
716
|
+
example: rails
|
717
|
+
description: Find Prodcuts with matching name (supports wild-card, partial-word match search)
|
718
|
+
- in: query
|
719
|
+
name: 'filter[options][tshirt-color]'
|
720
|
+
schema:
|
721
|
+
type: string
|
722
|
+
example: Red
|
723
|
+
description: >-
|
724
|
+
Find Prodcuts with Variants that have the specified option (eg. color, size)
|
725
|
+
and value (eg. red, XS)
|
726
|
+
- in: query
|
727
|
+
name: sort
|
728
|
+
schema:
|
729
|
+
type: string
|
730
|
+
example: >-
|
731
|
+
-updated_at,price
|
732
|
+
description: >-
|
733
|
+
Sort products based on:
|
734
|
+
<ul>
|
735
|
+
<li>price (ascending/descenging)</li>
|
736
|
+
<li>updated_at (ascending/descenging)</li>
|
737
|
+
</ul>
|
738
|
+
Use <q>-</q> sign to set descenging sort, eg. <q>-updated_at</q>
|
739
|
+
- $ref: '#/components/parameters/PageParam'
|
740
|
+
- $ref: '#/components/parameters/PerPageParam'
|
741
|
+
- $ref: '#/components/parameters/ProductIncludeParam'
|
742
|
+
- $ref: '#/components/parameters/SparseFieldsParam'
|
743
|
+
responses:
|
744
|
+
'200':
|
745
|
+
description: Returns a list of Products
|
746
|
+
content:
|
747
|
+
application/json:
|
748
|
+
schema:
|
749
|
+
$ref: '#/components/schemas/ProductsList'
|
750
|
+
'/products/{id}':
|
751
|
+
get:
|
752
|
+
description: >-
|
753
|
+
To view the details for a single product, make a request using that
|
754
|
+
product's permalink:<br /> <code>GET /api/v2/products/a-product</code>
|
755
|
+
<br /><br />You may also query by the product's id attribute:<br /><code>GET
|
756
|
+
/api/v2/products/1 </code> <br /><br />Note that the API will attempt a
|
757
|
+
permalink lookup before an ID lookup.
|
758
|
+
tags:
|
759
|
+
- Products
|
760
|
+
operationId: 'Show Product'
|
761
|
+
parameters:
|
762
|
+
- $ref: '#/components/parameters/IdOrPermalink'
|
763
|
+
- $ref: '#/components/parameters/ProductIncludeParam'
|
764
|
+
- $ref: '#/components/parameters/SparseFieldsParam'
|
765
|
+
responses:
|
766
|
+
'200':
|
767
|
+
description: Returns the requested Product
|
768
|
+
content:
|
769
|
+
application/json:
|
770
|
+
schema:
|
771
|
+
$ref: '#/components/schemas/Product'
|
772
|
+
'404':
|
773
|
+
$ref: '#/components/responses/404NotFound'
|
774
|
+
|
775
|
+
'/taxons':
|
776
|
+
get:
|
777
|
+
description: >-
|
778
|
+
Returns a list of Taxons. You can filter out taxons by...
|
779
|
+
tags:
|
780
|
+
- Taxons
|
781
|
+
operationId: 'Taxons List'
|
782
|
+
parameters:
|
783
|
+
- $ref: '#/components/parameters/FilterByIds'
|
784
|
+
- $ref: '#/components/parameters/FilterByName'
|
785
|
+
- in: query
|
786
|
+
name: filter[parent_id]
|
787
|
+
schema:
|
788
|
+
type: string
|
789
|
+
example: '1'
|
790
|
+
description: Fetch children nodes of specified Taxon
|
791
|
+
- in: query
|
792
|
+
name: filter[taxonomy_id]
|
793
|
+
schema:
|
794
|
+
type: string
|
795
|
+
example: '1'
|
796
|
+
description: Fetch Taxons in a specified Taxonomy
|
797
|
+
- in: query
|
798
|
+
name: filter[roots]
|
799
|
+
schema:
|
800
|
+
type: boolean
|
801
|
+
example: false
|
802
|
+
description: Fetch only root Taxons (Taxonomies)
|
803
|
+
- $ref: '#/components/parameters/PageParam'
|
804
|
+
- $ref: '#/components/parameters/PerPageParam'
|
805
|
+
- $ref: '#/components/parameters/TaxonIncludeParam'
|
806
|
+
- $ref: '#/components/parameters/SparseFieldsParam'
|
807
|
+
responses:
|
808
|
+
'200':
|
809
|
+
description: Returns a list of Taxons
|
810
|
+
content:
|
811
|
+
application/json:
|
812
|
+
schema:
|
813
|
+
$ref: '#/components/schemas/TaxonsList'
|
814
|
+
|
815
|
+
'/taxons/{id}':
|
816
|
+
get:
|
817
|
+
description: >-
|
818
|
+
To view the details for a single Taxon, make a request using that
|
819
|
+
Taxon's permalink:<br /> <code>GET /api/v2/taxons/t-shirts</code>
|
820
|
+
<br /><br />You may also query by the Taxons's ID attribute:<br /><code>GET
|
821
|
+
/api/v2/taxons/1 </code> <br /><br />Note that the API will attempt a
|
822
|
+
permalink lookup before an ID lookup.
|
823
|
+
tags:
|
824
|
+
- Taxons
|
825
|
+
operationId: 'Show Taxon'
|
826
|
+
parameters:
|
827
|
+
- $ref: '#/components/parameters/IdOrPermalink'
|
828
|
+
- $ref: '#/components/parameters/TaxonIncludeParam'
|
829
|
+
- $ref: '#/components/parameters/SparseFieldsParam'
|
830
|
+
responses:
|
831
|
+
'200':
|
832
|
+
description: Returns the reqested Taxon
|
833
|
+
content:
|
834
|
+
application/json:
|
835
|
+
schema:
|
836
|
+
$ref: '#/components/schemas/Taxon'
|
837
|
+
'404':
|
838
|
+
$ref: '#/components/responses/404NotFound'
|
839
|
+
|
840
|
+
'/countries':
|
841
|
+
get:
|
842
|
+
description: >-
|
843
|
+
Returns a list of all Countries
|
844
|
+
tags:
|
845
|
+
- Countries
|
846
|
+
operationId: 'Countries List'
|
847
|
+
responses:
|
848
|
+
'200':
|
849
|
+
description: Returns a list of all Countries
|
850
|
+
content:
|
851
|
+
application/json:
|
852
|
+
schema:
|
853
|
+
$ref: '#/components/schemas/CountriesList'
|
854
|
+
|
855
|
+
'/countries/{iso}':
|
856
|
+
get:
|
857
|
+
description: >-
|
858
|
+
To view the details for a single Country, make a request using that
|
859
|
+
Country's iso code:<br /> <code>GET /api/v2/storefront/countries/gb</code>
|
860
|
+
<br /><br />You may also query by the Country's iso3 code:<br /><code>GET
|
861
|
+
/api/v2/storefront/coutries/gbr </code> <br /><br />Note that the API will attempt a
|
862
|
+
iso lookup before an iso3 lookup.
|
863
|
+
tags:
|
864
|
+
- Countries
|
865
|
+
operationId: 'Show Country'
|
866
|
+
parameters:
|
867
|
+
- $ref: '#/components/parameters/IsoOrIso3'
|
868
|
+
- $ref: '#/components/parameters/CountryIncludeParam'
|
869
|
+
- $ref: '#/components/parameters/SparseFieldsParam'
|
870
|
+
responses:
|
871
|
+
'200':
|
872
|
+
description: Returns the requested Country
|
873
|
+
content:
|
874
|
+
application/json:
|
875
|
+
schema:
|
876
|
+
$ref: '#/components/schemas/Country'
|
877
|
+
'404':
|
878
|
+
$ref: '#/components/responses/404NotFound'
|
879
|
+
|
880
|
+
'/countries/default':
|
881
|
+
get:
|
882
|
+
description: >-
|
883
|
+
Returns the default Country for the application.
|
884
|
+
By default this will be the US.
|
885
|
+
tags:
|
886
|
+
- Countries
|
887
|
+
operationId: 'Default Country'
|
888
|
+
parameters:
|
889
|
+
- $ref: '#/components/parameters/CountryIncludeParam'
|
890
|
+
- $ref: '#/components/parameters/SparseFieldsParam'
|
891
|
+
responses:
|
892
|
+
'200':
|
893
|
+
description: Returns the default Country
|
894
|
+
content:
|
895
|
+
application/json:
|
896
|
+
schema:
|
897
|
+
$ref: '#/components/schemas/Country'
|
898
|
+
|
899
|
+
components:
|
900
|
+
securitySchemes:
|
901
|
+
bearerAuth:
|
902
|
+
type: http
|
903
|
+
scheme: bearer
|
904
|
+
description: >-
|
905
|
+
User token to authorize Cart and Checkout requests. You can obtain it
|
906
|
+
from `http://your_store_url.com/spree_oauth` endpoint.
|
907
|
+
It is required to associate Cart with the User.
|
908
|
+
See OAuth documentation for more details.
|
909
|
+
orderToken:
|
910
|
+
type: apiKey
|
911
|
+
in: header
|
912
|
+
description: >-
|
913
|
+
<p>
|
914
|
+
Order token to authorize Cart and Checkout requests.
|
915
|
+
Useful for guest checouts when you don't have the user token
|
916
|
+
(bearerAuth)
|
917
|
+
</p>
|
918
|
+
<p>
|
919
|
+
You can obtain it from the `/cart` endpoint -
|
920
|
+
it's part of the response (value of the `token` field).
|
921
|
+
</p>
|
922
|
+
name: X-Spree-Order-Token
|
923
|
+
schemas:
|
924
|
+
Error:
|
925
|
+
required:
|
926
|
+
- error
|
927
|
+
properties:
|
928
|
+
error:
|
929
|
+
type: string
|
930
|
+
ListLinks:
|
931
|
+
properties:
|
932
|
+
self:
|
933
|
+
type: string
|
934
|
+
description: 'URL to the current page of the listing'
|
935
|
+
next:
|
936
|
+
type: string
|
937
|
+
description: 'URL to the next page of the listing'
|
938
|
+
prev:
|
939
|
+
type: string
|
940
|
+
description: 'URL to the previous page of the listing'
|
941
|
+
last:
|
942
|
+
type: string
|
943
|
+
description: 'URL to the last page of the listing'
|
944
|
+
first:
|
945
|
+
type: string
|
946
|
+
description: 'URL to the first page of the listing'
|
947
|
+
ListMeta:
|
948
|
+
properties:
|
949
|
+
count:
|
950
|
+
type: number
|
951
|
+
example: 7
|
952
|
+
description: 'Number of items on the current listing'
|
953
|
+
total_count:
|
954
|
+
type: number
|
955
|
+
example: 145
|
956
|
+
description: 'Number of all items matching the criteria'
|
957
|
+
total_pages:
|
958
|
+
type: number
|
959
|
+
example: 10
|
960
|
+
description: 'Number of all pages containing items matching the criteria'
|
961
|
+
Timestamp:
|
962
|
+
type: string
|
963
|
+
example: '2018-05-25T11:22:57.214-04:00'
|
964
|
+
Address:
|
965
|
+
properties:
|
966
|
+
id:
|
967
|
+
type: string
|
968
|
+
example: '1'
|
969
|
+
type:
|
970
|
+
type: string
|
971
|
+
default: 'address'
|
972
|
+
attributes:
|
973
|
+
type: object
|
974
|
+
properties:
|
975
|
+
firstname:
|
976
|
+
type: string
|
977
|
+
example: 'John'
|
978
|
+
lastname:
|
979
|
+
type: string
|
980
|
+
example: 'Doe'
|
981
|
+
address1:
|
982
|
+
type: string
|
983
|
+
example: '1600 Amphitheatre Pkwy'
|
984
|
+
address2:
|
985
|
+
type: string
|
986
|
+
example: 'Suite 1'
|
987
|
+
city:
|
988
|
+
type: string
|
989
|
+
example: 'Mountain View'
|
990
|
+
zipcode:
|
991
|
+
type: string
|
992
|
+
example: '94043'
|
993
|
+
phone:
|
994
|
+
type: string
|
995
|
+
example: '(+1) 123 456 789'
|
996
|
+
state_name:
|
997
|
+
type: string
|
998
|
+
example: 'California'
|
999
|
+
state_code:
|
1000
|
+
type: string
|
1001
|
+
example: 'CA'
|
1002
|
+
country_name:
|
1003
|
+
type: string
|
1004
|
+
example: 'United States of America'
|
1005
|
+
country_iso3:
|
1006
|
+
type: string
|
1007
|
+
example: 'USA'
|
1008
|
+
company:
|
1009
|
+
type: string
|
1010
|
+
example: 'Google Inc.'
|
1011
|
+
Cart:
|
1012
|
+
required:
|
1013
|
+
- data
|
1014
|
+
- included
|
1015
|
+
properties:
|
1016
|
+
data:
|
1017
|
+
type: object
|
1018
|
+
required:
|
1019
|
+
- id
|
1020
|
+
- type
|
1021
|
+
- attributes
|
1022
|
+
- relationships
|
1023
|
+
properties:
|
1024
|
+
id:
|
1025
|
+
type: string
|
1026
|
+
example: '1'
|
1027
|
+
type:
|
1028
|
+
type: string
|
1029
|
+
default: 'cart'
|
1030
|
+
attributes:
|
1031
|
+
type: object
|
1032
|
+
properties:
|
1033
|
+
number:
|
1034
|
+
type: string
|
1035
|
+
example: 'R123456789'
|
1036
|
+
email:
|
1037
|
+
type: string
|
1038
|
+
example: 'spree@example.com'
|
1039
|
+
item_total:
|
1040
|
+
type: string
|
1041
|
+
example: '19.99'
|
1042
|
+
display_item_total:
|
1043
|
+
type: string
|
1044
|
+
example: '$19.99'
|
1045
|
+
total:
|
1046
|
+
type: string
|
1047
|
+
example: '29.99'
|
1048
|
+
display_total:
|
1049
|
+
type: string
|
1050
|
+
example: '$29.99'
|
1051
|
+
ship_total:
|
1052
|
+
type: string
|
1053
|
+
example: '0.0'
|
1054
|
+
display_ship_total:
|
1055
|
+
type: string
|
1056
|
+
example: '$19.99'
|
1057
|
+
adjustment_total:
|
1058
|
+
type: string
|
1059
|
+
example: '10.0'
|
1060
|
+
display_adjustment_total:
|
1061
|
+
type: string
|
1062
|
+
example: '$10.00'
|
1063
|
+
promo_total:
|
1064
|
+
type: string
|
1065
|
+
example: '-10.0'
|
1066
|
+
display_promo_total:
|
1067
|
+
type: string
|
1068
|
+
example: '-$10.00'
|
1069
|
+
created_at:
|
1070
|
+
$ref: '#/components/schemas/Timestamp'
|
1071
|
+
updated_at:
|
1072
|
+
$ref: '#/components/schemas/Timestamp'
|
1073
|
+
included_tax_total:
|
1074
|
+
type: string
|
1075
|
+
example: '5.00'
|
1076
|
+
additional_tax_total:
|
1077
|
+
type: string
|
1078
|
+
example: '5.0'
|
1079
|
+
display_additional_tax_total:
|
1080
|
+
type: string
|
1081
|
+
example: '$5.00'
|
1082
|
+
display_included_tax_total:
|
1083
|
+
type: string
|
1084
|
+
example: '$5.00'
|
1085
|
+
tax_total:
|
1086
|
+
type: string
|
1087
|
+
example: '10.0'
|
1088
|
+
display_tax_total:
|
1089
|
+
type: string
|
1090
|
+
example: '$10.00'
|
1091
|
+
item_count:
|
1092
|
+
type: number
|
1093
|
+
example: 2
|
1094
|
+
description: 'Total quantity number of all items added to the Cart'
|
1095
|
+
special_instructions:
|
1096
|
+
type: string
|
1097
|
+
example: 'Please wrap it as a gift'
|
1098
|
+
description: 'Message added by the Customer'
|
1099
|
+
currency:
|
1100
|
+
type: string
|
1101
|
+
example: 'USD'
|
1102
|
+
state:
|
1103
|
+
type: string
|
1104
|
+
example: 'address'
|
1105
|
+
description: 'State of the Cart in the Checkout flow'
|
1106
|
+
token:
|
1107
|
+
type: string
|
1108
|
+
example: abcdef123456
|
1109
|
+
description: >-
|
1110
|
+
Used for authorizing any action for an order within Spree’s
|
1111
|
+
API
|
1112
|
+
relationships:
|
1113
|
+
type: object
|
1114
|
+
properties:
|
1115
|
+
line_items:
|
1116
|
+
type: object
|
1117
|
+
properties:
|
1118
|
+
data:
|
1119
|
+
type: array
|
1120
|
+
items:
|
1121
|
+
$ref: '#/components/schemas/Relation'
|
1122
|
+
promotions:
|
1123
|
+
type: object
|
1124
|
+
properties:
|
1125
|
+
data:
|
1126
|
+
type: array
|
1127
|
+
items:
|
1128
|
+
$ref: '#/components/schemas/Relation'
|
1129
|
+
variants:
|
1130
|
+
type: object
|
1131
|
+
properties:
|
1132
|
+
data:
|
1133
|
+
type: array
|
1134
|
+
items:
|
1135
|
+
$ref: '#/components/schemas/Relation'
|
1136
|
+
user:
|
1137
|
+
type: object
|
1138
|
+
properties:
|
1139
|
+
data:
|
1140
|
+
$ref: '#/components/schemas/Relation'
|
1141
|
+
billing_address:
|
1142
|
+
type: object
|
1143
|
+
properties:
|
1144
|
+
data:
|
1145
|
+
$ref: '#/components/schemas/Relation'
|
1146
|
+
shipping_address:
|
1147
|
+
type: object
|
1148
|
+
properties:
|
1149
|
+
data:
|
1150
|
+
$ref: '#/components/schemas/Relation'
|
1151
|
+
payments:
|
1152
|
+
type: object
|
1153
|
+
properties:
|
1154
|
+
data:
|
1155
|
+
$ref: '#/components/schemas/Relation'
|
1156
|
+
shipments:
|
1157
|
+
type: object
|
1158
|
+
properties:
|
1159
|
+
data:
|
1160
|
+
$ref: '#/components/schemas/Relation'
|
1161
|
+
included:
|
1162
|
+
type: array
|
1163
|
+
items:
|
1164
|
+
type: object
|
1165
|
+
oneOf:
|
1166
|
+
- $ref: '#/components/schemas/VariantAttributesAndRelationships'
|
1167
|
+
- $ref: '#/components/schemas/LineItem'
|
1168
|
+
- $ref: '#/components/schemas/Promotion'
|
1169
|
+
- $ref: '#/components/schemas/User'
|
1170
|
+
- $ref: '#/components/schemas/Address'
|
1171
|
+
- $ref: '#/components/schemas/ShipmentAttributesWithoutRelationsips'
|
1172
|
+
CreditCardList:
|
1173
|
+
required:
|
1174
|
+
- data
|
1175
|
+
- included
|
1176
|
+
properties:
|
1177
|
+
data:
|
1178
|
+
type: array
|
1179
|
+
items:
|
1180
|
+
$ref: '#/components/schemas/CreditCardAttributesWithRelationships'
|
1181
|
+
included:
|
1182
|
+
type: array
|
1183
|
+
items:
|
1184
|
+
type: object
|
1185
|
+
oneOf:
|
1186
|
+
- $ref: '#/components/schemas/PaymentMethod'
|
1187
|
+
CreditCard:
|
1188
|
+
required:
|
1189
|
+
- data
|
1190
|
+
- included
|
1191
|
+
properties:
|
1192
|
+
data:
|
1193
|
+
type: object
|
1194
|
+
$ref: '#/components/schemas/CreditCardAttributesWithRelationships'
|
1195
|
+
included:
|
1196
|
+
type: array
|
1197
|
+
items:
|
1198
|
+
type: object
|
1199
|
+
oneOf:
|
1200
|
+
- $ref: '#/components/schemas/PaymentMethod'
|
1201
|
+
CreditCardAttributes:
|
1202
|
+
properties:
|
1203
|
+
cc_type:
|
1204
|
+
type: string
|
1205
|
+
example: 'visa'
|
1206
|
+
last_digits:
|
1207
|
+
type: string
|
1208
|
+
example: '1232'
|
1209
|
+
month:
|
1210
|
+
type: integer
|
1211
|
+
example: 10
|
1212
|
+
year:
|
1213
|
+
type: integer
|
1214
|
+
example: 2019
|
1215
|
+
name:
|
1216
|
+
type: string
|
1217
|
+
example: 'John Doe'
|
1218
|
+
CreditCardAttributesWithRelationships:
|
1219
|
+
properties:
|
1220
|
+
id:
|
1221
|
+
type: string
|
1222
|
+
example: '1'
|
1223
|
+
type:
|
1224
|
+
type: string
|
1225
|
+
example: 'credit_card'
|
1226
|
+
attributes:
|
1227
|
+
type: object
|
1228
|
+
$ref: '#/components/schemas/CreditCardAttributes'
|
1229
|
+
relationships:
|
1230
|
+
type: object
|
1231
|
+
properties:
|
1232
|
+
payment_method:
|
1233
|
+
type: object
|
1234
|
+
properties:
|
1235
|
+
data:
|
1236
|
+
$ref: '#/components/schemas/Relation'
|
1237
|
+
Image:
|
1238
|
+
required:
|
1239
|
+
- data
|
1240
|
+
properties:
|
1241
|
+
data:
|
1242
|
+
type: object
|
1243
|
+
properties:
|
1244
|
+
id:
|
1245
|
+
type: string
|
1246
|
+
example: '1'
|
1247
|
+
type:
|
1248
|
+
type: string
|
1249
|
+
default: 'image'
|
1250
|
+
attributes:
|
1251
|
+
type: object
|
1252
|
+
properties:
|
1253
|
+
position:
|
1254
|
+
type: integer
|
1255
|
+
example: 0
|
1256
|
+
description: 'Sort order of images set in the Admin Panel'
|
1257
|
+
styles:
|
1258
|
+
type: array
|
1259
|
+
description: 'An array of pre-scaled image styles'
|
1260
|
+
items:
|
1261
|
+
$ref: '#/components/schemas/ImageStyle'
|
1262
|
+
ImageStyle:
|
1263
|
+
properties:
|
1264
|
+
url:
|
1265
|
+
type: string
|
1266
|
+
example: 'http://localhost:3000/rails/active_storage/disk/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaEpJbWQyWVhKcFlXNTBjeTltWm1sMmRURlNORFpZWjJaSFpYUkdZMjk2WWsxM1RHWXZNVGs1T1RCak5XVmlNamN4TlRnd1pqVTBabUpqTWpCbFkyVXhZMlZpTTJFd05ERTJZemMzT0dKaE5tSTFNREkyT0dKaFpqa3paV1JtWTJWaE16aGxaQVk2QmtWVSIsImV4cCI6IjIwMTgtMDYtMjRUMTM6NTk6NTguOTY5WiIsInB1ciI6ImJsb2Jfa2V5In19--5e9ff358dc747f73754e332678c5762114ac6f3f/ror_jr_spaghetti.jpeg?content_type=image%2Fjpeg&disposition=inline%3B+filename%3D%22ror_jr_spaghetti.jpeg%22%3B+filename%2A%3DUTF-8%27%27ror_jr_spaghetti.jpeg'
|
1267
|
+
description: 'Absolute URL of the uploaded image in selected style (width/height)'
|
1268
|
+
width:
|
1269
|
+
type: integer
|
1270
|
+
example: 1920
|
1271
|
+
description: 'Actual width of image'
|
1272
|
+
height:
|
1273
|
+
type: integer
|
1274
|
+
example: 1080
|
1275
|
+
description: 'Actual height of image'
|
1276
|
+
User:
|
1277
|
+
properties:
|
1278
|
+
id:
|
1279
|
+
type: string
|
1280
|
+
example: 1
|
1281
|
+
type:
|
1282
|
+
type: string
|
1283
|
+
default: 'user'
|
1284
|
+
attributes:
|
1285
|
+
type: object
|
1286
|
+
properties:
|
1287
|
+
email:
|
1288
|
+
type: string
|
1289
|
+
example: 'spree@example.com'
|
1290
|
+
LineItem:
|
1291
|
+
properties:
|
1292
|
+
id:
|
1293
|
+
type: string
|
1294
|
+
example: '1'
|
1295
|
+
type:
|
1296
|
+
type: string
|
1297
|
+
default: 'line_item'
|
1298
|
+
attributes:
|
1299
|
+
type: object
|
1300
|
+
properties:
|
1301
|
+
name:
|
1302
|
+
type: string
|
1303
|
+
example: 'Sample product'
|
1304
|
+
quantity:
|
1305
|
+
type: integer
|
1306
|
+
example: 1
|
1307
|
+
slug:
|
1308
|
+
type: string
|
1309
|
+
example: 'sample-product'
|
1310
|
+
options_text:
|
1311
|
+
type: string
|
1312
|
+
example: 'Size: small, Color: red'
|
1313
|
+
price:
|
1314
|
+
type: string
|
1315
|
+
example: '125.0'
|
1316
|
+
description: Price of Product per quantity
|
1317
|
+
currency:
|
1318
|
+
type: string
|
1319
|
+
example: 'USD'
|
1320
|
+
display_price:
|
1321
|
+
type: string
|
1322
|
+
example: '$125.00'
|
1323
|
+
description: Price of Product per quantity
|
1324
|
+
total:
|
1325
|
+
type: string
|
1326
|
+
example: '250.0'
|
1327
|
+
description: >-
|
1328
|
+
Total price of Line Item including adjastments, promotions
|
1329
|
+
and taxes
|
1330
|
+
display_total:
|
1331
|
+
type: string
|
1332
|
+
example: '$250.00'
|
1333
|
+
description: >-
|
1334
|
+
Total price of Line Item including adjastments, promotions
|
1335
|
+
and taxes
|
1336
|
+
adjustment_total:
|
1337
|
+
type: string
|
1338
|
+
example: '10.0'
|
1339
|
+
description: TBD
|
1340
|
+
display_adjustment_total:
|
1341
|
+
type: string
|
1342
|
+
example: '$10.00'
|
1343
|
+
description: TBD
|
1344
|
+
additional_tax_total:
|
1345
|
+
type: string
|
1346
|
+
example: '5.0'
|
1347
|
+
display_additional_tax_total:
|
1348
|
+
type: string
|
1349
|
+
example: '$5.00'
|
1350
|
+
promo_total:
|
1351
|
+
type: string
|
1352
|
+
example: '-5.0'
|
1353
|
+
display_promo_total:
|
1354
|
+
type: string
|
1355
|
+
included_tax_total:
|
1356
|
+
type: string
|
1357
|
+
example: '0.0'
|
1358
|
+
description: 'Taxes included in the price, eg. VAT'
|
1359
|
+
display_inluded_tax_total:
|
1360
|
+
type: string
|
1361
|
+
example: '$0.00'
|
1362
|
+
relationships:
|
1363
|
+
properties:
|
1364
|
+
variant:
|
1365
|
+
type: object
|
1366
|
+
properties:
|
1367
|
+
data:
|
1368
|
+
$ref: '#/components/schemas/Relation'
|
1369
|
+
Promotion:
|
1370
|
+
properties:
|
1371
|
+
id:
|
1372
|
+
type: string
|
1373
|
+
example: '1'
|
1374
|
+
type:
|
1375
|
+
type: string
|
1376
|
+
default: 'promotion'
|
1377
|
+
attributes:
|
1378
|
+
type: object
|
1379
|
+
properties:
|
1380
|
+
name:
|
1381
|
+
type: string
|
1382
|
+
example: '10% Discount'
|
1383
|
+
descriptiom:
|
1384
|
+
type: string
|
1385
|
+
example: 'Super discount for you'
|
1386
|
+
amount:
|
1387
|
+
type: string
|
1388
|
+
example: '-10.0'
|
1389
|
+
display_amount:
|
1390
|
+
type: string
|
1391
|
+
example: '-$10.00'
|
1392
|
+
Product:
|
1393
|
+
required:
|
1394
|
+
- data
|
1395
|
+
- included
|
1396
|
+
properties:
|
1397
|
+
data:
|
1398
|
+
$ref: '#/components/schemas/ProductAttributesAndRelationships'
|
1399
|
+
included:
|
1400
|
+
type: array
|
1401
|
+
items:
|
1402
|
+
oneOf:
|
1403
|
+
- $ref: '#/components/schemas/OptionType'
|
1404
|
+
- $ref: '#/components/schemas/OptionValue'
|
1405
|
+
- $ref: '#/components/schemas/ProductProperty'
|
1406
|
+
- $ref: '#/components/schemas/Property'
|
1407
|
+
- $ref: '#/components/schemas/VariantAttributesAndRelationships'
|
1408
|
+
- $ref: '#/components/schemas/Image'
|
1409
|
+
- $ref: '#/components/schemas/TaxonAttributesAndRelationships'
|
1410
|
+
ProductsList:
|
1411
|
+
required:
|
1412
|
+
- links
|
1413
|
+
- data
|
1414
|
+
- included
|
1415
|
+
properties:
|
1416
|
+
links:
|
1417
|
+
$ref: '#/components/schemas/ListLinks'
|
1418
|
+
meta:
|
1419
|
+
$ref: '#/components/schemas/ListMeta'
|
1420
|
+
data:
|
1421
|
+
type: array
|
1422
|
+
items:
|
1423
|
+
$ref: '#/components/schemas/ProductAttributesAndRelationships'
|
1424
|
+
included:
|
1425
|
+
type: array
|
1426
|
+
items:
|
1427
|
+
oneOf:
|
1428
|
+
- $ref: '#/components/schemas/OptionType'
|
1429
|
+
- $ref: '#/components/schemas/OptionValue'
|
1430
|
+
- $ref: '#/components/schemas/ProductProperty'
|
1431
|
+
- $ref: '#/components/schemas/Property'
|
1432
|
+
- $ref: '#/components/schemas/VariantAttributesAndRelationships'
|
1433
|
+
- $ref: '#/components/schemas/Image'
|
1434
|
+
- $ref: '#/components/schemas/TaxonAttributesAndRelationships'
|
1435
|
+
ProductAttributes:
|
1436
|
+
type: object
|
1437
|
+
properties:
|
1438
|
+
name:
|
1439
|
+
type: string
|
1440
|
+
example: 'Example product'
|
1441
|
+
description:
|
1442
|
+
type: string
|
1443
|
+
example: 'Example description'
|
1444
|
+
price:
|
1445
|
+
type: string
|
1446
|
+
example: '15.99'
|
1447
|
+
currency:
|
1448
|
+
type: string
|
1449
|
+
example: 'USD'
|
1450
|
+
display_price:
|
1451
|
+
type: string
|
1452
|
+
example: $15.99
|
1453
|
+
available_on:
|
1454
|
+
type: string
|
1455
|
+
example: '2012-10-17T03:43:57Z'
|
1456
|
+
purchasable:
|
1457
|
+
type: boolean
|
1458
|
+
example: true
|
1459
|
+
description: 'Indicates if any of Variants are in stock or backorderable'
|
1460
|
+
in_stock:
|
1461
|
+
type: boolean
|
1462
|
+
example: true
|
1463
|
+
description: 'Indicates if any of Variants are in stock'
|
1464
|
+
backorderable:
|
1465
|
+
type: boolean
|
1466
|
+
example: true
|
1467
|
+
description: 'Indicates if any of Variants are backeorderable'
|
1468
|
+
slug:
|
1469
|
+
type: string
|
1470
|
+
example: 'example-product'
|
1471
|
+
meta_description:
|
1472
|
+
type: string
|
1473
|
+
example: 'Example product'
|
1474
|
+
meta_keywords:
|
1475
|
+
type: string
|
1476
|
+
example: 'example, product'
|
1477
|
+
updated_at:
|
1478
|
+
$ref: '#/components/schemas/Timestamp'
|
1479
|
+
ProductRelationships:
|
1480
|
+
type: object
|
1481
|
+
properties:
|
1482
|
+
default_variant:
|
1483
|
+
type: object
|
1484
|
+
description: 'The default Variant for given product'
|
1485
|
+
properties:
|
1486
|
+
data:
|
1487
|
+
$ref: '#/components/schemas/Relation'
|
1488
|
+
product_properties:
|
1489
|
+
type: object
|
1490
|
+
description: 'List of Product Properties'
|
1491
|
+
properties:
|
1492
|
+
data:
|
1493
|
+
type: array
|
1494
|
+
items:
|
1495
|
+
$ref: '#/components/schemas/Relation'
|
1496
|
+
option_types:
|
1497
|
+
type: object
|
1498
|
+
description: 'List of Product Option Types'
|
1499
|
+
properties:
|
1500
|
+
data:
|
1501
|
+
type: array
|
1502
|
+
items:
|
1503
|
+
$ref: '#/components/schemas/Relation'
|
1504
|
+
variants:
|
1505
|
+
type: object
|
1506
|
+
description: 'List of Product Variants, excluding Master Variant'
|
1507
|
+
properties:
|
1508
|
+
data:
|
1509
|
+
type: array
|
1510
|
+
items:
|
1511
|
+
$ref: '#/components/schemas/Relation'
|
1512
|
+
taxons:
|
1513
|
+
type: object
|
1514
|
+
description: 'List of Taxons associated with Product'
|
1515
|
+
properties:
|
1516
|
+
data:
|
1517
|
+
type: array
|
1518
|
+
items:
|
1519
|
+
$ref: '#/components/schemas/Relation'
|
1520
|
+
ProductAttributesAndRelationships:
|
1521
|
+
properties:
|
1522
|
+
id:
|
1523
|
+
type: string
|
1524
|
+
example: '1'
|
1525
|
+
type:
|
1526
|
+
type: string
|
1527
|
+
default: 'product'
|
1528
|
+
attributes:
|
1529
|
+
$ref: '#/components/schemas/ProductAttributes'
|
1530
|
+
relationships:
|
1531
|
+
$ref: '#/components/schemas/ProductRelationships'
|
1532
|
+
Relation:
|
1533
|
+
required:
|
1534
|
+
- id
|
1535
|
+
- type
|
1536
|
+
properties:
|
1537
|
+
id:
|
1538
|
+
type: string
|
1539
|
+
type:
|
1540
|
+
type: string
|
1541
|
+
Taxon:
|
1542
|
+
required:
|
1543
|
+
- data
|
1544
|
+
- included
|
1545
|
+
properties:
|
1546
|
+
data:
|
1547
|
+
$ref: '#/components/schemas/TaxonAttributesAndRelationships'
|
1548
|
+
included:
|
1549
|
+
type: array
|
1550
|
+
items:
|
1551
|
+
oneOf:
|
1552
|
+
- $ref: '#/components/schemas/ProductAttributesAndRelationships'
|
1553
|
+
- $ref: '#/components/schemas/TaxonAttributesAndRelationships'
|
1554
|
+
- $ref: '#/components/schemas/TaxonomyAttributesAndRelationships'
|
1555
|
+
- $ref: '#/components/schemas/Image'
|
1556
|
+
TaxonAttributes:
|
1557
|
+
type: object
|
1558
|
+
properties:
|
1559
|
+
name:
|
1560
|
+
type: string
|
1561
|
+
example: 'T-shirts'
|
1562
|
+
pretty_name:
|
1563
|
+
type: string
|
1564
|
+
example: 'Clothes > T-shirts'
|
1565
|
+
permalink:
|
1566
|
+
type: string
|
1567
|
+
example: 't-shirts'
|
1568
|
+
seo_title:
|
1569
|
+
type: string
|
1570
|
+
example: 'Clothes - T-shirts'
|
1571
|
+
meta_title:
|
1572
|
+
type: string
|
1573
|
+
example: 'T-shirts'
|
1574
|
+
meta_description:
|
1575
|
+
type: string
|
1576
|
+
example: 'A list of cool t-shirts '
|
1577
|
+
meta_keywords:
|
1578
|
+
type: string
|
1579
|
+
example: 't-shirts, cool'
|
1580
|
+
left:
|
1581
|
+
type: integer
|
1582
|
+
example: 1
|
1583
|
+
right:
|
1584
|
+
type: integer
|
1585
|
+
example: 2
|
1586
|
+
position:
|
1587
|
+
type: integer
|
1588
|
+
example: 0
|
1589
|
+
depth:
|
1590
|
+
type: integer
|
1591
|
+
example: 1
|
1592
|
+
is_root:
|
1593
|
+
type: boolean
|
1594
|
+
example: true
|
1595
|
+
description: 'Indicates if the Taxon is the root node of this Taxonomy tree'
|
1596
|
+
is_child:
|
1597
|
+
type: boolean
|
1598
|
+
example: true
|
1599
|
+
description: 'Returns true is this is a child node of this Taxonomy tree'
|
1600
|
+
is_leaf:
|
1601
|
+
type: boolean
|
1602
|
+
example: false
|
1603
|
+
description: 'Returns true if this is the end of a branch of this Taxonomy tree'
|
1604
|
+
updated_at:
|
1605
|
+
type: string
|
1606
|
+
example: '2018-06-18T10:57:29.704Z'
|
1607
|
+
TaxonRelationships:
|
1608
|
+
type: object
|
1609
|
+
properties:
|
1610
|
+
parent:
|
1611
|
+
type: object
|
1612
|
+
description: 'Parent node'
|
1613
|
+
properties:
|
1614
|
+
data:
|
1615
|
+
$ref: '#/components/schemas/Relation'
|
1616
|
+
children:
|
1617
|
+
type: object
|
1618
|
+
description: 'List of child nodes'
|
1619
|
+
properties:
|
1620
|
+
data:
|
1621
|
+
type: array
|
1622
|
+
items:
|
1623
|
+
$ref: '#/components/schemas/Relation'
|
1624
|
+
taxonomy:
|
1625
|
+
type: object
|
1626
|
+
description: 'Taxonomy associated with this Taxon'
|
1627
|
+
properties:
|
1628
|
+
data:
|
1629
|
+
$ref: '#/components/schemas/Relation'
|
1630
|
+
image:
|
1631
|
+
type: object
|
1632
|
+
description: 'Image associated with Taxon'
|
1633
|
+
properties:
|
1634
|
+
data:
|
1635
|
+
$ref: '#/components/schemas/Relation'
|
1636
|
+
products:
|
1637
|
+
type: object
|
1638
|
+
description: 'List of active and available Products associated with this Taxon'
|
1639
|
+
properties:
|
1640
|
+
data:
|
1641
|
+
type: array
|
1642
|
+
items:
|
1643
|
+
$ref: '#/components/schemas/Relation'
|
1644
|
+
TaxonAttributesAndRelationships:
|
1645
|
+
properties:
|
1646
|
+
id:
|
1647
|
+
type: string
|
1648
|
+
example: '1'
|
1649
|
+
type:
|
1650
|
+
type: string
|
1651
|
+
default: 'taxon'
|
1652
|
+
attributes:
|
1653
|
+
$ref: '#/components/schemas/TaxonAttributes'
|
1654
|
+
relationships:
|
1655
|
+
$ref: '#/components/schemas/TaxonRelationships'
|
1656
|
+
TaxonsList:
|
1657
|
+
required:
|
1658
|
+
- links
|
1659
|
+
- data
|
1660
|
+
- included
|
1661
|
+
properties:
|
1662
|
+
links:
|
1663
|
+
$ref: '#/components/schemas/ListLinks'
|
1664
|
+
meta:
|
1665
|
+
$ref: '#/components/schemas/ListMeta'
|
1666
|
+
data:
|
1667
|
+
type: array
|
1668
|
+
items:
|
1669
|
+
$ref: '#/components/schemas/TaxonAttributesAndRelationships'
|
1670
|
+
included:
|
1671
|
+
type: array
|
1672
|
+
items:
|
1673
|
+
oneOf:
|
1674
|
+
- $ref: '#/components/schemas/TaxonAttributesAndRelationships'
|
1675
|
+
- $ref: '#/components/schemas/TaxonImage'
|
1676
|
+
- $ref: '#/components/schemas/TaxonomyAttributesAndRelationships'
|
1677
|
+
- $ref: '#/components/schemas/ProductAttributesAndRelationships'
|
1678
|
+
TaxonImage:
|
1679
|
+
required:
|
1680
|
+
- data
|
1681
|
+
properties:
|
1682
|
+
data:
|
1683
|
+
type: object
|
1684
|
+
properties:
|
1685
|
+
id:
|
1686
|
+
type: string
|
1687
|
+
example: '1'
|
1688
|
+
type:
|
1689
|
+
type: string
|
1690
|
+
default: 'taxon_image'
|
1691
|
+
attributes:
|
1692
|
+
type: object
|
1693
|
+
properties:
|
1694
|
+
position:
|
1695
|
+
type: integer
|
1696
|
+
example: 0
|
1697
|
+
description: 'Sort order of images set in the Admin Panel'
|
1698
|
+
styles:
|
1699
|
+
type: array
|
1700
|
+
description: 'An array of pre-scaled image styles'
|
1701
|
+
items:
|
1702
|
+
$ref: '#/components/schemas/ImageStyle'
|
1703
|
+
TaxonomyAttributesAndRelationships:
|
1704
|
+
type: object
|
1705
|
+
properties:
|
1706
|
+
id:
|
1707
|
+
type: string
|
1708
|
+
example: '1'
|
1709
|
+
type:
|
1710
|
+
type: string
|
1711
|
+
default: 'taxonomy'
|
1712
|
+
attributes:
|
1713
|
+
$ref: '#/components/schemas/TaxonomyAttributes'
|
1714
|
+
TaxonomyAttributes:
|
1715
|
+
type: object
|
1716
|
+
properties:
|
1717
|
+
name:
|
1718
|
+
type: string
|
1719
|
+
example: 'Categories'
|
1720
|
+
position:
|
1721
|
+
type: integer
|
1722
|
+
example: 0
|
1723
|
+
OptionType:
|
1724
|
+
required:
|
1725
|
+
- data
|
1726
|
+
properties:
|
1727
|
+
data:
|
1728
|
+
type: object
|
1729
|
+
properties:
|
1730
|
+
id:
|
1731
|
+
type: string
|
1732
|
+
example: '1'
|
1733
|
+
type:
|
1734
|
+
type: string
|
1735
|
+
default: 'option_type'
|
1736
|
+
attributes:
|
1737
|
+
type: object
|
1738
|
+
properties:
|
1739
|
+
name:
|
1740
|
+
type: string
|
1741
|
+
example: 'color'
|
1742
|
+
presentation:
|
1743
|
+
type: string
|
1744
|
+
example: 'Color'
|
1745
|
+
position:
|
1746
|
+
type: integer
|
1747
|
+
example: 1
|
1748
|
+
OptionValue:
|
1749
|
+
required:
|
1750
|
+
- data
|
1751
|
+
properties:
|
1752
|
+
data:
|
1753
|
+
type: object
|
1754
|
+
properties:
|
1755
|
+
id:
|
1756
|
+
type: string
|
1757
|
+
example: '1'
|
1758
|
+
type:
|
1759
|
+
type: string
|
1760
|
+
default: 'option_value'
|
1761
|
+
attributes:
|
1762
|
+
type: object
|
1763
|
+
properties:
|
1764
|
+
name:
|
1765
|
+
type: string
|
1766
|
+
example: 'red'
|
1767
|
+
presentation:
|
1768
|
+
type: string
|
1769
|
+
example: 'Red'
|
1770
|
+
position:
|
1771
|
+
type: integer
|
1772
|
+
example: 1
|
1773
|
+
relationships:
|
1774
|
+
type: object
|
1775
|
+
properties:
|
1776
|
+
option_type:
|
1777
|
+
type: object
|
1778
|
+
properties:
|
1779
|
+
data:
|
1780
|
+
$ref: '#/components/schemas/Relation'
|
1781
|
+
Property:
|
1782
|
+
required:
|
1783
|
+
- data
|
1784
|
+
properties:
|
1785
|
+
data:
|
1786
|
+
type: object
|
1787
|
+
properties:
|
1788
|
+
id:
|
1789
|
+
type: string
|
1790
|
+
example: '1'
|
1791
|
+
type:
|
1792
|
+
type: string
|
1793
|
+
default: 'property'
|
1794
|
+
attributes:
|
1795
|
+
type: object
|
1796
|
+
properties:
|
1797
|
+
name:
|
1798
|
+
type: string
|
1799
|
+
example: 'material'
|
1800
|
+
presentation:
|
1801
|
+
type: string
|
1802
|
+
example: 'Material'
|
1803
|
+
ProductProperty:
|
1804
|
+
required:
|
1805
|
+
- data
|
1806
|
+
properties:
|
1807
|
+
data:
|
1808
|
+
type: object
|
1809
|
+
properties:
|
1810
|
+
id:
|
1811
|
+
type: string
|
1812
|
+
example: '1'
|
1813
|
+
type:
|
1814
|
+
type: string
|
1815
|
+
default: 'product_property'
|
1816
|
+
attributes:
|
1817
|
+
type: object
|
1818
|
+
properties:
|
1819
|
+
name:
|
1820
|
+
type: string
|
1821
|
+
example: 'silk'
|
1822
|
+
presentation:
|
1823
|
+
type: string
|
1824
|
+
example: 'Silk'
|
1825
|
+
relationships:
|
1826
|
+
type: object
|
1827
|
+
properties:
|
1828
|
+
property:
|
1829
|
+
type: object
|
1830
|
+
properties:
|
1831
|
+
data:
|
1832
|
+
$ref: '#/components/schemas/Property'
|
1833
|
+
Variant:
|
1834
|
+
required:
|
1835
|
+
- data
|
1836
|
+
- included
|
1837
|
+
properties:
|
1838
|
+
data:
|
1839
|
+
$ref: '#/components/schemas/VariantAttributesAndRelationships'
|
1840
|
+
included:
|
1841
|
+
type: array
|
1842
|
+
items:
|
1843
|
+
oneOf:
|
1844
|
+
- $ref: '#/components/schemas/Image'
|
1845
|
+
- $ref: '#/components/schemas/OptionValue'
|
1846
|
+
- $ref: '#/components/schemas/OptionType'
|
1847
|
+
VariantAttributes:
|
1848
|
+
type: object
|
1849
|
+
properties:
|
1850
|
+
name:
|
1851
|
+
type: string
|
1852
|
+
example: 'Example product'
|
1853
|
+
description: 'Product name'
|
1854
|
+
sku:
|
1855
|
+
type: string
|
1856
|
+
example: 'SKU-1001'
|
1857
|
+
price:
|
1858
|
+
type: string
|
1859
|
+
example: '15.99'
|
1860
|
+
currency:
|
1861
|
+
type: string
|
1862
|
+
example: 'USD'
|
1863
|
+
display_price:
|
1864
|
+
type: string
|
1865
|
+
example: '$15.99'
|
1866
|
+
weight:
|
1867
|
+
type: string
|
1868
|
+
example: '10'
|
1869
|
+
height:
|
1870
|
+
type: string
|
1871
|
+
example: '10'
|
1872
|
+
width:
|
1873
|
+
type: string
|
1874
|
+
example: '10'
|
1875
|
+
depth:
|
1876
|
+
type: string
|
1877
|
+
example: '10'
|
1878
|
+
is_master:
|
1879
|
+
type: boolean
|
1880
|
+
example: false
|
1881
|
+
description: 'Indicates if Variant is the master Variant'
|
1882
|
+
options_text:
|
1883
|
+
type: string
|
1884
|
+
example: 'Size: small, Color: red'
|
1885
|
+
slug:
|
1886
|
+
type: string
|
1887
|
+
example: 'example-product'
|
1888
|
+
description: 'Product slug'
|
1889
|
+
description:
|
1890
|
+
type: string
|
1891
|
+
example: 'Example description'
|
1892
|
+
description: 'Product description'
|
1893
|
+
purchasable:
|
1894
|
+
type: boolean
|
1895
|
+
example: true
|
1896
|
+
description: 'Indicates if Variant is in stock or backorderable'
|
1897
|
+
in_stock:
|
1898
|
+
type: boolean
|
1899
|
+
example: true
|
1900
|
+
description: 'Indicates if Variant is in stock'
|
1901
|
+
backorderable:
|
1902
|
+
type: boolean
|
1903
|
+
example: true
|
1904
|
+
description: 'Indicates if Variant is backorderable'
|
1905
|
+
VariantRelationships:
|
1906
|
+
type: object
|
1907
|
+
properties:
|
1908
|
+
product:
|
1909
|
+
type: object
|
1910
|
+
properties:
|
1911
|
+
data:
|
1912
|
+
$ref: '#/components/schemas/Relation'
|
1913
|
+
images:
|
1914
|
+
type: object
|
1915
|
+
properties:
|
1916
|
+
data:
|
1917
|
+
type: array
|
1918
|
+
items:
|
1919
|
+
$ref: '#/components/schemas/Relation'
|
1920
|
+
option_values:
|
1921
|
+
type: object
|
1922
|
+
properties:
|
1923
|
+
data:
|
1924
|
+
type: array
|
1925
|
+
items:
|
1926
|
+
$ref: '#/components/schemas/Relation'
|
1927
|
+
VariantAttributesAndRelationships:
|
1928
|
+
properties:
|
1929
|
+
id:
|
1930
|
+
type: string
|
1931
|
+
example: '1'
|
1932
|
+
type:
|
1933
|
+
type: string
|
1934
|
+
default: 'variant'
|
1935
|
+
attributes:
|
1936
|
+
$ref: '#/components/schemas/VariantAttributes'
|
1937
|
+
relationships:
|
1938
|
+
$ref: '#/components/schemas/VariantRelationships'
|
1939
|
+
Country:
|
1940
|
+
required:
|
1941
|
+
- data
|
1942
|
+
- included
|
1943
|
+
properties:
|
1944
|
+
data:
|
1945
|
+
$ref: '#/components/schemas/CountryAttributesAndRelationships'
|
1946
|
+
included:
|
1947
|
+
type: array
|
1948
|
+
items:
|
1949
|
+
oneOf:
|
1950
|
+
- $ref: '#/components/schemas/State'
|
1951
|
+
CountriesList:
|
1952
|
+
required:
|
1953
|
+
- data
|
1954
|
+
properties:
|
1955
|
+
data:
|
1956
|
+
type: array
|
1957
|
+
items:
|
1958
|
+
$ref: '#/components/schemas/CountryAttributesAndRelationships'
|
1959
|
+
CountryAttributes:
|
1960
|
+
type: object
|
1961
|
+
properties:
|
1962
|
+
iso:
|
1963
|
+
type: string
|
1964
|
+
example: 'us'
|
1965
|
+
iso3:
|
1966
|
+
type: string
|
1967
|
+
example: 'usa'
|
1968
|
+
iso_name:
|
1969
|
+
type: string
|
1970
|
+
example: 'UNITED STATES'
|
1971
|
+
name:
|
1972
|
+
type: string
|
1973
|
+
example: 'United States'
|
1974
|
+
states_required:
|
1975
|
+
type: boolean
|
1976
|
+
example: true
|
1977
|
+
zipcode_required:
|
1978
|
+
type: boolean
|
1979
|
+
example: true
|
1980
|
+
default:
|
1981
|
+
type: boolean
|
1982
|
+
example: true
|
1983
|
+
CountryRelationships:
|
1984
|
+
type: object
|
1985
|
+
properties:
|
1986
|
+
states:
|
1987
|
+
type: object
|
1988
|
+
description: 'States associated with this Country'
|
1989
|
+
properties:
|
1990
|
+
data:
|
1991
|
+
$ref: '#/components/schemas/Relation'
|
1992
|
+
CountryAttributesAndRelationships:
|
1993
|
+
properties:
|
1994
|
+
id:
|
1995
|
+
type: string
|
1996
|
+
example: '1'
|
1997
|
+
type:
|
1998
|
+
type: string
|
1999
|
+
default: 'country'
|
2000
|
+
attributes:
|
2001
|
+
$ref: '#/components/schemas/CountryAttributes'
|
2002
|
+
relationships:
|
2003
|
+
$ref: '#/components/schemas/CountryRelationships'
|
2004
|
+
State:
|
2005
|
+
type: object
|
2006
|
+
properties:
|
2007
|
+
abbr:
|
2008
|
+
type: string
|
2009
|
+
example: 'NY'
|
2010
|
+
name:
|
2011
|
+
type: string
|
2012
|
+
example: 'New York'
|
2013
|
+
PaymentMethodsList:
|
2014
|
+
required:
|
2015
|
+
- data
|
2016
|
+
properties:
|
2017
|
+
data:
|
2018
|
+
type: array
|
2019
|
+
items:
|
2020
|
+
$ref: '#/components/schemas/PaymentMethod'
|
2021
|
+
PaymentMethod:
|
2022
|
+
properties:
|
2023
|
+
id:
|
2024
|
+
type: string
|
2025
|
+
example: '1'
|
2026
|
+
type:
|
2027
|
+
type: string
|
2028
|
+
default: 'payment_method'
|
2029
|
+
attributes:
|
2030
|
+
type: object
|
2031
|
+
properties:
|
2032
|
+
type:
|
2033
|
+
type: string
|
2034
|
+
example: 'Spree::Gateway::StripeGateway'
|
2035
|
+
name:
|
2036
|
+
type: string
|
2037
|
+
example: 'Stripe'
|
2038
|
+
description:
|
2039
|
+
type: string
|
2040
|
+
example: 'Stripe Payments'
|
2041
|
+
ShipmentAttributesWithoutRelationsips:
|
2042
|
+
properties:
|
2043
|
+
id:
|
2044
|
+
type: string
|
2045
|
+
example: '1'
|
2046
|
+
type:
|
2047
|
+
type: string
|
2048
|
+
default: 'shipment'
|
2049
|
+
attributes:
|
2050
|
+
$ref: '#/components/schemas/ShipmentAttributes'
|
2051
|
+
relationships:
|
2052
|
+
type: object
|
2053
|
+
ShipmentAttributesAndRelationsips:
|
2054
|
+
properties:
|
2055
|
+
id:
|
2056
|
+
type: string
|
2057
|
+
example: '1'
|
2058
|
+
type:
|
2059
|
+
type: string
|
2060
|
+
default: 'shipment'
|
2061
|
+
attributes:
|
2062
|
+
$ref: '#/components/schemas/ShipmentAttributes'
|
2063
|
+
relationships:
|
2064
|
+
properties:
|
2065
|
+
shipping_rates:
|
2066
|
+
properties:
|
2067
|
+
data:
|
2068
|
+
type: array
|
2069
|
+
items:
|
2070
|
+
oneOf:
|
2071
|
+
- $ref: '#/components/schemas/Relation'
|
2072
|
+
ShipmentAttributes:
|
2073
|
+
properties:
|
2074
|
+
number:
|
2075
|
+
type: string
|
2076
|
+
example: 'H121354'
|
2077
|
+
description: 'Unique Shipment identifier'
|
2078
|
+
free:
|
2079
|
+
type: boolean
|
2080
|
+
example: true
|
2081
|
+
description: 'Indicates if the Shipping Rate is free, eg. when Free shipping promo applied to Cart'
|
2082
|
+
final_price:
|
2083
|
+
type: string
|
2084
|
+
example: '10.0'
|
2085
|
+
description: 'Price to be presented for the Customer'
|
2086
|
+
display_final_price:
|
2087
|
+
type: string
|
2088
|
+
example: '$10.00'
|
2089
|
+
tracking_url:
|
2090
|
+
type: string
|
2091
|
+
example: 'https://tools.usps.com/go/TrackConfirmAction?tRef=fullpage&tLc=2&text28777=&tLabels=4123412434%2C'
|
2092
|
+
description: 'Tracking URL to the service provider website'
|
2093
|
+
state:
|
2094
|
+
type: string
|
2095
|
+
example: 'shipped'
|
2096
|
+
description: >-
|
2097
|
+
Status of the Shipment. For list of all available statuses please refer:
|
2098
|
+
<a href="https://guides.spreecommerce.org/developer/shipments.html#overview" target="_blank" rel="noopener">
|
2099
|
+
Shipment section in Spree Guides
|
2100
|
+
</a>
|
2101
|
+
shipped_at:
|
2102
|
+
type: string
|
2103
|
+
format: 'date-time'
|
2104
|
+
example: '2019-01-02 13:42:12 UTC'
|
2105
|
+
description: 'Date when Shipment was being sent from the warehouse'
|
2106
|
+
ShippingRatesList:
|
2107
|
+
required:
|
2108
|
+
- data
|
2109
|
+
- included
|
2110
|
+
properties:
|
2111
|
+
data:
|
2112
|
+
type: array
|
2113
|
+
items:
|
2114
|
+
$ref: '#/components/schemas/ShipmentAttributesAndRelationsips'
|
2115
|
+
included:
|
2116
|
+
type: array
|
2117
|
+
items:
|
2118
|
+
oneOf:
|
2119
|
+
- $ref: '#/components/schemas/ShippingRate'
|
2120
|
+
ShippingRate:
|
2121
|
+
properties:
|
2122
|
+
id:
|
2123
|
+
type: string
|
2124
|
+
example: '1'
|
2125
|
+
type:
|
2126
|
+
type: string
|
2127
|
+
default: 'shipping_rate'
|
2128
|
+
attributes:
|
2129
|
+
type: object
|
2130
|
+
properties:
|
2131
|
+
name:
|
2132
|
+
type: string
|
2133
|
+
example: 'USPS Ground'
|
2134
|
+
selected:
|
2135
|
+
type: boolean
|
2136
|
+
example: true
|
2137
|
+
free:
|
2138
|
+
type: boolean
|
2139
|
+
example: true
|
2140
|
+
description: 'Indicates if the Shipping Rate is free, eg. when Free shipping promo applied to Cart'
|
2141
|
+
final_price:
|
2142
|
+
type: string
|
2143
|
+
example: '10.0'
|
2144
|
+
description: 'Price to be presented for the Customer'
|
2145
|
+
display_final_price:
|
2146
|
+
type: string
|
2147
|
+
example: '$10.00'
|
2148
|
+
cost:
|
2149
|
+
type: string
|
2150
|
+
example: '10.0'
|
2151
|
+
description: 'Price of the service without discounts applied'
|
2152
|
+
display_cost:
|
2153
|
+
type: string
|
2154
|
+
example: '$10.00'
|
2155
|
+
tax_amount:
|
2156
|
+
type: string
|
2157
|
+
example: '0.0'
|
2158
|
+
description: 'Eligible tax for service (if any)'
|
2159
|
+
display_tax_amount:
|
2160
|
+
type: string
|
2161
|
+
example: '$0.00'
|
2162
|
+
shipping_method_id:
|
2163
|
+
type: integer
|
2164
|
+
example: 1
|
2165
|
+
description: 'ID of a Shipping Method. You will need this for the Checkout Update action'
|
2166
|
+
Account:
|
2167
|
+
required:
|
2168
|
+
- data
|
2169
|
+
- included
|
2170
|
+
properties:
|
2171
|
+
data:
|
2172
|
+
$ref: '#/components/schemas/AccountAttributesAndRelationships'
|
2173
|
+
included:
|
2174
|
+
type: array
|
2175
|
+
items:
|
2176
|
+
oneOf:
|
2177
|
+
- $ref: '#/components/schemas/Address'
|
2178
|
+
AccountAttributes:
|
2179
|
+
type: object
|
2180
|
+
properties:
|
2181
|
+
email:
|
2182
|
+
type: string
|
2183
|
+
example: 'spree@example.com'
|
2184
|
+
store_credits:
|
2185
|
+
type: number
|
2186
|
+
example: 150.75
|
2187
|
+
completed_orders:
|
2188
|
+
type: number
|
2189
|
+
example: 3
|
2190
|
+
AccountRelationships:
|
2191
|
+
type: object
|
2192
|
+
properties:
|
2193
|
+
default_billing_address:
|
2194
|
+
type: object
|
2195
|
+
description: 'Default billing address associated with this Account'
|
2196
|
+
properties:
|
2197
|
+
data:
|
2198
|
+
$ref: '#/components/schemas/Relation'
|
2199
|
+
default_shipping_address:
|
2200
|
+
type: object
|
2201
|
+
description: 'Default shipping address associated with this Account'
|
2202
|
+
properties:
|
2203
|
+
data:
|
2204
|
+
$ref: '#/components/schemas/Relation'
|
2205
|
+
AccountAttributesAndRelationships:
|
2206
|
+
properties:
|
2207
|
+
id:
|
2208
|
+
type: string
|
2209
|
+
example: '1'
|
2210
|
+
type:
|
2211
|
+
type: string
|
2212
|
+
default: 'user'
|
2213
|
+
attributes:
|
2214
|
+
$ref: '#/components/schemas/AccountAttributes'
|
2215
|
+
relationships:
|
2216
|
+
$ref: '#/components/schemas/AccountRelationships'
|
2217
|
+
AddressPayload:
|
2218
|
+
properties:
|
2219
|
+
firstname:
|
2220
|
+
type: string
|
2221
|
+
lastname:
|
2222
|
+
type: string
|
2223
|
+
address1:
|
2224
|
+
type: string
|
2225
|
+
description: 'Street address'
|
2226
|
+
address2:
|
2227
|
+
type: string
|
2228
|
+
description: 'Additional address information, floor no etc'
|
2229
|
+
city:
|
2230
|
+
type: string
|
2231
|
+
description: 'City, town'
|
2232
|
+
phone:
|
2233
|
+
type: string
|
2234
|
+
zipcode:
|
2235
|
+
type: string
|
2236
|
+
description: 'Valid zipcode, will be validated against the selected Country'
|
2237
|
+
state_name:
|
2238
|
+
type: string
|
2239
|
+
description: 'State/region/province 2 letter abbrevation'
|
2240
|
+
country_id:
|
2241
|
+
type: number
|
2242
|
+
description: 'ID number of Country in the database'
|
2243
|
+
example:
|
2244
|
+
firstname: 'John'
|
2245
|
+
lastname: 'Snow'
|
2246
|
+
address1: '7735 Old Georgetown Road'
|
2247
|
+
address2: '2nd Floor'
|
2248
|
+
city: 'Bethesda'
|
2249
|
+
phone: '3014445002'
|
2250
|
+
zipcode: '20814'
|
2251
|
+
state_name: 'MD'
|
2252
|
+
country_id: 232
|
2253
|
+
|
2254
|
+
parameters:
|
2255
|
+
CreditCardIncludeParam:
|
2256
|
+
name: include
|
2257
|
+
in: query
|
2258
|
+
required: false
|
2259
|
+
schema:
|
2260
|
+
type: string
|
2261
|
+
example: 'payment_method'
|
2262
|
+
description: >-
|
2263
|
+
<p>Specify what related resources (relationships) you would like to receive in the response body.</p>
|
2264
|
+
<p>You can also fetch relationships of relationships.</p>
|
2265
|
+
<p>
|
2266
|
+
Format:
|
2267
|
+
<ul>
|
2268
|
+
<li>payment_method</li>
|
2269
|
+
</ul>
|
2270
|
+
<p>
|
2271
|
+
More information:
|
2272
|
+
<a href="https://jsonapi.org/format/#fetching-includes" target="_blank" rel="noopener">
|
2273
|
+
https://jsonapi.org/format/#fetching-includes
|
2274
|
+
</a>
|
2275
|
+
</p>
|
2276
|
+
IdOrPermalink:
|
2277
|
+
name: id
|
2278
|
+
in: path
|
2279
|
+
required: true
|
2280
|
+
description: ID or a permalink
|
2281
|
+
schema:
|
2282
|
+
type: string
|
2283
|
+
examples:
|
2284
|
+
ID:
|
2285
|
+
value: '1'
|
2286
|
+
Permalink:
|
2287
|
+
value: 'some-product'
|
2288
|
+
LineItemId:
|
2289
|
+
name: line_item_id
|
2290
|
+
in: path
|
2291
|
+
required: true
|
2292
|
+
description: Line Item ID
|
2293
|
+
schema:
|
2294
|
+
type: string
|
2295
|
+
example: '1'
|
2296
|
+
PageParam:
|
2297
|
+
name: page
|
2298
|
+
in: query
|
2299
|
+
description: Number of requested page when paginating collection
|
2300
|
+
schema:
|
2301
|
+
type: integer
|
2302
|
+
example: 1
|
2303
|
+
PerPageParam:
|
2304
|
+
name: per_page
|
2305
|
+
in: query
|
2306
|
+
description: Number of requested records per page when paginating collection
|
2307
|
+
schema:
|
2308
|
+
type: integer
|
2309
|
+
example: 10
|
2310
|
+
CartIncludeParam:
|
2311
|
+
name: include
|
2312
|
+
in: query
|
2313
|
+
schema:
|
2314
|
+
type: string
|
2315
|
+
description: >-
|
2316
|
+
<p>Specify what related resources (relationships) you would like to receive in the response body.</p>
|
2317
|
+
<p>You can also fetch relationships of relationships.</p>
|
2318
|
+
<p>
|
2319
|
+
Format:
|
2320
|
+
<ul>
|
2321
|
+
<li>line_items,variants,promotions</li>
|
2322
|
+
<li>variants,variants.images</li>
|
2323
|
+
</ul>
|
2324
|
+
<p>
|
2325
|
+
More information:
|
2326
|
+
<a href="https://jsonapi.org/format/#fetching-includes" target="_blank" rel="noopener">
|
2327
|
+
https://jsonapi.org/format/#fetching-includes
|
2328
|
+
</a>
|
2329
|
+
</p>
|
2330
|
+
example: 'line_items,variants,variants.images,billing_address,shipping_address,user,payments,shipments,promotions'
|
2331
|
+
ProductIncludeParam:
|
2332
|
+
name: include
|
2333
|
+
in: query
|
2334
|
+
schema:
|
2335
|
+
type: string
|
2336
|
+
description: >-
|
2337
|
+
<p>Specify what related resources (relationships) you would like to receive in the response body.</p>
|
2338
|
+
<p>You can also fetch relationships of relationships.</p>
|
2339
|
+
<p>
|
2340
|
+
Format:
|
2341
|
+
<ul>
|
2342
|
+
<li>default_variant,variants,option_types,product_properties,taxons,images</li>
|
2343
|
+
<li>variants,variants.images,variants.option_values</li>
|
2344
|
+
</ul>
|
2345
|
+
<p>
|
2346
|
+
More information:
|
2347
|
+
<a href="https://jsonapi.org/format/#fetching-includes" target="_blank" rel="noopener">
|
2348
|
+
https://jsonapi.org/format/#fetching-includes
|
2349
|
+
</a>
|
2350
|
+
</p>
|
2351
|
+
example: 'default_variant,variants,option_types,product_properties,taxons,images'
|
2352
|
+
TaxonIncludeParam:
|
2353
|
+
name: include
|
2354
|
+
in: query
|
2355
|
+
schema:
|
2356
|
+
type: string
|
2357
|
+
description: >-
|
2358
|
+
<p>Specify what related resources (relationships) you would like to receive in the response body.</p>
|
2359
|
+
<p>You can also fetch relationships of relationships.</p>
|
2360
|
+
<p>
|
2361
|
+
Format:
|
2362
|
+
<ul>
|
2363
|
+
<li>parent,taxonomy,children,image,products</li>
|
2364
|
+
<li>children.children</li>
|
2365
|
+
<li>parent.children</li>
|
2366
|
+
<li>children,products.default_variant</li>
|
2367
|
+
</ul>
|
2368
|
+
<p>
|
2369
|
+
More information:
|
2370
|
+
<a href="https://jsonapi.org/format/#fetching-includes" target="_blank" rel="noopener">
|
2371
|
+
https://jsonapi.org/format/#fetching-includes
|
2372
|
+
</a>
|
2373
|
+
</p>
|
2374
|
+
example: 'parent,taxonomy,children,image,products'
|
2375
|
+
IsoOrIso3:
|
2376
|
+
name: iso
|
2377
|
+
in: path
|
2378
|
+
required: true
|
2379
|
+
description: ISO or ISO3
|
2380
|
+
schema:
|
2381
|
+
type: string
|
2382
|
+
CountryIncludeParam:
|
2383
|
+
name: include
|
2384
|
+
in: query
|
2385
|
+
schema:
|
2386
|
+
type: string
|
2387
|
+
description: >-
|
2388
|
+
Pass `states` as value to include States / Regions for each Country
|
2389
|
+
example: 'states'
|
2390
|
+
AccountIncludeParam:
|
2391
|
+
name: include
|
2392
|
+
in: query
|
2393
|
+
schema:
|
2394
|
+
type: string
|
2395
|
+
description: >-
|
2396
|
+
Pass `default_billing_address` and/or `default_shipping_address` as value to include selected addresses information
|
2397
|
+
example: 'default_billing_address,default_shipping_address'
|
2398
|
+
FilterByIds:
|
2399
|
+
in: query
|
2400
|
+
name: filter[ids]
|
2401
|
+
schema:
|
2402
|
+
type: string
|
2403
|
+
example: 1,2,3
|
2404
|
+
description: Fetch only resources with corresponding IDs
|
2405
|
+
FilterByName:
|
2406
|
+
in: query
|
2407
|
+
name: filter[name]
|
2408
|
+
schema:
|
2409
|
+
type: string
|
2410
|
+
example: rails
|
2411
|
+
description: Find resources with matching name (supports wild-card, partial-word match search)
|
2412
|
+
SparseFieldsParam:
|
2413
|
+
in: query
|
2414
|
+
name: fields
|
2415
|
+
style: deepObject
|
2416
|
+
description: >-
|
2417
|
+
<p>Specify what attributes for given types you would like to receive in the response body.</p>
|
2418
|
+
<p>
|
2419
|
+
Format:
|
2420
|
+
<ul>
|
2421
|
+
<li>fields[cart]=total,currency,number</li>
|
2422
|
+
</ul>
|
2423
|
+
<p>
|
2424
|
+
More information:
|
2425
|
+
<a href="https://jsonapi.org/format/#fetching-sparse-fieldsets" target="_blank" rel="noopener">
|
2426
|
+
https://jsonapi.org/format/#fetching-sparse-fieldsets
|
2427
|
+
</a>
|
2428
|
+
</p>
|
2429
|
+
example: { "cart": "total,currency,number" }
|
2430
|
+
schema:
|
2431
|
+
type: object
|
2432
|
+
responses:
|
2433
|
+
404NotFound:
|
2434
|
+
description: Resource not found
|
2435
|
+
content:
|
2436
|
+
application/json:
|
2437
|
+
schema:
|
2438
|
+
$ref: '#/components/schemas/Error'
|
2439
|
+
403Forbidden:
|
2440
|
+
description: You are not authorized to access this page.
|
2441
|
+
content:
|
2442
|
+
application/json:
|
2443
|
+
schema:
|
2444
|
+
$ref: '#/components/schemas/Error'
|