chore(docs): Refactor API Reference (#1883)

This commit is contained in:
Shahed Nasser
2022-08-05 15:06:12 +03:00
committed by GitHub
parent b126ab4dec
commit 73383cc466
625 changed files with 52358 additions and 11660 deletions

View File

@@ -0,0 +1,60 @@
post:
operationId: PostAuth
summary: Authenticate Customer
description: >-
Logs a Customer in and authorizes them to view their details. Successful
authentication will set a session cookie in the Customer's browser.
parameters: []
tags:
- Auth
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
customer:
$ref: ../components/schemas/customer.yaml
requestBody:
content:
application/json:
schema:
type: object
required:
- email
- password
properties:
email:
type: string
description: The Customer's email.
password:
type: string
description: The Customer's password.
delete:
operationId: DeleteAuth
summary: Log out
description: Destroys a Customer's authenticated session.
tags:
- Auth
responses:
'200':
description: OK
get:
operationId: GetAuth
summary: Get Session
description: Gets the currently logged in Customer.
x-authenticated: true
tags:
- Auth
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
customer:
$ref: ../components/schemas/customer.yaml
'401':
description: Unauthorized

View File

@@ -0,0 +1,24 @@
get:
operationId: GetAuthEmail
summary: Check if email has account
description: Checks if a Customer with the given email has signed up.
parameters:
- in: path
name: email
schema:
type: string
format: email
required: true
description: The email to check if exists.
tags:
- Auth
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
exists:
type: boolean
description: Whether email exists or not.

View File

@@ -0,0 +1,65 @@
post:
summary: Create a Cart
operationId: PostCart
description: >-
Creates a Cart within the given region and with the initial items. If no
`region_id` is provided the cart will be associated with the first Region
available. If no items are provided the cart will be empty after creation.
If a user is logged in the cart's customer id and email will be set.
requestBody:
content:
application/json:
schema:
properties:
region_id:
type: string
description: The ID of the Region to create the Cart in.
sales_channel_id:
type: string
description: >-
[EXPERIMENTAL] The ID of the Sales channel to create the Cart
in.
country_code:
type: string
description: The 2 character ISO country code to create the Cart in.
externalDocs:
url: >-
https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements
description: See a list of codes.
items:
description: >-
An optional array of `variant_id`, `quantity` pairs to generate
Line Items from.
type: array
items:
required:
- variant_id
- quantity
properties:
variant_id:
description: >-
The id of the Product Variant to generate a Line Item
from.
type: string
quantity:
description: The quantity of the Product Variant to add
type: integer
context:
description: >-
An optional object to provide context to the Cart. The `context`
field is automatically populated with `ip` and `user_agent`
type: object
example:
ip: '::1'
user_agent: Chrome
tags:
- Cart
responses:
'200':
description: Successfully created a new Cart
content:
application/json:
schema:
properties:
cart:
$ref: ../components/schemas/cart.yaml

View File

@@ -0,0 +1,109 @@
get:
operationId: GetCartsCart
summary: Retrieve a Cart
description: Retrieves a Cart.
parameters:
- in: path
name: id
required: true
description: The id of the Cart.
schema:
type: string
tags:
- Cart
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
cart:
$ref: ../components/schemas/cart.yaml
post:
operationId: PostCartsCart
summary: Update a Cart
description: Updates a Cart.
parameters:
- in: path
name: id
required: true
description: The id of the Cart.
schema:
type: string
requestBody:
content:
application/json:
schema:
properties:
region_id:
type: string
description: The id of the Region to create the Cart in.
country_code:
type: string
description: The 2 character ISO country code to create the Cart in.
externalDocs:
url: >-
https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements
description: See a list of codes.
email:
type: string
description: An email to be used on the Cart.
format: email
sales_channel_id:
type: string
description: The ID of the Sales channel to update the Cart with.
billing_address:
description: The Address to be used for billing purposes.
anyOf:
- $ref: ../components/schemas/address.yaml
description: A full billing address object.
- type: string
description: The billing address ID
shipping_address:
description: The Address to be used for shipping.
anyOf:
- $ref: ../components/schemas/address.yaml
description: A full shipping address object.
- type: string
description: The shipping address ID
gift_cards:
description: An array of Gift Card codes to add to the Cart.
type: array
items:
required:
- code
properties:
code:
description: The code that a Gift Card is identified by.
type: string
discounts:
description: An array of Discount codes to add to the Cart.
type: array
items:
required:
- code
properties:
code:
description: The code that a Discount is identifed by.
type: string
customer_id:
description: The ID of the Customer to associate the Cart with.
type: string
context:
description: An optional object to provide context to the Cart.
type: object
example:
ip: '::1'
user_agent: Chrome
tags:
- Cart
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
cart:
$ref: ../components/schemas/cart.yaml

View File

@@ -0,0 +1,64 @@
post:
summary: Complete a Cart
operationId: PostCartsCartComplete
description: >-
Completes a cart. The following steps will be performed. Payment
authorization is attempted and if more work is required, we simply return
the cart for further updates. If payment is authorized and order is not yet
created, we make sure to do so. The completion of a cart can be performed
idempotently with a provided header `Idempotency-Key`. If not provided, we
will generate one for the request.
parameters:
- in: path
name: id
required: true
description: The Cart id.
schema:
type: string
tags:
- Cart
responses:
'200':
description: >-
If a cart was successfully authorized, but requires further action from
the user the response body will contain the cart with an updated payment
session. If the Cart was successfully completed the response body will
contain the newly created Order.
content:
application/json:
schema:
properties:
type:
type: string
description: The type of the data property.
enum:
- order
- cart
- swap
data:
type: object
description: >-
The data of the result object. Its type depends on the type
field.
oneOf:
- type: object
description: >-
Cart was successfully authorized and order was placed
successfully.
properties:
order:
$ref: ../components/schemas/order.yaml
- type: object
description: >-
Cart was successfully authorized but requires further
actions.
properties:
cart:
$ref: ../components/schemas/cart.yaml
- type: object
description: >-
When cart is used for a swap and it has been completed
successfully.
properties:
cart:
$ref: ../components/schemas/swap.yaml

View File

@@ -0,0 +1,28 @@
delete:
operationId: DeleteCartsCartDiscountsDiscount
description: Removes a Discount from a Cart.
summary: Remove Discount from Cart
parameters:
- in: path
name: id
required: true
description: The id of the Cart.
schema:
type: string
- in: path
name: code
required: true
description: The unique Discount code.
schema:
type: string
tags:
- Cart
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
cart:
$ref: ../components/schemas/cart.yaml

View File

@@ -0,0 +1,42 @@
post:
operationId: PostCartsCartLineItems
summary: Add a Line Item
description: Generates a Line Item with a given Product Variant and adds it to the Cart
parameters:
- in: path
name: id
required: true
description: The id of the Cart to add the Line Item to.
schema:
type: string
tags:
- Cart
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
cart:
$ref: ../components/schemas/cart.yaml
requestBody:
content:
application/json:
schema:
type: object
required:
- variant_id
- quantity
properties:
variant_id:
type: string
description: The id of the Product Variant to generate the Line Item from.
quantity:
type: integer
description: The quantity of the Product Variant to add to the Line Item.
metadata:
type: object
description: >-
An optional key-value map with additional details about the Line
Item.

View File

@@ -0,0 +1,67 @@
delete:
operationId: DeleteCartsCartLineItemsItem
summary: Delete a Line Item
description: Removes a Line Item from a Cart.
parameters:
- in: path
name: id
required: true
description: The id of the Cart.
schema:
type: string
- in: path
name: line_id
required: true
description: The id of the Line Item.
schema:
type: string
tags:
- Cart
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
cart:
$ref: ../components/schemas/cart.yaml
post:
operationId: PostCartsCartLineItemsItem
summary: Update a Line Item
description: Updates a Line Item if the desired quantity can be fulfilled.
parameters:
- in: path
name: id
required: true
description: The id of the Cart.
schema:
type: string
- in: path
name: line_id
required: true
description: The id of the Line Item.
schema:
type: string
tags:
- Cart
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
cart:
$ref: ../components/schemas/cart.yaml
requestBody:
content:
application/json:
schema:
type: object
required:
- quantity
properties:
quantity:
type: integer
description: The quantity to set the Line Item to.

View File

@@ -0,0 +1,35 @@
post:
operationId: PostCartsCartPaymentSession
summary: Select a Payment Session
description: >-
Selects a Payment Session as the session intended to be used towards the
completion of the Cart.
parameters:
- in: path
name: id
required: true
description: The ID of the Cart.
schema:
type: string
tags:
- Cart
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
cart:
$ref: ../components/schemas/cart.yaml
requestBody:
content:
application/json:
schema:
type: object
required:
- provider_id
properties:
provider_id:
type: string
description: The ID of the Payment Provider.

View File

@@ -0,0 +1,24 @@
post:
operationId: PostCartsCartPaymentSessions
summary: Initialize Payment Sessions
description: >-
Creates Payment Sessions for each of the available Payment Providers in the
Cart's Region.
parameters:
- in: path
name: id
required: true
description: The id of the Cart.
schema:
type: string
tags:
- Cart
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
cart:
$ref: ../components/schemas/cart.yaml

View File

@@ -0,0 +1,69 @@
delete:
operationId: DeleteCartsCartPaymentSessionsSession
summary: Delete a Payment Session
description: Deletes a Payment Session on a Cart. May be useful if a payment has failed.
parameters:
- in: path
name: id
required: true
description: The id of the Cart.
schema:
type: string
- in: path
name: provider_id
required: true
description: >-
The id of the Payment Provider used to create the Payment Session to be
deleted.
schema:
type: string
tags:
- Cart
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
cart:
$ref: ../components/schemas/cart.yaml
post:
operationId: PostCartsCartPaymentSessionUpdate
summary: Update a Payment Session
description: Updates a Payment Session with additional data.
parameters:
- in: path
name: id
required: true
description: The id of the Cart.
schema:
type: string
- in: path
name: provider_id
required: true
description: The id of the payment provider.
schema:
type: string
tags:
- Cart
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
cart:
$ref: ../components/schemas/cart.yaml
requestBody:
content:
application/json:
schema:
type: object
required:
- data
properties:
data:
type: object
description: The data to update the payment session with.

View File

@@ -0,0 +1,32 @@
post:
operationId: PostCartsCartPaymentSessionsSession
summary: Refresh a Payment Session
description: >-
Refreshes a Payment Session to ensure that it is in sync with the Cart -
this is usually not necessary.
parameters:
- in: path
name: id
required: true
description: The id of the Cart.
schema:
type: string
- in: path
name: provider_id
required: true
description: >-
The id of the Payment Provider that created the Payment Session to be
refreshed.
schema:
type: string
tags:
- Cart
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
cart:
$ref: ../components/schemas/cart.yaml

View File

@@ -0,0 +1,40 @@
post:
operationId: PostCartsCartShippingMethod
description: Adds a Shipping Method to the Cart.
summary: Add a Shipping Method
tags:
- Cart
parameters:
- in: path
name: id
required: true
description: The cart ID.
schema:
type: string
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
cart:
$ref: ../components/schemas/cart.yaml
requestBody:
content:
application/json:
schema:
type: object
required:
- option_id
properties:
option_id:
type: string
description: ID of the shipping option to create the method from
data:
type: object
description: >-
Used to hold any data that the shipping method may need to
process the fulfillment of the order. Look at the documentation
for your installed fulfillment providers to find out what to
send.

View File

@@ -0,0 +1,24 @@
post:
summary: Calculate Cart Taxes
operationId: PostCartsCartTaxes
description: >-
Calculates taxes for a cart. Depending on the cart's region this may involve
making 3rd party API calls to a Tax Provider service.
parameters:
- in: path
name: id
required: true
description: The Cart ID.
schema:
type: string
tags:
- Cart
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
cart:
$ref: ../components/schemas/cart.yaml

View File

@@ -0,0 +1,85 @@
get:
operationId: GetCollections
summary: List Product Collections
description: Retrieve a list of Product Collection.
parameters:
- in: query
name: offset
description: >-
The number of collections to skip before starting to collect the
collections set
schema:
type: integer
default: 0
- in: query
name: limit
description: The number of collections to return
schema:
type: integer
default: 10
- in: query
name: created_at
description: Date comparison for when resulting collections were created.
schema:
type: object
properties:
lt:
type: string
description: filter by dates less than this date
format: date
gt:
type: string
description: filter by dates greater than this date
format: date
lte:
type: string
description: filter by dates less than or equal to this date
format: date
gte:
type: string
description: filter by dates greater than or equal to this date
format: date
- in: query
name: updated_at
description: Date comparison for when resulting collections were updated.
schema:
type: object
properties:
lt:
type: string
description: filter by dates less than this date
format: date
gt:
type: string
description: filter by dates greater than this date
format: date
lte:
type: string
description: filter by dates less than or equal to this date
format: date
gte:
type: string
description: filter by dates greater than or equal to this date
format: date
tags:
- Collection
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
collections:
type: array
items:
$ref: ../components/schemas/product_collection.yaml
count:
type: integer
description: The total number of items available
offset:
type: integer
description: The number of items skipped before these items
limit:
type: integer
description: The number of items per page

View File

@@ -0,0 +1,22 @@
get:
operationId: GetCollectionsCollection
summary: Retrieve a Product Collection
description: Retrieves a Product Collection.
parameters:
- in: path
name: id
required: true
description: The id of the Product Collection
schema:
type: string
tags:
- Collection
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
collection:
$ref: ../components/schemas/product_collection.yaml

View File

@@ -0,0 +1,63 @@
post:
operationId: PostCustomers
summary: Create a Customer
description: Creates a Customer account.
requestBody:
content:
application/json:
schema:
required:
- first_name
- last_name
- email
- password
properties:
first_name:
description: The Customer's first name.
type: string
last_name:
description: The Customer's last name.
type: string
email:
description: The email of the customer.
type: string
format: email
password:
description: The Customer's password.
type: string
format: password
phone:
description: The Customer's phone number.
type: string
tags:
- Customer
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
customer:
$ref: ../components/schemas/customer.yaml
'422':
description: A customer with the same email exists
content:
application/json:
schema:
properties:
code:
type: string
description: The error code
type:
type: string
description: The type of error
message:
type: string
description: Human-readable message with details about the error
example:
code: invalid_request_error
type: duplicate_error
message: >-
A customer with the given email already has an account. Log in
instead

View File

@@ -0,0 +1,64 @@
get:
operationId: GetCustomersCustomer
summary: Retrieves a Customer
description: >-
Retrieves a Customer - the Customer must be logged in to retrieve their
details.
x-authenticated: true
tags:
- Customer
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
customer:
$ref: ../components/schemas/customer.yaml
post:
operationId: PostCustomersCustomer
summary: Update Customer details
description: Updates a Customer's saved details.
x-authenticated: true
requestBody:
content:
application/json:
schema:
properties:
first_name:
description: The Customer's first name.
type: string
last_name:
description: The Customer's last name.
type: string
billing_address:
description: The Address to be used for billing purposes.
anyOf:
- $ref: ../components/schemas/address.yaml
description: The full billing address object
- type: string
description: The ID of an existing billing address
password:
description: The Customer's password.
type: string
phone:
description: The Customer's phone number.
type: string
email:
description: The email of the customer.
type: string
metadata:
description: Metadata about the customer.
type: object
tags:
- Customer
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
customer:
$ref: ../components/schemas/customer.yaml

View File

@@ -0,0 +1,27 @@
post:
operationId: PostCustomersCustomerAddresses
summary: Add a Shipping Address
description: Adds a Shipping Address to a Customer's saved addresses.
x-authenticated: true
requestBody:
content:
application/json:
schema:
required:
- address
properties:
address:
description: The Address to add to the Customer.
anyOf:
- $ref: ../components/schemas/address.yaml
tags:
- Customer
responses:
'200':
description: A successful response
content:
application/json:
schema:
properties:
customer:
$ref: ../components/schemas/customer.yaml

View File

@@ -0,0 +1,52 @@
delete:
operationId: DeleteCustomersCustomerAddressesAddress
summary: Delete an Address
description: Removes an Address from the Customer's saved addresses.
x-authenticated: true
parameters:
- in: path
name: address_id
required: true
description: The id of the Address to remove.
schema:
type: string
tags:
- Customer
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
customer:
$ref: ../components/schemas/customer.yaml
post:
operationId: PostCustomersCustomerAddressesAddress
summary: Update a Shipping Address
description: Updates a Customer's saved Shipping Address.
x-authenticated: true
parameters:
- in: path
name: address_id
required: true
description: The id of the Address to update.
schema:
type: string
requestBody:
content:
application/json:
schema:
anyOf:
- $ref: ../components/schemas/address.yaml
tags:
- Customer
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
customer:
$ref: ../components/schemas/customer.yaml

View File

@@ -0,0 +1,54 @@
get:
operationId: GetCustomersCustomerOrders
summary: Retrieve Customer Orders
description: Retrieves a list of a Customer's Orders.
x-authenticated: true
parameters:
- in: query
name: limit
description: How many orders to return.
schema:
type: integer
default: 10
- in: query
name: offset
description: The offset in the resulting orders.
schema:
type: integer
default: 0
- in: query
name: fields
description: >-
(Comma separated string) Which fields should be included in the
resulting orders.
schema:
type: string
- in: query
name: expand
description: >-
(Comma separated string) Which relations should be expanded in the
resulting orders.
schema:
type: string
tags:
- Customer
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
orders:
type: array
items:
$ref: ../components/schemas/order.yaml
count:
type: integer
description: The total number of items available
offset:
type: integer
description: The number of items skipped before these items
limit:
type: integer
description: The number of items per page

View File

@@ -0,0 +1,31 @@
get:
operationId: GetCustomersCustomerPaymentMethods
summary: Retrieve saved payment methods
description: >-
Retrieves a list of a Customer's saved payment methods. Payment methods are
saved with Payment Providers and it is their responsibility to fetch saved
methods.
x-authenticated: true
tags:
- Customer
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
payment_methods:
type: array
items:
properties:
provider_id:
type: string
description: >-
The id of the Payment Provider where the payment method
is saved.
data:
type: object
description: >-
The data needed for the Payment Provider to use the
saved payment method.

View File

@@ -0,0 +1,37 @@
post:
operationId: PostCustomersResetPassword
summary: Resets Customer password
description: >-
Resets a Customer's password using a password token created by a previous
/password-token request.
requestBody:
content:
application/json:
schema:
required:
- email
- password
- token
properties:
email:
description: The email of the customer.
type: string
format: email
password:
description: The Customer's password.
type: string
format: password
token:
description: The reset password token
type: string
tags:
- Customer
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
customer:
$ref: ../components/schemas/customer.yaml

View File

@@ -0,0 +1,23 @@
post:
operationId: PostCustomersCustomerPasswordToken
summary: Creates a reset password token
description: >-
Creates a reset password token to be used in a subsequent /reset-password
request. The password token should be sent out of band e.g. via email and
will not be returned.
requestBody:
content:
application/json:
schema:
required:
- email
properties:
email:
description: The email of the customer.
type: string
format: email
tags:
- Customer
responses:
'204':
description: OK

View File

@@ -0,0 +1,22 @@
get:
operationId: GetGiftCardsCode
summary: Retrieve Gift Card by Code
description: Retrieves a Gift Card by its associated unqiue code.
parameters:
- in: path
name: code
required: true
description: The unique Gift Card code.
schema:
type: string
tags:
- Gift Card
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
gift_card:
$ref: ../components/schemas/gift_card.yaml

View File

@@ -0,0 +1,42 @@
get:
operationId: GetOrders
summary: Look Up an Order
description: Look up an order using filters.
parameters:
- in: query
name: display_id
required: true
description: The display id given to the Order.
schema:
type: number
- in: query
name: email
style: form
explode: false
description: The email associated with this order.
required: true
schema:
type: string
format: email
- in: query
name: shipping_address
style: form
explode: false
description: The shipping address associated with this order.
schema:
type: object
properties:
postal_code:
type: string
description: The postal code of the shipping address
tags:
- Order
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
order:
$ref: ../components/schemas/order.yaml

View File

@@ -0,0 +1,22 @@
get:
operationId: GetOrdersOrderCartId
summary: Retrieves Order by Cart id
description: Retrieves an Order by the id of the Cart that was used to create the Order.
parameters:
- in: path
name: cart_id
required: true
description: The ID of Cart.
schema:
type: string
tags:
- Order
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
order:
$ref: ../components/schemas/order.yaml

View File

@@ -0,0 +1,22 @@
get:
operationId: GetOrdersOrder
summary: Retrieves an Order
description: Retrieves an Order
parameters:
- in: path
name: id
required: true
description: The id of the Order.
schema:
type: string
tags:
- Order
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
order:
$ref: ../components/schemas/order.yaml

View File

@@ -0,0 +1,158 @@
get:
operationId: GetProducts
summary: List Products
description: Retrieves a list of Products.
parameters:
- in: query
name: q
description: >-
Query used for searching products by title, description, variant's
title, variant's sku, and collection's title
schema:
type: string
- in: query
name: id
style: form
explode: false
description: product IDs to search for.
schema:
oneOf:
- type: string
- type: array
items:
type: string
- in: query
name: collection_id
style: form
explode: false
description: Collection IDs to search for
schema:
type: array
items:
type: string
- in: query
name: tags
style: form
explode: false
description: Tag IDs to search for
schema:
type: array
items:
type: string
- in: query
name: title
description: title to search for.
schema:
type: string
- in: query
name: description
description: description to search for.
schema:
type: string
- in: query
name: handle
description: handle to search for.
schema:
type: string
- in: query
name: is_giftcard
description: Search for giftcards using is_giftcard=true.
schema:
type: boolean
- in: query
name: type
description: type to search for.
schema:
type: string
- in: query
name: created_at
description: Date comparison for when resulting products were created.
schema:
type: object
properties:
lt:
type: string
description: filter by dates less than this date
format: date
gt:
type: string
description: filter by dates greater than this date
format: date
lte:
type: string
description: filter by dates less than or equal to this date
format: date
gte:
type: string
description: filter by dates greater than or equal to this date
format: date
- in: query
name: updated_at
description: Date comparison for when resulting products were updated.
schema:
type: object
properties:
lt:
type: string
description: filter by dates less than this date
format: date
gt:
type: string
description: filter by dates greater than this date
format: date
lte:
type: string
description: filter by dates less than or equal to this date
format: date
gte:
type: string
description: filter by dates greater than or equal to this date
format: date
- in: query
name: offset
description: How many products to skip in the result.
schema:
type: integer
default: 0
- in: query
name: limit
description: Limit the number of products returned.
schema:
type: integer
default: 100
- in: query
name: expand
description: >-
(Comma separated) Which fields should be expanded in each order of the
result.
schema:
type: string
- in: query
name: fields
description: >-
(Comma separated) Which fields should be included in each order of the
result.
schema:
type: string
tags:
- Product
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
products:
type: array
items:
$ref: ../components/schemas/product.yaml
count:
type: integer
description: The total number of items available
offset:
type: integer
description: The number of items skipped before these items
limit:
type: integer
description: The number of items per page

View File

@@ -0,0 +1,35 @@
get:
operationId: GetProductsSearch
summary: Search Products
description: Run a search query on products using the search engine installed on Medusa
parameters:
- in: query
name: q
required: true
description: The query to run the search with.
schema:
type: string
- in: query
name: offset
description: How many products to skip in the result.
schema:
type: integer
- in: query
name: limit
description: Limit the number of products returned.
schema:
type: integer
tags:
- Product
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
hits:
type: array
description: >-
Array of results. The format of the items depends on the
search engine installed on the server.

View File

@@ -0,0 +1,22 @@
get:
operationId: GetProductsProduct
summary: Retrieves a Product
description: Retrieves a Product.
parameters:
- in: path
name: id
required: true
description: The id of the Product.
schema:
type: string
tags:
- Product
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
product:
$ref: ../components/schemas/product.yaml

View File

@@ -0,0 +1,74 @@
get:
operationId: GetRegions
summary: List Regions
description: Retrieves a list of Regions.
parameters:
- in: query
name: offset
description: How many regions to skip in the result.
schema:
type: integer
default: 0
- in: query
name: limit
description: Limit the number of regions returned.
schema:
type: integer
default: 100
- in: query
name: created_at
description: Date comparison for when resulting regions were created.
schema:
type: object
properties:
lt:
type: string
description: filter by dates less than this date
format: date
gt:
type: string
description: filter by dates greater than this date
format: date
lte:
type: string
description: filter by dates less than or equal to this date
format: date
gte:
type: string
description: filter by dates greater than or equal to this date
format: date
- in: query
name: updated_at
description: Date comparison for when resulting regions were updated.
schema:
type: object
properties:
lt:
type: string
description: filter by dates less than this date
format: date
gt:
type: string
description: filter by dates greater than this date
format: date
lte:
type: string
description: filter by dates less than or equal to this date
format: date
gte:
type: string
description: filter by dates greater than or equal to this date
format: date
tags:
- Region
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
regions:
type: array
items:
$ref: ../components/schemas/region.yaml

View File

@@ -0,0 +1,22 @@
get:
operationId: GetRegionsRegion
summary: Retrieves a Region
description: Retrieves a Region.
parameters:
- in: path
name: id
required: true
description: The id of the Region.
schema:
type: string
tags:
- Region
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
region:
$ref: ../components/schemas/region.yaml

View File

@@ -0,0 +1,17 @@
get:
operationId: GetReturnReasons
summary: List Return Reasons
description: Retrieves a list of Return Reasons.
tags:
- Return Reason
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
return_reasons:
type: array
items:
$ref: ../components/schemas/return_reason.yaml

View File

@@ -0,0 +1,22 @@
get:
operationId: GetReturnReasonsReason
summary: Retrieve a Return Reason
description: Retrieves a Return Reason.
parameters:
- in: path
name: id
required: true
description: The id of the Return Reason.
schema:
type: string
tags:
- Return Reason
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
return_reason:
$ref: ../components/schemas/return_reason.yaml

View File

@@ -0,0 +1,60 @@
post:
operationId: PostReturns
summary: Create Return
description: Creates a Return for an Order.
requestBody:
content:
application/json:
schema:
required:
- order_id
- items
properties:
order_id:
type: string
description: The ID of the Order to create the Return from.
items:
description: The items to include in the Return.
type: array
items:
required:
- item_id
- quantity
properties:
item_id:
description: The ID of the Line Item from the Order.
type: string
quantity:
description: The quantity to return.
type: integer
reason_id:
description: The ID of the return reason.
type: string
note:
description: A note to add to the item returned.
type: string
return_shipping:
description: >-
If the Return is to be handled by the store operator the
Customer can choose a Return Shipping Method. Alternatvely the
Customer can handle the Return themselves.
type: object
required:
- option_id
properties:
option_id:
type: string
description: >-
The ID of the Shipping Option to create the Shipping Method
from.
tags:
- Return
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
return:
$ref: ../components/schemas/return.yaml

View File

@@ -0,0 +1,35 @@
get:
operationId: GetShippingOptions
summary: Retrieve Shipping Options
description: Retrieves a list of Shipping Options.
parameters:
- in: query
name: is_return
description: >-
Whether return Shipping Options should be included. By default all
Shipping Options are returned.
schema:
type: boolean
- in: query
name: product_ids
description: A comma separated list of Product ids to filter Shipping Options by.
schema:
type: string
- in: query
name: region_id
description: the Region to retrieve Shipping Options from.
schema:
type: string
tags:
- Shipping Option
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
shipping_options:
type: array
items:
$ref: ../components/schemas/shipping_option.yaml

View File

@@ -0,0 +1,24 @@
get:
operationId: GetShippingOptionsCartId
summary: Retrieve Shipping Options for Cart
description: Retrieves a list of Shipping Options available to a cart.
parameters:
- in: path
name: cart_id
required: true
description: The id of the Cart.
schema:
type: string
tags:
- Shipping Option
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
shipping_options:
type: array
items:
$ref: ../components/schemas/shipping_option.yaml

View File

@@ -0,0 +1,68 @@
post:
operationId: PostSwaps
summary: Create a Swap
description: >-
Creates a Swap on an Order by providing some items to return along with some
items to send back
requestBody:
content:
application/json:
schema:
required:
- order_id
- return_items
- additional_items
properties:
order_id:
type: string
description: The ID of the Order to create the Swap for.
return_items:
description: The items to include in the Return.
type: array
items:
required:
- item_id
- quantity
properties:
item_id:
description: The ID of the Line Item from the Order.
type: string
quantity:
description: The quantity to swap.
type: integer
reason_id:
description: The ID of the reason of this return.
type: string
note:
description: The note to add to the item being swapped.
type: string
return_shipping_option:
type: string
description: >-
The ID of the Shipping Option to create the Shipping Method
from.
additional_items:
description: The items to exchange the returned items to.
type: array
items:
required:
- variant_id
- quantity
properties:
variant_id:
description: The ID of the Product Variant to send.
type: string
quantity:
description: The quantity to send of the variant.
type: integer
tags:
- Swap
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
swap:
$ref: ../components/schemas/swap.yaml

View File

@@ -0,0 +1,22 @@
get:
operationId: GetSwapsSwapCartId
summary: Retrieve Swap by Cart id
description: Retrieves a Swap by the id of the Cart used to confirm the Swap.
parameters:
- in: path
name: cart_id
required: true
description: The id of the Cart
schema:
type: string
tags:
- Swap
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
swap:
$ref: ../components/schemas/swap.yaml

View File

@@ -0,0 +1,77 @@
get:
operationId: GetVariants
summary: Retrieve Product Variants
description: Retrieves a list of Product Variants
parameters:
- in: query
name: ids
description: A comma separated list of Product Variant ids to filter by.
schema:
type: string
- in: query
name: expand
description: A comma separated list of Product Variant relations to load.
schema:
type: string
- in: query
name: offset
description: How many product variants to skip in the result.
schema:
type: number
default: '0'
- in: query
name: limit
description: Maximum number of Product Variants to return.
schema:
type: number
default: '100'
- in: query
name: title
style: form
explode: false
description: product variant title to search for.
schema:
oneOf:
- type: string
description: a single title to search by
- type: array
description: multiple titles to search by
items:
type: string
- in: query
name: inventory_quantity
description: Filter by available inventory quantity
schema:
oneOf:
- type: number
description: a specific number to search by.
- type: object
description: search using less and greater than comparisons.
properties:
lt:
type: number
description: filter by inventory quantity less than this number
gt:
type: number
description: filter by inventory quantity greater than this number
lte:
type: number
description: filter by inventory quantity less than or equal to this number
gte:
type: number
description: >-
filter by inventory quantity greater than or equal to this
number
tags:
- Product Variant
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
variants:
type: array
items:
$ref: ../components/schemas/product_variant.yaml

View File

@@ -0,0 +1,42 @@
get:
operationId: GetVariantsVariant
summary: Retrieve a Product Variant
description: Retrieves a Product Variant by id
parameters:
- in: path
name: variant_id
required: true
description: The id of the Product Variant.
schema:
type: string
- in: query
name: cart_id
description: The id of the Cart to set prices based on.
schema:
type: string
- in: query
name: region_id
description: The id of the Region to set prices based on.
schema:
type: string
- in: query
name: currency_code
style: form
explode: false
description: The 3 character ISO currency code to set prices based on.
schema:
type: string
externalDocs:
url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes
description: See a list of codes.
tags:
- Product Variant
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
variant:
$ref: ../components/schemas/product_variant.yaml