docs/v2/storefront/index.yaml in spree_api-3.7.0.rc1 vs docs/v2/storefront/index.yaml in spree_api-3.7.0.rc2
- old
+ new
@@ -88,10 +88,54 @@
parameters:
- $ref: '#/components/parameters/CreditCardIncludeParam'
- $ref: '#/components/parameters/SparseFieldsParam'
security:
- bearerAuth: []
+ '/account/orders':
+ get:
+ description: Returns Orders placed by the User. Only completed ones.
+ tags:
+ - Account
+ operationId: 'Completed Orders'
+ responses:
+ '200':
+ description: Listing user completed orders.
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/CartList'
+ '403':
+ $ref: '#/components/responses/403Forbidden'
+ parameters:
+ - $ref: '#/components/parameters/CartIncludeParam'
+ - $ref: '#/components/parameters/SparseFieldsParam'
+ - $ref: '#/components/parameters/PageParam'
+ - $ref: '#/components/parameters/PerPageParam'
+ security:
+ - bearerAuth: []
+ '/account/orders/{number}':
+ get:
+ description: >-
+ Return the User's completed Order
+ tags:
+ - Account
+ operationId: 'Completed User Order'
+ responses:
+ '200':
+ description: Listing user completed order.
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Cart'
+ '403':
+ $ref: '#/components/responses/403Forbidden'
+ parameters:
+ - $ref: '#/components/parameters/OrderParam'
+ - $ref: '#/components/parameters/CartIncludeParam'
+ - $ref: '#/components/parameters/SparseFieldsParam'
+ security:
+ - bearerAuth: []
'/cart':
post:
description: >-
<p>Creates new Cart and returns it attributes.</p>
<br />
@@ -361,11 +405,11 @@
address1: '7735 Old Georgetown Road',
city: 'Bethesda',
phone: '3014445002',
zipcode: '20814',
state_name: 'MD',
- country_id: 232
+ country_iso: 'US'
}
},
ship_address_attributes: {
{
firstname: 'John',
@@ -373,11 +417,11 @@
address1: '7735 Old Georgetown Road',
city: 'Bethesda',
phone: '3014445002',
zipcode: '20814',
state_name: 'MD',
- country_id: 232
+ country_iso: 'US'
}
}
}
</pre>
<h3>2. Fetch Shipping Rates</h3>
@@ -1013,153 +1057,16 @@
- data
- included
properties:
data:
type: object
+ $ref: '#/components/schemas/CartAttributesWithRelationships'
required:
- id
- type
- attributes
- relationships
- properties:
- id:
- type: string
- example: '1'
- type:
- type: string
- default: 'cart'
- attributes:
- type: object
- properties:
- number:
- type: string
- example: 'R123456789'
- email:
- type: string
- example: 'spree@example.com'
- item_total:
- type: string
- example: '19.99'
- display_item_total:
- type: string
- example: '$19.99'
- total:
- type: string
- example: '29.99'
- display_total:
- type: string
- example: '$29.99'
- ship_total:
- type: string
- example: '0.0'
- display_ship_total:
- type: string
- example: '$19.99'
- adjustment_total:
- type: string
- example: '10.0'
- display_adjustment_total:
- type: string
- example: '$10.00'
- promo_total:
- type: string
- example: '-10.0'
- display_promo_total:
- type: string
- example: '-$10.00'
- created_at:
- $ref: '#/components/schemas/Timestamp'
- updated_at:
- $ref: '#/components/schemas/Timestamp'
- included_tax_total:
- type: string
- example: '5.00'
- additional_tax_total:
- type: string
- example: '5.0'
- display_additional_tax_total:
- type: string
- example: '$5.00'
- display_included_tax_total:
- type: string
- example: '$5.00'
- tax_total:
- type: string
- example: '10.0'
- display_tax_total:
- type: string
- example: '$10.00'
- item_count:
- type: number
- example: 2
- description: 'Total quantity number of all items added to the Cart'
- special_instructions:
- type: string
- example: 'Please wrap it as a gift'
- description: 'Message added by the Customer'
- currency:
- type: string
- example: 'USD'
- state:
- type: string
- example: 'address'
- description: 'State of the Cart in the Checkout flow'
- token:
- type: string
- example: abcdef123456
- description: >-
- Used for authorizing any action for an order within Spree’s
- API
- relationships:
- type: object
- properties:
- line_items:
- type: object
- properties:
- data:
- type: array
- items:
- $ref: '#/components/schemas/Relation'
- promotions:
- type: object
- properties:
- data:
- type: array
- items:
- $ref: '#/components/schemas/Relation'
- variants:
- type: object
- properties:
- data:
- type: array
- items:
- $ref: '#/components/schemas/Relation'
- user:
- type: object
- properties:
- data:
- $ref: '#/components/schemas/Relation'
- billing_address:
- type: object
- properties:
- data:
- $ref: '#/components/schemas/Relation'
- shipping_address:
- type: object
- properties:
- data:
- $ref: '#/components/schemas/Relation'
- payments:
- type: object
- properties:
- data:
- $ref: '#/components/schemas/Relation'
- shipments:
- type: object
- properties:
- data:
- $ref: '#/components/schemas/Relation'
included:
type: array
items:
type: object
oneOf:
@@ -1167,18 +1074,180 @@
- $ref: '#/components/schemas/LineItem'
- $ref: '#/components/schemas/Promotion'
- $ref: '#/components/schemas/User'
- $ref: '#/components/schemas/Address'
- $ref: '#/components/schemas/ShipmentAttributesWithoutRelationsips'
- CreditCardList:
+ CartList:
required:
- data
- included
properties:
data:
+ required:
+ - id
+ - type
+ - attributes
+ - relationships
type: array
items:
+ $ref: '#/components/schemas/CartAttributesWithRelationships'
+ included:
+ type: array
+ items:
+ type: object
+ oneOf:
+ - $ref: '#/components/schemas/VariantAttributesAndRelationships'
+ - $ref: '#/components/schemas/LineItem'
+ - $ref: '#/components/schemas/Promotion'
+ - $ref: '#/components/schemas/User'
+ - $ref: '#/components/schemas/Address'
+ - $ref: '#/components/schemas/ShipmentAttributesWithoutRelationsips'
+ CartAttributesWithRelationships:
+ properties:
+ id:
+ type: string
+ example: '1'
+ type:
+ type: string
+ example: 'cart'
+ attributes:
+ $ref: '#/components/schemas/CartAttributes'
+ relationships:
+ $ref: '#/components/schemas/CartRelationships'
+ CartRelationships:
+ type: object
+ properties:
+ line_items:
+ type: object
+ description: ''
+ properties:
+ data:
+ $ref: '#/components/schemas/Relation'
+ promotions:
+ type: object
+ properties:
+ data:
+ $ref: '#/components/schemas/Relation'
+ variants:
+ type: object
+ properties:
+ data:
+ $ref: '#/components/schemas/Relation'
+ user:
+ type: object
+ properties:
+ data:
+ $ref: '#/components/schemas/Relation'
+ billing_address:
+ type: object
+ properties:
+ data:
+ $ref: '#/components/schemas/Relation'
+ shipping_address:
+ type: object
+ properties:
+ data:
+ $ref: '#/components/schemas/Relation'
+ payments:
+ type: object
+ properties:
+ data:
+ $ref: '#/components/schemas/Relation'
+ shipments:
+ type: object
+ properties:
+ data:
+ $ref: '#/components/schemas/Relation'
+ CartAttributes:
+ type: object
+ properties:
+ number:
+ type: string
+ example: 'R123456789'
+ email:
+ type: string
+ example: 'spree@example.com'
+ item_total:
+ type: string
+ example: '19.99'
+ display_item_total:
+ type: string
+ example: '$19.99'
+ total:
+ type: string
+ example: '29.99'
+ display_total:
+ type: string
+ example: '$29.99'
+ ship_total:
+ type: string
+ example: '0.0'
+ display_ship_total:
+ type: string
+ example: '$19.99'
+ adjustment_total:
+ type: string
+ example: '10.0'
+ display_adjustment_total:
+ type: string
+ example: '$10.00'
+ promo_total:
+ type: string
+ example: '-10.0'
+ display_promo_total:
+ type: string
+ example: '-$10.00'
+ created_at:
+ $ref: '#/components/schemas/Timestamp'
+ updated_at:
+ $ref: '#/components/schemas/Timestamp'
+ included_tax_total:
+ type: string
+ example: '5.00'
+ additional_tax_total:
+ type: string
+ example: '5.0'
+ display_additional_tax_total:
+ type: string
+ example: '$5.00'
+ display_included_tax_total:
+ type: string
+ example: '$5.00'
+ tax_total:
+ type: string
+ example: '10.0'
+ display_tax_total:
+ type: string
+ example: '$10.00'
+ item_count:
+ type: number
+ example: 2
+ description: 'Total quantity number of all items added to the Cart'
+ special_instructions:
+ type: string
+ example: 'Please wrap it as a gift'
+ description: 'Message added by the Customer'
+ currency:
+ type: string
+ example: 'USD'
+ state:
+ type: string
+ example: 'address'
+ description: 'State of the Cart in the Checkout flow'
+ token:
+ type: string
+ example: abcdef123456
+ description: >-
+ Used for authorizing any action for an order within Spree’s
+ API
+ CreditCardList:
+ required:
+ - included
+ properties:
+ data:
+ type: array
+ items:
$ref: '#/components/schemas/CreditCardAttributesWithRelationships'
included:
type: array
items:
type: object
@@ -1204,19 +1273,27 @@
type: string
example: 'visa'
last_digits:
type: string
example: '1232'
+ description: 'Last 4 digits of CC number'
month:
type: integer
example: 10
+ description: 'Expiration date month'
year:
type: integer
example: 2019
+ description: 'Expiration date year'
name:
type: string
example: 'John Doe'
+ description: 'Card holder name'
+ default:
+ type: boolean
+ example: true
+ description: 'Defines if this is the default CC for a signed in user'
CreditCardAttributesWithRelationships:
properties:
id:
type: string
example: '1'
@@ -1345,10 +1422,16 @@
type: string
example: '5.0'
display_additional_tax_total:
type: string
example: '$5.00'
+ discounted_amount:
+ type: string
+ example: '125.0'
+ display_discounted_amount:
+ type: string
+ example: '$125.00'
promo_total:
type: string
example: '-5.0'
display_promo_total:
type: string
@@ -2235,23 +2318,27 @@
type: string
description: 'Valid zipcode, will be validated against the selected Country'
state_name:
type: string
description: 'State/region/province 2 letter abbrevation'
- country_id:
- type: number
- description: 'ID number of Country in the database'
+ country_iso:
+ type: string
+ description: >-
+ Country ISO (2-chars) or ISO3 (3-chars) code, list of codes:
+ <a href="https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes" target="_blank" rel="noopener">
+ https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes
+ </a>
example:
firstname: 'John'
lastname: 'Snow'
address1: '7735 Old Georgetown Road'
address2: '2nd Floor'
city: 'Bethesda'
phone: '3014445002'
zipcode: '20814'
state_name: 'MD'
- country_id: 232
+ country_iso: 'US'
parameters:
CreditCardIncludeParam:
name: include
in: query
@@ -2304,11 +2391,19 @@
name: per_page
in: query
description: Number of requested records per page when paginating collection
schema:
type: integer
- example: 10
+ example:
+ OrderParam:
+ name: number
+ in: path
+ required: true
+ description: Number of Order
+ schema:
+ type: string
+ example: 'R653163382'
CartIncludeParam:
name: include
in: query
schema:
type: string
@@ -2433,12 +2528,20 @@
404NotFound:
description: Resource not found
content:
application/json:
schema:
- $ref: '#/components/schemas/Error'
+ properties:
+ error:
+ type: string
+ example: 'The resource you were looking for could not be found.'
+ default: 'The resource you were looking for could not be found.'
403Forbidden:
description: You are not authorized to access this page.
content:
application/json:
schema:
- $ref: '#/components/schemas/Error'
+ properties:
+ error:
+ type: string
+ example: 'You are not authorized to access this page.'
+ default: 'You are not authorized to access this page.'