From e3305188bd2bfd17d19bf55457358ad90cf76007 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 22 Feb 2023 14:45:23 +0200 Subject: [PATCH] chore(docs): Generated API Reference (#3308) Co-authored-by: olivermrbl --- docs/api/admin-spec3.json | 9890 +++++++++-------- docs/api/admin-spec3.yaml | 4868 ++++---- docs/api/admin/components/schemas/Order.yaml | 7 + docs/api/admin/openapi.yaml | 80 +- docs/api/admin/paths/order_{id}_claims.yaml | 11 + .../paths/order_{id}_claims_{claim_id}.yaml | 11 + docs/api/admin/paths/order_{id}_swaps.yaml | 15 + docs/api/admin/paths/orders_{id}.yaml | 11 + docs/api/admin/paths/orders_{id}_archive.yaml | 11 + docs/api/admin/paths/orders_{id}_cancel.yaml | 11 + docs/api/admin/paths/orders_{id}_capture.yaml | 11 + .../orders_{id}_claims_{claim_id}_cancel.yaml | 11 + ...s_{id}_claims_{claim_id}_fulfillments.yaml | 11 + ..._fulfillments_{fulfillment_id}_cancel.yaml | 11 + ...ders_{id}_claims_{claim_id}_shipments.yaml | 11 + .../api/admin/paths/orders_{id}_complete.yaml | 11 + .../admin/paths/orders_{id}_fulfillment.yaml | 11 + ..._fulfillments_{fulfillment_id}_cancel.yaml | 11 + docs/api/admin/paths/orders_{id}_refund.yaml | 11 + docs/api/admin/paths/orders_{id}_return.yaml | 11 + .../api/admin/paths/orders_{id}_shipment.yaml | 11 + .../paths/orders_{id}_shipping-methods.yaml | 11 + .../orders_{id}_swaps_{swap_id}_cancel.yaml | 11 + ...ers_{id}_swaps_{swap_id}_fulfillments.yaml | 11 + ..._fulfillments_{fulfillment_id}_cancel.yaml | 11 + ..._{id}_swaps_{swap_id}_process-payment.yaml | 11 + ...orders_{id}_swaps_{swap_id}_shipments.yaml | 11 + docs/api/store-spec3.json | 1819 +-- docs/api/store-spec3.yaml | 367 +- docs/api/store/components/schemas/Order.yaml | 7 + docs/api/store/openapi.yaml | 12 +- 31 files changed, 9056 insertions(+), 8251 deletions(-) diff --git a/docs/api/admin-spec3.json b/docs/api/admin-spec3.json index 2eb1e5fa0c..b0470e23cc 100644 --- a/docs/api/admin-spec3.json +++ b/docs/api/admin-spec3.json @@ -1517,314 +1517,6 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - /customers: - post: - operationId: PostCustomers - summary: Create a Customer - description: Creates a Customer. - x-authenticated: true - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPostCustomersReq' - x-codegen: - method: create - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.customers.create({ - email: 'user@example.com', - first_name: 'Caterina', - last_name: 'Yost', - password: 'supersecret' - }) - - .then(({ customer }) => { - console.log(customer.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/customers' \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "email": "user@example.com", - "first_name": "Caterina", - "last_name": "Yost", - "password": "supersecret" - }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Customer - responses: - '201': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminCustomersRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - get: - operationId: GetCustomers - summary: List Customers - description: Retrieves a list of Customers. - x-authenticated: true - parameters: - - in: query - name: limit - description: The number of items to return. - schema: - type: integer - default: 50 - - in: query - name: offset - description: The items to skip before result. - schema: - type: integer - default: 0 - - in: query - name: expand - description: (Comma separated) Which fields should be expanded in each customer. - schema: - type: string - - in: query - name: q - description: 'a search term to search email, first_name, and last_name.' - schema: - type: string - x-codegen: - method: list - queryParams: AdminGetCustomersParams - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.customers.list() - - .then(({ customers, limit, offset, count }) => { - console.log(customers.length); - }); - - lang: Shell - label: cURL - source: > - curl --location --request GET - 'https://medusa-url.com/admin/customers' \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Customer - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminCustomersListRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - '/customers/{id}': - get: - operationId: GetCustomersCustomer - summary: Get a Customer - description: Retrieves a Customer. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Customer. - schema: - type: string - - in: query - name: expand - description: (Comma separated) Which fields should be expanded in the customer. - schema: - type: string - - in: query - name: fields - description: (Comma separated) Which fields should be included in the customer. - schema: - type: string - x-codegen: - method: retrieve - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.customers.retrieve(customer_id) - - .then(({ customer }) => { - console.log(customer.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request GET - 'https://medusa-url.com/admin/customers/{id}' \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Customer - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminCustomersRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - post: - operationId: PostCustomersCustomer - summary: Update a Customer - description: Updates a Customer. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Customer. - schema: - type: string - - in: query - name: expand - description: (Comma separated) Which fields should be expanded in each customer. - schema: - type: string - - in: query - name: fields - description: (Comma separated) Which fields should be retrieved in each customer. - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPostCustomersCustomerReq' - x-codegen: - method: update - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.customers.update(customer_id, { - first_name: 'Dolly' - }) - - .then(({ customer }) => { - console.log(customer.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/customers/{id}' \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "first_name": "Dolly" - }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Customer - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminCustomersRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' /currencies: get: operationId: GetCurrencies @@ -2660,6 +2352,314 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' + /customers: + post: + operationId: PostCustomers + summary: Create a Customer + description: Creates a Customer. + x-authenticated: true + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPostCustomersReq' + x-codegen: + method: create + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.customers.create({ + email: 'user@example.com', + first_name: 'Caterina', + last_name: 'Yost', + password: 'supersecret' + }) + + .then(({ customer }) => { + console.log(customer.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/customers' \ + + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "email": "user@example.com", + "first_name": "Caterina", + "last_name": "Yost", + "password": "supersecret" + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Customer + responses: + '201': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminCustomersRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + get: + operationId: GetCustomers + summary: List Customers + description: Retrieves a list of Customers. + x-authenticated: true + parameters: + - in: query + name: limit + description: The number of items to return. + schema: + type: integer + default: 50 + - in: query + name: offset + description: The items to skip before result. + schema: + type: integer + default: 0 + - in: query + name: expand + description: (Comma separated) Which fields should be expanded in each customer. + schema: + type: string + - in: query + name: q + description: 'a search term to search email, first_name, and last_name.' + schema: + type: string + x-codegen: + method: list + queryParams: AdminGetCustomersParams + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.customers.list() + + .then(({ customers, limit, offset, count }) => { + console.log(customers.length); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/admin/customers' \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminCustomersListRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + '/customers/{id}': + get: + operationId: GetCustomersCustomer + summary: Get a Customer + description: Retrieves a Customer. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Customer. + schema: + type: string + - in: query + name: expand + description: (Comma separated) Which fields should be expanded in the customer. + schema: + type: string + - in: query + name: fields + description: (Comma separated) Which fields should be included in the customer. + schema: + type: string + x-codegen: + method: retrieve + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.customers.retrieve(customer_id) + + .then(({ customer }) => { + console.log(customer.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/admin/customers/{id}' \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminCustomersRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + post: + operationId: PostCustomersCustomer + summary: Update a Customer + description: Updates a Customer. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Customer. + schema: + type: string + - in: query + name: expand + description: (Comma separated) Which fields should be expanded in each customer. + schema: + type: string + - in: query + name: fields + description: (Comma separated) Which fields should be retrieved in each customer. + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPostCustomersCustomerReq' + x-codegen: + method: update + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.customers.update(customer_id, { + first_name: 'Dolly' + }) + + .then(({ customer }) => { + console.log(customer.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/customers/{id}' \ + + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "first_name": "Dolly" + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminCustomersRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' '/discounts/{id}/regions/{region_id}': post: operationId: PostDiscountsDiscountRegionsRegion @@ -4007,348 +4007,6 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - /gift-cards: - post: - operationId: PostGiftCards - summary: Create a Gift Card - description: >- - Creates a Gift Card that can redeemed by its unique code. The Gift Card - is only valid within 1 region. - x-authenticated: true - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPostGiftCardsReq' - x-codegen: - method: create - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.giftCards.create({ - region_id - }) - - .then(({ gift_card }) => { - console.log(gift_card.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/gift-cards' \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "region_id": "{region_id}" - }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Gift Card - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminGiftCardsRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - get: - operationId: GetGiftCards - summary: List Gift Cards - description: Retrieves a list of Gift Cards. - x-authenticated: true - parameters: - - in: query - name: offset - description: The number of items to skip before the results. - schema: - type: number - default: '0' - - in: query - name: limit - description: Limit the number of items returned. - schema: - type: number - default: '50' - - in: query - name: q - description: a search term to search by code or display ID - schema: - type: string - x-codegen: - method: list - queryParams: AdminGetGiftCardsParams - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.giftCards.list() - - .then(({ gift_cards, limit, offset, count }) => { - console.log(gift_cards.length); - }); - - lang: Shell - label: cURL - source: > - curl --location --request GET - 'https://medusa-url.com/admin/gift-cards' \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Gift Card - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminGiftCardsListRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - '/gift-cards/{id}': - delete: - operationId: DeleteGiftCardsGiftCard - summary: Delete a Gift Card - description: Deletes a Gift Card - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Gift Card to delete. - schema: - type: string - x-codegen: - method: delete - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.giftCards.delete(gift_card_id) - - .then(({ id, object, deleted }) => { - console.log(id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request DELETE - 'https://medusa-url.com/admin/gift-cards/{id}' \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Gift Card - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminGiftCardsDeleteRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - get: - operationId: GetGiftCardsGiftCard - summary: Get a Gift Card - description: Retrieves a Gift Card. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Gift Card. - schema: - type: string - x-codegen: - method: retrieve - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.giftCards.retrieve(gift_card_id) - - .then(({ gift_card }) => { - console.log(gift_card.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request GET - 'https://medusa-url.com/admin/gift-cards/{id}' \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Gift Card - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminGiftCardsRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - post: - operationId: PostGiftCardsGiftCard - summary: Update a Gift Card - description: >- - Update a Gift Card that can redeemed by its unique code. The Gift Card - is only valid within 1 region. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Gift Card. - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPostGiftCardsGiftCardReq' - x-codegen: - method: update - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.giftCards.update(gift_card_id, { - region_id - }) - - .then(({ gift_card }) => { - console.log(gift_card.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/gift-cards/{id}' \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "region_id": "{region_id}" - }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Gift Card - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminGiftCardsRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' /draft-orders: post: operationId: PostDraftOrders @@ -5001,94 +4659,19 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - /invites/accept: + /gift-cards: post: - operationId: PostInvitesInviteAccept - summary: Accept an Invite - description: Accepts an Invite and creates a corresponding user - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPostInvitesInviteAcceptReq' - x-codegen: - method: accept - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.invites.accept({ - token, - user: { - first_name: 'Brigitte', - last_name: 'Collier', - password: 'supersecret' - } - }) - - .then(() => { - // successful - }) - - .catch(() => { - // an error occurred - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/invites/accept' \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "token": "{token}", - "user": { - "first_name": "Brigitte", - "last_name": "Collier", - "password": "supersecret" - } - }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Invite - responses: - '200': - description: OK - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - /invites: - post: - operationId: PostInvites - summary: Create an Invite - description: Creates an Invite and triggers an 'invite' created event + operationId: PostGiftCards + summary: Create a Gift Card + description: >- + Creates a Gift Card that can redeemed by its unique code. The Gift Card + is only valid within 1 region. x-authenticated: true requestBody: content: application/json: schema: - $ref: '#/components/schemas/AdminPostInvitesReq' + $ref: '#/components/schemas/AdminPostGiftCardsReq' x-codegen: method: create x-codeSamples: @@ -5102,40 +4685,38 @@ paths: // must be previously logged in or use api token - medusa.admin.invites.create({ - user: "user@example.com", - role: "admin" + medusa.admin.giftCards.create({ + region_id }) - .then(() => { - // successful - }) - - .catch(() => { - // an error occurred + .then(({ gift_card }) => { + console.log(gift_card.id); }); - lang: Shell label: cURL source: > curl --location --request POST - 'https://medusa-url.com/admin/invites' \ + 'https://medusa-url.com/admin/gift-cards' \ --header 'Authorization: Bearer {api_token}' \ --header 'Content-Type: application/json' \ --data-raw '{ - "user": "user@example.com", - "role": "admin" + "region_id": "{region_id}" }' security: - api_token: [] - cookie_auth: [] tags: - - Invite + - Gift Card responses: '200': description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminGiftCardsRes' '400': $ref: '#/components/responses/400_error' '401': @@ -5149,12 +4730,31 @@ paths: '500': $ref: '#/components/responses/500_error' get: - operationId: GetInvites - summary: Lists Invites - description: Lists all Invites + operationId: GetGiftCards + summary: List Gift Cards + description: Retrieves a list of Gift Cards. x-authenticated: true + parameters: + - in: query + name: offset + description: The number of items to skip before the results. + schema: + type: number + default: '0' + - in: query + name: limit + description: Limit the number of items returned. + schema: + type: number + default: '50' + - in: query + name: q + description: a search term to search by code or display ID + schema: + type: string x-codegen: method: list + queryParams: AdminGetGiftCardsParams x-codeSamples: - lang: JavaScript label: JS Client @@ -5166,30 +4766,30 @@ paths: // must be previously logged in or use api token - medusa.admin.invites.list() + medusa.admin.giftCards.list() - .then(({ invites }) => { - console.log(invites.length); + .then(({ gift_cards, limit, offset, count }) => { + console.log(gift_cards.length); }); - lang: Shell label: cURL source: > - curl --location --request GET 'https://medusa-url.com/admin/invites' - \ + curl --location --request GET + 'https://medusa-url.com/admin/gift-cards' \ --header 'Authorization: Bearer {api_token}' security: - api_token: [] - cookie_auth: [] tags: - - Invite + - Gift Card responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/AdminListInvitesRes' + $ref: '#/components/schemas/AdminGiftCardsListRes' '400': $ref: '#/components/responses/400_error' '401': @@ -5202,17 +4802,17 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - '/invites/{invite_id}': + '/gift-cards/{id}': delete: - operationId: DeleteInvitesInvite - summary: Delete an Invite - description: Deletes an Invite + operationId: DeleteGiftCardsGiftCard + summary: Delete a Gift Card + description: Deletes a Gift Card x-authenticated: true parameters: - in: path - name: invite_id + name: id required: true - description: The ID of the Invite + description: The ID of the Gift Card to delete. schema: type: string x-codegen: @@ -5228,7 +4828,7 @@ paths: // must be previously logged in or use api token - medusa.admin.invites.delete(invite_id) + medusa.admin.giftCards.delete(gift_card_id) .then(({ id, object, deleted }) => { console.log(id); @@ -5237,21 +4837,21 @@ paths: label: cURL source: > curl --location --request DELETE - 'https://medusa-url.com/admin/invites/{invite_id}' \ + 'https://medusa-url.com/admin/gift-cards/{id}' \ --header 'Authorization: Bearer {api_token}' security: - api_token: [] - cookie_auth: [] tags: - - Invite + - Gift Card responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/AdminInviteDeleteRes' + $ref: '#/components/schemas/AdminGiftCardsDeleteRes' '400': $ref: '#/components/responses/400_error' '401': @@ -5264,21 +4864,20 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - '/invites/{invite_id}/resend': - post: - operationId: PostInvitesInviteResend - summary: Resend an Invite - description: Resends an Invite by triggering the 'invite' created event again + get: + operationId: GetGiftCardsGiftCard + summary: Get a Gift Card + description: Retrieves a Gift Card. x-authenticated: true parameters: - in: path - name: invite_id + name: id required: true - description: The ID of the Invite + description: The ID of the Gift Card. schema: type: string x-codegen: - method: resend + method: retrieve x-codeSamples: - lang: JavaScript label: JS Client @@ -5290,30 +4889,106 @@ paths: // must be previously logged in or use api token - medusa.admin.invites.resend(invite_id) + medusa.admin.giftCards.retrieve(gift_card_id) - .then(() => { - // successful - }) - - .catch(() => { - // an error occurred + .then(({ gift_card }) => { + console.log(gift_card.id); }); - lang: Shell label: cURL source: > - curl --location --request POST - 'https://medusa-url.com/admin/invites/{invite_id}/resend' \ + curl --location --request GET + 'https://medusa-url.com/admin/gift-cards/{id}' \ --header 'Authorization: Bearer {api_token}' security: - api_token: [] - cookie_auth: [] tags: - - Invite + - Gift Card responses: '200': description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminGiftCardsRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + post: + operationId: PostGiftCardsGiftCard + summary: Update a Gift Card + description: >- + Update a Gift Card that can redeemed by its unique code. The Gift Card + is only valid within 1 region. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Gift Card. + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPostGiftCardsGiftCardReq' + x-codegen: + method: update + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.giftCards.update(gift_card_id, { + region_id + }) + + .then(({ gift_card }) => { + console.log(gift_card.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/gift-cards/{id}' \ + + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "region_id": "{region_id}" + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Gift Card + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminGiftCardsRes' '400': $ref: '#/components/responses/400_error' '401': @@ -6020,6 +5695,331 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' + /invites/accept: + post: + operationId: PostInvitesInviteAccept + summary: Accept an Invite + description: Accepts an Invite and creates a corresponding user + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPostInvitesInviteAcceptReq' + x-codegen: + method: accept + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.invites.accept({ + token, + user: { + first_name: 'Brigitte', + last_name: 'Collier', + password: 'supersecret' + } + }) + + .then(() => { + // successful + }) + + .catch(() => { + // an error occurred + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/invites/accept' \ + + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "token": "{token}", + "user": { + "first_name": "Brigitte", + "last_name": "Collier", + "password": "supersecret" + } + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Invite + responses: + '200': + description: OK + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + /invites: + post: + operationId: PostInvites + summary: Create an Invite + description: Creates an Invite and triggers an 'invite' created event + x-authenticated: true + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPostInvitesReq' + x-codegen: + method: create + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.invites.create({ + user: "user@example.com", + role: "admin" + }) + + .then(() => { + // successful + }) + + .catch(() => { + // an error occurred + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/invites' \ + + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "user": "user@example.com", + "role": "admin" + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Invite + responses: + '200': + description: OK + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + get: + operationId: GetInvites + summary: Lists Invites + description: Lists all Invites + x-authenticated: true + x-codegen: + method: list + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.invites.list() + + .then(({ invites }) => { + console.log(invites.length); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET 'https://medusa-url.com/admin/invites' + \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Invite + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminListInvitesRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + '/invites/{invite_id}': + delete: + operationId: DeleteInvitesInvite + summary: Delete an Invite + description: Deletes an Invite + x-authenticated: true + parameters: + - in: path + name: invite_id + required: true + description: The ID of the Invite + schema: + type: string + x-codegen: + method: delete + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.invites.delete(invite_id) + + .then(({ id, object, deleted }) => { + console.log(id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request DELETE + 'https://medusa-url.com/admin/invites/{invite_id}' \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Invite + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminInviteDeleteRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + '/invites/{invite_id}/resend': + post: + operationId: PostInvitesInviteResend + summary: Resend an Invite + description: Resends an Invite by triggering the 'invite' created event again + x-authenticated: true + parameters: + - in: path + name: invite_id + required: true + description: The ID of the Invite + schema: + type: string + x-codegen: + method: resend + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.invites.resend(invite_id) + + .then(() => { + // successful + }) + + .catch(() => { + // an error occurred + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/invites/{invite_id}/resend' \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Invite + responses: + '200': + description: OK + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' /notes: post: operationId: PostNotes @@ -7336,6 +7336,2492 @@ paths: $ref: '#/components/responses/not_found_error' '500': $ref: '#/components/responses/500_error' + '/orders/{id}/shipping-methods': + post: + operationId: PostOrdersOrderShippingMethods + summary: Add a Shipping Method + description: >- + Adds a Shipping Method to an Order. If another Shipping Method exists + with the same Shipping Profile, the previous Shipping Method will be + replaced. + parameters: + - in: path + name: id + required: true + description: The ID of the Order. + schema: + type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPostOrdersOrderShippingMethodsReq' + x-authenticated: true + x-codegen: + method: addShippingMethod + params: AdminPostOrdersOrderShippingMethodsParams + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.orders.addShippingMethod(order_id, { + price: 1000, + option_id + }) + + .then(({ order }) => { + console.log(order.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/orders/{id}/shipping-methods' \ + + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "price": 1000, + "option_id": "{option_id}" + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminOrdersRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + '/orders/{id}/archive': + post: + operationId: PostOrdersOrderArchive + summary: Archive Order + description: Archives the order with the given id. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order. + schema: + type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string + x-codegen: + method: archive + params: AdminPostOrdersOrderArchiveParams + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.orders.archive(order_id) + + .then(({ order }) => { + console.log(order.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/orders/{id}/archive' \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminOrdersRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + '/orders/{id}/claims/{claim_id}/cancel': + post: + operationId: PostOrdersClaimCancel + summary: Cancel a Claim + description: Cancels a Claim + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order. + schema: + type: string + - in: path + name: claim_id + required: true + description: The ID of the Claim. + schema: + type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string + x-codegen: + method: cancelClaim + params: AdminPostOrdersClaimCancel + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.orders.cancelClaim(order_id, claim_id) + + .then(({ order }) => { + console.log(order.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/orders/{id}/claims/{claim_id}/cancel' + \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Claim + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminOrdersRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + '/orders/{id}/claims/{claim_id}/fulfillments/{fulfillment_id}/cancel': + post: + operationId: PostOrdersClaimFulfillmentsCancel + summary: Cancel Claim Fulfillment + description: Registers a claim's fulfillment as canceled. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order which the Claim relates to. + schema: + type: string + - in: path + name: claim_id + required: true + description: The ID of the Claim which the Fulfillment relates to. + schema: + type: string + - in: path + name: fulfillment_id + required: true + description: The ID of the Fulfillment. + schema: + type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string + x-codegen: + method: cancelClaimFulfillment + params: AdminPostOrdersClaimFulfillmentsCancelParams + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.orders.cancelClaimFulfillment(order_id, claim_id, + fulfillment_id) + + .then(({ order }) => { + console.log(order.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/orders/{id}/claims/{claim_id}/fulfillments/{fulfillment_id}/cancel' + \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Fulfillment + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminOrdersRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + '/orders/{id}/swaps/{swap_id}/fulfillments/{fulfillment_id}/cancel': + post: + operationId: PostOrdersSwapFulfillmentsCancel + summary: Cancel Swap's Fulfilmment + description: Registers a Swap's Fulfillment as canceled. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order which the Swap relates to. + schema: + type: string + - in: path + name: swap_id + required: true + description: The ID of the Swap which the Fulfillment relates to. + schema: + type: string + - in: path + name: fulfillment_id + required: true + description: The ID of the Fulfillment. + schema: + type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string + x-codegen: + method: cancelSwapFulfillment + params: AdminPostOrdersSwapFulfillementsCancelParams + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.orders.cancelSwapFulfillment(order_id, swap_id, + fulfillment_id) + + .then(({ order }) => { + console.log(order.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/orders/{id}/swaps/{swap_id}/fulfillments/{fulfillment_id}/cancel' + \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Fulfillment + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminOrdersRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + '/orders/{id}/fulfillments/{fulfillment_id}/cancel': + post: + operationId: PostOrdersOrderFulfillmentsCancel + summary: Cancels a Fulfilmment + description: Registers a Fulfillment as canceled. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order which the Fulfillment relates to. + schema: + type: string + - in: path + name: fulfillment_id + required: true + description: The ID of the Fulfillment + schema: + type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string + x-codegen: + method: cancelFulfillment + params: AdminPostOrdersOrderFulfillementsCancelParams + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.orders.cancelFulfillment(order_id, fulfillment_id) + + .then(({ order }) => { + console.log(order.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/orders/{id}/fulfillments/{fulfillment_id}/cancel' + \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Fulfillment + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminOrdersRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + '/orders/{id}/cancel': + post: + operationId: PostOrdersOrderCancel + summary: Cancel an Order + description: >- + Registers an Order as canceled. This triggers a flow that will cancel + any created Fulfillments and Payments, may fail if the Payment or + Fulfillment Provider is unable to cancel the Payment/Fulfillment. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order. + schema: + type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string + x-codegen: + method: cancel + params: AdminPostOrdersOrderCancel + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.orders.cancel(order_id) + + .then(({ order }) => { + console.log(order.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/orders/{id}/cancel' \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminOrdersRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + '/orders/{id}/swaps/{swap_id}/cancel': + post: + operationId: PostOrdersSwapCancel + summary: Cancels a Swap + description: Cancels a Swap + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order. + schema: + type: string + - in: path + name: swap_id + required: true + description: The ID of the Swap. + schema: + type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string + x-codegen: + method: cancelSwap + params: AdminPostOrdersSwapCancelParams + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.orders.cancelSwap(order_id, swap_id) + + .then(({ order }) => { + console.log(order.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/orders/{order_id}/swaps/{swap_id}/cancel' + \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Swap + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminOrdersRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + '/orders/{id}/capture': + post: + operationId: PostOrdersOrderCapture + summary: Capture Order's Payment + description: Captures all the Payments associated with an Order. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order. + schema: + type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string + x-codegen: + method: capturePayment + params: AdminPostOrdersOrderCaptureParams + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.orders.capturePayment(order_id) + + .then(({ order }) => { + console.log(order.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/orders/{id}/capture' \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminOrdersRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + '/orders/{id}/complete': + post: + operationId: PostOrdersOrderComplete + summary: Complete an Order + description: Completes an Order + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order. + schema: + type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string + x-codegen: + method: complete + params: AdminPostOrdersOrderCompleteParams + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.orders.complete(order_id) + + .then(({ order }) => { + console.log(order.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/orders/{id}/complete' \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminOrdersRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + '/orders/{id}/claims/{claim_id}/shipments': + post: + operationId: PostOrdersOrderClaimsClaimShipments + summary: Create Claim Shipment + description: Registers a Claim Fulfillment as shipped. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order. + schema: + type: string + - in: path + name: claim_id + required: true + description: The ID of the Claim. + schema: + type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPostOrdersOrderClaimsClaimShipmentsReq' + x-codegen: + method: createClaimShipment + params: AdminPostOrdersOrderClaimsClaimShipmentsParams + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.orders.createClaimShipment(order_id, claim_id, { + fulfillment_id + }) + + .then(({ order }) => { + console.log(order.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/orders/{id}/claims/{claim_id}/shipments' + \ + + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "fulfillment_id": "{fulfillment_id}" + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Claim + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminOrdersRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + '/order/{id}/claims': + post: + operationId: PostOrdersOrderClaims + summary: Create a Claim + description: Creates a Claim. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order. + schema: + type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPostOrdersOrderClaimsReq' + x-codegen: + method: createClaim + params: AdminPostOrdersOrderClaimsParams + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.orders.createClaim(order_id, { + type: 'refund', + claim_items: [ + { + item_id, + quantity: 1 + } + ] + }) + + .then(({ order }) => { + console.log(order.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/orders/{id}/claims' \ + + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "type": "refund", + "claim_items": [ + { + "item_id": "asdsd", + "quantity": 1 + } + ] + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Claim + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminOrdersRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + '/orders/{id}/fulfillment': + post: + operationId: PostOrdersOrderFulfillments + summary: Create a Fulfillment + description: >- + Creates a Fulfillment of an Order - will notify Fulfillment Providers to + prepare a shipment. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order. + schema: + type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPostOrdersOrderFulfillmentsReq' + x-codegen: + method: createFulfillment + params: AdminPostOrdersOrderFulfillmentsParams + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.orders.createFulfillment(order_id, { + items: [ + { + item_id, + quantity: 1 + } + ] + }) + + .then(({ order }) => { + console.log(order.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/orders/{id}/fulfillment' \ + + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "items": [ + { + "item_id": "{item_id}", + "quantity": 1 + } + ] + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Fulfillment + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminOrdersRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + '/orders/{id}/line-items/{line_item_id}/reserve': + post: + operationId: PostOrdersOrderLineItemReservations + summary: Create a Reservation for a line item + description: >- + Creates a Reservation for a line item at a specified location, + optionally for a partial quantity. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order. + schema: + type: string + - in: path + name: line_item_id + required: true + description: The ID of the Line item. + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AdminOrdersOrderLineItemReservationReq' + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.orders.createReservation(order_id, line_item_id, { + location_id + }) + + .then(({ reservation }) => { + console.log(reservation.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/orders/{id}/line-items/{line_item_id}/reservations' + \ + + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "location_id": "loc_1" + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPostReservationsReq' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + '/orders/{id}/shipment': + post: + operationId: PostOrdersOrderShipment + summary: Create a Shipment + description: Registers a Fulfillment as shipped. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order. + schema: + type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPostOrdersOrderShipmentReq' + x-codegen: + method: createShipment + params: AdminPostOrdersOrderShipmentParams + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.orders.createShipment(order_id, { + fulfillment_id + }) + + .then(({ order }) => { + console.log(order.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/orders/{id}/shipment' \ + + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "fulfillment_id": "{fulfillment_id}" + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminOrdersRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + '/orders/{id}/swaps/{swap_id}/shipments': + post: + operationId: PostOrdersOrderSwapsSwapShipments + summary: Create Swap Shipment + description: Registers a Swap Fulfillment as shipped. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order. + schema: + type: string + - in: path + name: swap_id + required: true + description: The ID of the Swap. + schema: + type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPostOrdersOrderSwapsSwapShipmentsReq' + x-codegen: + method: createSwapShipment + params: AdminPostOrdersOrderSwapsSwapShipmentsParams + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.orders.createSwapShipment(order_id, swap_id, { + fulfillment_id + }) + + .then(({ order }) => { + console.log(order.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/orders/{id}/swaps/{swap_id}/shipments' + \ + + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "fulfillment_id": "{fulfillment_id}" + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Swap + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminOrdersRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + '/order/{id}/swaps': + post: + operationId: PostOrdersOrderSwaps + summary: Create a Swap + description: >- + Creates a Swap. Swaps are used to handle Return of previously purchased + goods and Fulfillment of replacements simultaneously. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order. + schema: + type: string + - in: query + name: expand + description: >- + (Comma separated) Which fields should be expanded the order of the + result. + schema: + type: string + - in: query + name: fields + description: >- + (Comma separated) Which fields should be included the order of the + result. + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPostOrdersOrderSwapsReq' + x-codegen: + method: createSwap + queryParams: AdminPostOrdersOrderSwapsParams + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.orders.createSwap(order_id, { + return_items: [ + { + item_id, + quantity: 1 + } + ] + }) + + .then(({ order }) => { + console.log(order.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/orders/{id}/swaps' \ + + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "return_items": [ + { + "item_id": "asfasf", + "quantity": 1 + } + ] + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Swap + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminOrdersRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + '/orders/{id}/claims/{claim_id}/fulfillments': + post: + operationId: PostOrdersOrderClaimsClaimFulfillments + summary: Create Claim Fulfillment + description: Creates a Fulfillment for a Claim. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order. + schema: + type: string + - in: path + name: claim_id + required: true + description: The ID of the Claim. + schema: + type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: >- + #/components/schemas/AdminPostOrdersOrderClaimsClaimFulfillmentsReq + x-codegen: + method: fulfillClaim + params: AdminPostOrdersOrderClaimsClaimFulfillmentsReq + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.orders.fulfillClaim(order_id, claim_id) + + .then(({ order }) => { + console.log(order.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/orders/{id}/claims/{claim_id}/fulfillments' + \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Fulfillment + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminOrdersRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + '/orders/{id}/swaps/{swap_id}/fulfillments': + post: + operationId: PostOrdersOrderSwapsSwapFulfillments + summary: Create Swap Fulfillment + description: Creates a Fulfillment for a Swap. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order. + schema: + type: string + - in: path + name: swap_id + required: true + description: The ID of the Swap. + schema: + type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: >- + #/components/schemas/AdminPostOrdersOrderSwapsSwapFulfillmentsReq + x-codegen: + method: fulfillSwap + params: AdminPostOrdersOrderSwapsSwapFulfillmentsParams + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.orders.fulfillSwap(order_id, swap_id) + + .then(({ order }) => { + console.log(order.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/orders/{id}/swaps/{swap_id}/fulfillments' + \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Fulfillment + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminOrdersRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + '/orders/{id}': + get: + operationId: GetOrdersOrder + summary: Get an Order + description: Retrieves an Order + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order. + schema: + type: string + - in: query + name: expand + description: Comma separated list of relations to include in the results. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the results. + schema: + type: string + x-codegen: + method: retrieve + queryParams: AdminGetOrdersOrderParams + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.orders.retrieve(order_id) + + .then(({ order }) => { + console.log(order.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/admin/orders/{id}' \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminOrdersRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + post: + operationId: PostOrdersOrder + summary: Update an Order + description: Updates and order + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order. + schema: + type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPostOrdersOrderReq' + x-codegen: + method: update + params: AdminPostOrdersOrderParams + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.orders.update(order_id, { + email: 'user@example.com' + }) + + .then(({ order }) => { + console.log(order.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/orders/adasda' \ + + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "email": "user@example.com" + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminOrdersRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + '/orders/{id}/reservations': + get: + operationId: GetOrdersOrderReservations + summary: Get reservations for an Order + description: Retrieves reservations for an Order + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order. + schema: + type: string + - in: query + name: offset + description: How many reservations to skip before the results. + schema: + type: integer + default: 0 + - in: query + name: limit + description: Limit the number of reservations returned. + schema: + type: integer + default: 20 + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.orders.retrieveReservations(order_id) + + .then(({ reservations }) => { + console.log(reservations[0].id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/admin/orders/{id}/reservations' \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminGetReservationReservationsReq' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + /orders: + get: + operationId: GetOrders + summary: List Orders + description: Retrieves a list of Orders + x-authenticated: true + parameters: + - in: query + name: q + description: >- + Query used for searching orders by shipping address first name, + orders' email, and orders' display ID + schema: + type: string + - in: query + name: id + description: ID of the order to search for. + schema: + type: string + - in: query + name: status + style: form + explode: false + description: Status to search for + schema: + type: array + items: + type: string + enum: + - pending + - completed + - archived + - canceled + - requires_action + - in: query + name: fulfillment_status + style: form + explode: false + description: Fulfillment status to search for. + schema: + type: array + items: + type: string + enum: + - not_fulfilled + - fulfilled + - partially_fulfilled + - shipped + - partially_shipped + - canceled + - returned + - partially_returned + - requires_action + - in: query + name: payment_status + style: form + explode: false + description: Payment status to search for. + schema: + type: array + items: + type: string + enum: + - captured + - awaiting + - not_paid + - refunded + - partially_refunded + - canceled + - requires_action + - in: query + name: display_id + description: Display ID to search for. + schema: + type: string + - in: query + name: cart_id + description: to search for. + schema: + type: string + - in: query + name: customer_id + description: to search for. + schema: + type: string + - in: query + name: email + description: to search for. + schema: + type: string + - in: query + name: region_id + style: form + explode: false + description: Regions to search orders by + schema: + oneOf: + - type: string + description: ID of a Region. + - type: array + items: + type: string + description: ID of a Region. + - in: query + name: currency_code + style: form + explode: false + description: Currency code to search for + schema: + type: string + externalDocs: + url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes' + description: See a list of codes. + - in: query + name: tax_rate + description: to search for. + schema: + type: string + - in: query + name: created_at + description: Date comparison for when resulting orders 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 orders 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: canceled_at + description: Date comparison for when resulting orders were canceled. + 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: sales_channel_id + style: form + explode: false + description: Filter by Sales Channels + schema: + type: array + items: + type: string + description: The ID of a Sales Channel + - in: query + name: offset + description: How many orders to skip before the results. + schema: + type: integer + default: 0 + - in: query + name: limit + description: Limit the number of orders returned. + schema: + type: integer + default: 50 + - 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 + x-codegen: + method: list + queryParams: AdminGetOrdersParams + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.orders.list() + + .then(({ orders, limit, offset, count }) => { + console.log(orders.length); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET 'https://medusa-url.com/admin/orders' + \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminOrdersListRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + '/orders/{id}/swaps/{swap_id}/process-payment': + post: + operationId: PostOrdersOrderSwapsSwapProcessPayment + summary: Process Swap Payment + description: >- + When there are differences between the returned and shipped Products in + a Swap, the difference must be processed. Either a Refund will be issued + or a Payment will be captured. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order. + schema: + type: string + - in: path + name: swap_id + required: true + description: The ID of the Swap. + schema: + type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string + x-codegen: + method: processSwapPayment + params: AdminPostOrdersOrderSwapsSwapProcessPaymentParams + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.orders.processSwapPayment(order_id, swap_id) + + .then(({ order }) => { + console.log(order.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/orders/{id}/swaps/{swap_id}/process-payment' + \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Swap + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminOrdersRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + '/orders/{id}/refund': + post: + operationId: PostOrdersOrderRefunds + summary: Create a Refund + description: Issues a Refund. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order. + schema: + type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPostOrdersOrderRefundsReq' + x-codegen: + method: refundPayment + params: AdminPostOrdersOrderRefundsParams + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.orders.refundPayment(order_id, { + amount: 1000, + reason: 'Do not like it' + }) + + .then(({ order }) => { + console.log(order.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/orders/adasda/refund' \ + + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "amount": 1000, + "reason": "Do not like it" + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminOrdersRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + '/orders/{id}/return': + post: + operationId: PostOrdersOrderReturns + summary: Request a Return + description: >- + Requests a Return. If applicable a return label will be created and + other plugins notified. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order. + schema: + type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPostOrdersOrderReturnsReq' + x-codegen: + method: requestReturn + params: AdminPostOrdersOrderReturnsParams + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.orders.requestReturn(order_id, { + items: [ + { + item_id, + quantity: 1 + } + ] + }) + + .then(({ order }) => { + console.log(order.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/orders/{id}/return' \ + + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "items": [ + { + "item_id": "{item_id}", + "quantity": 1 + } + ] + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Return + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminOrdersRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + '/order/{id}/claims/{claim_id}': + post: + operationId: PostOrdersOrderClaimsClaim + summary: Update a Claim + description: Updates a Claim. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order. + schema: + type: string + - in: path + name: claim_id + required: true + description: The ID of the Claim. + schema: + type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPostOrdersOrderClaimsClaimReq' + x-codegen: + method: updateClaim + params: AdminPostOrdersOrderClaimsClaimParams + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.orders.updateClaim(order_id, claim_id, { + no_notification: true + }) + + .then(({ order }) => { + console.log(order.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/orders/{id}/claims/{claim_id}' \ + + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "no_notification": true + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Claim + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminOrdersRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' '/payment-collections/{id}': delete: operationId: DeletePaymentCollectionsPaymentCollection @@ -7798,2235 +10284,6 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - '/orders/{id}/shipping-methods': - post: - operationId: PostOrdersOrderShippingMethods - summary: Add a Shipping Method - description: >- - Adds a Shipping Method to an Order. If another Shipping Method exists - with the same Shipping Profile, the previous Shipping Method will be - replaced. - parameters: - - in: path - name: id - required: true - description: The ID of the Order. - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPostOrdersOrderShippingMethodsReq' - x-authenticated: true - x-codegen: - method: addShippingMethod - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.orders.addShippingMethod(order_id, { - price: 1000, - option_id - }) - - .then(({ order }) => { - console.log(order.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/orders/{id}/shipping-methods' \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "price": 1000, - "option_id": "{option_id}" - }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Order - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminOrdersRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - '/orders/{id}/archive': - post: - operationId: PostOrdersOrderArchive - summary: Archive Order - description: Archives the order with the given id. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Order. - schema: - type: string - x-codegen: - method: archive - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.orders.archive(order_id) - - .then(({ order }) => { - console.log(order.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/orders/{id}/archive' \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Order - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminOrdersRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - '/orders/{id}/claims/{claim_id}/cancel': - post: - operationId: PostOrdersClaimCancel - summary: Cancel a Claim - description: Cancels a Claim - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Order. - schema: - type: string - - in: path - name: claim_id - required: true - description: The ID of the Claim. - schema: - type: string - x-codegen: - method: cancelClaim - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.orders.cancelClaim(order_id, claim_id) - - .then(({ order }) => { - console.log(order.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/orders/{id}/claims/{claim_id}/cancel' - \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Claim - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminOrdersRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - '/orders/{id}/claims/{claim_id}/fulfillments/{fulfillment_id}/cancel': - post: - operationId: PostOrdersClaimFulfillmentsCancel - summary: Cancel Claim Fulfillment - description: Registers a claim's fulfillment as canceled. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Order which the Claim relates to. - schema: - type: string - - in: path - name: claim_id - required: true - description: The ID of the Claim which the Fulfillment relates to. - schema: - type: string - - in: path - name: fulfillment_id - required: true - description: The ID of the Fulfillment. - schema: - type: string - x-codegen: - method: cancelClaimFulfillment - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.orders.cancelClaimFulfillment(order_id, claim_id, - fulfillment_id) - - .then(({ order }) => { - console.log(order.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/orders/{id}/claims/{claim_id}/fulfillments/{fulfillment_id}/cancel' - \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Fulfillment - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminOrdersRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - '/orders/{id}/swaps/{swap_id}/fulfillments/{fulfillment_id}/cancel': - post: - operationId: PostOrdersSwapFulfillmentsCancel - summary: Cancel Swap's Fulfilmment - description: Registers a Swap's Fulfillment as canceled. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Order which the Swap relates to. - schema: - type: string - - in: path - name: swap_id - required: true - description: The ID of the Swap which the Fulfillment relates to. - schema: - type: string - - in: path - name: fulfillment_id - required: true - description: The ID of the Fulfillment. - schema: - type: string - x-codegen: - method: cancelSwapFulfillment - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.orders.cancelSwapFulfillment(order_id, swap_id, - fulfillment_id) - - .then(({ order }) => { - console.log(order.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/orders/{id}/swaps/{swap_id}/fulfillments/{fulfillment_id}/cancel' - \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Fulfillment - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminOrdersRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - '/orders/{id}/fulfillments/{fulfillment_id}/cancel': - post: - operationId: PostOrdersOrderFulfillmentsCancel - summary: Cancels a Fulfilmment - description: Registers a Fulfillment as canceled. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Order which the Fulfillment relates to. - schema: - type: string - - in: path - name: fulfillment_id - required: true - description: The ID of the Fulfillment - schema: - type: string - x-codegen: - method: cancelFulfillment - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.orders.cancelFulfillment(order_id, fulfillment_id) - - .then(({ order }) => { - console.log(order.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/orders/{id}/fulfillments/{fulfillment_id}/cancel' - \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Fulfillment - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminOrdersRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - '/orders/{id}/cancel': - post: - operationId: PostOrdersOrderCancel - summary: Cancel an Order - description: >- - Registers an Order as canceled. This triggers a flow that will cancel - any created Fulfillments and Payments, may fail if the Payment or - Fulfillment Provider is unable to cancel the Payment/Fulfillment. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Order. - schema: - type: string - x-codegen: - method: cancel - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.orders.cancel(order_id) - - .then(({ order }) => { - console.log(order.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/orders/{id}/cancel' \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Order - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminOrdersRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - '/orders/{id}/swaps/{swap_id}/cancel': - post: - operationId: PostOrdersSwapCancel - summary: Cancels a Swap - description: Cancels a Swap - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Order. - schema: - type: string - - in: path - name: swap_id - required: true - description: The ID of the Swap. - schema: - type: string - x-codegen: - method: cancelSwap - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.orders.cancelSwap(order_id, swap_id) - - .then(({ order }) => { - console.log(order.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/orders/{order_id}/swaps/{swap_id}/cancel' - \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Swap - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminOrdersRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - '/orders/{id}/capture': - post: - operationId: PostOrdersOrderCapture - summary: Capture Order's Payment - description: Captures all the Payments associated with an Order. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Order. - schema: - type: string - x-codegen: - method: capturePayment - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.orders.capturePayment(order_id) - - .then(({ order }) => { - console.log(order.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/orders/{id}/capture' \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Order - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminOrdersRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - '/orders/{id}/complete': - post: - operationId: PostOrdersOrderComplete - summary: Complete an Order - description: Completes an Order - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Order. - schema: - type: string - x-codegen: - method: complete - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.orders.complete(order_id) - - .then(({ order }) => { - console.log(order.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/orders/{id}/complete' \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Order - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminOrdersRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - '/orders/{id}/claims/{claim_id}/shipments': - post: - operationId: PostOrdersOrderClaimsClaimShipments - summary: Create Claim Shipment - description: Registers a Claim Fulfillment as shipped. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Order. - schema: - type: string - - in: path - name: claim_id - required: true - description: The ID of the Claim. - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPostOrdersOrderClaimsClaimShipmentsReq' - x-codegen: - method: createClaimShipment - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.orders.createClaimShipment(order_id, claim_id, { - fulfillment_id - }) - - .then(({ order }) => { - console.log(order.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/orders/{id}/claims/{claim_id}/shipments' - \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "fulfillment_id": "{fulfillment_id}" - }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Claim - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminOrdersRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - '/order/{id}/claims': - post: - operationId: PostOrdersOrderClaims - summary: Create a Claim - description: Creates a Claim. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Order. - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPostOrdersOrderClaimsReq' - x-codegen: - method: createClaim - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.orders.createClaim(order_id, { - type: 'refund', - claim_items: [ - { - item_id, - quantity: 1 - } - ] - }) - - .then(({ order }) => { - console.log(order.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/orders/{id}/claims' \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "type": "refund", - "claim_items": [ - { - "item_id": "asdsd", - "quantity": 1 - } - ] - }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Claim - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminOrdersRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - '/orders/{id}/fulfillment': - post: - operationId: PostOrdersOrderFulfillments - summary: Create a Fulfillment - description: >- - Creates a Fulfillment of an Order - will notify Fulfillment Providers to - prepare a shipment. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Order. - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPostOrdersOrderFulfillmentsReq' - x-codegen: - method: createFulfillment - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.orders.createFulfillment(order_id, { - items: [ - { - item_id, - quantity: 1 - } - ] - }) - - .then(({ order }) => { - console.log(order.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/orders/{id}/fulfillment' \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "items": [ - { - "item_id": "{item_id}", - "quantity": 1 - } - ] - }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Fulfillment - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminOrdersRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - '/orders/{id}/line-items/{line_item_id}/reserve': - post: - operationId: PostOrdersOrderLineItemReservations - summary: Create a Reservation for a line item - description: >- - Creates a Reservation for a line item at a specified location, - optionally for a partial quantity. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Order. - schema: - type: string - - in: path - name: line_item_id - required: true - description: The ID of the Line item. - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AdminOrdersOrderLineItemReservationReq' - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.orders.createReservation(order_id, line_item_id, { - location_id - }) - - .then(({ reservation }) => { - console.log(reservation.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/orders/{id}/line-items/{line_item_id}/reservations' - \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "location_id": "loc_1" - }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Order - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPostReservationsReq' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - '/orders/{id}/shipment': - post: - operationId: PostOrdersOrderShipment - summary: Create a Shipment - description: Registers a Fulfillment as shipped. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Order. - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPostOrdersOrderShipmentReq' - x-codegen: - method: createShipment - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.orders.createShipment(order_id, { - fulfillment_id - }) - - .then(({ order }) => { - console.log(order.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/orders/{id}/shipment' \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "fulfillment_id": "{fulfillment_id}" - }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Order - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminOrdersRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - '/orders/{id}/swaps/{swap_id}/shipments': - post: - operationId: PostOrdersOrderSwapsSwapShipments - summary: Create Swap Shipment - description: Registers a Swap Fulfillment as shipped. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Order. - schema: - type: string - - in: path - name: swap_id - required: true - description: The ID of the Swap. - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPostOrdersOrderSwapsSwapShipmentsReq' - x-codegen: - method: createSwapShipment - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.orders.createSwapShipment(order_id, swap_id, { - fulfillment_id - }) - - .then(({ order }) => { - console.log(order.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/orders/{id}/swaps/{swap_id}/shipments' - \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "fulfillment_id": "{fulfillment_id}" - }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Swap - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminOrdersRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - '/order/{id}/swaps': - post: - operationId: PostOrdersOrderSwaps - summary: Create a Swap - description: >- - Creates a Swap. Swaps are used to handle Return of previously purchased - goods and Fulfillment of replacements simultaneously. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Order. - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPostOrdersOrderSwapsReq' - x-codegen: - method: createSwap - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.orders.createSwap(order_id, { - return_items: [ - { - item_id, - quantity: 1 - } - ] - }) - - .then(({ order }) => { - console.log(order.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/orders/{id}/swaps' \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "return_items": [ - { - "item_id": "asfasf", - "quantity": 1 - } - ] - }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Swap - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminOrdersRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - '/orders/{id}/claims/{claim_id}/fulfillments': - post: - operationId: PostOrdersOrderClaimsClaimFulfillments - summary: Create Claim Fulfillment - description: Creates a Fulfillment for a Claim. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Order. - schema: - type: string - - in: path - name: claim_id - required: true - description: The ID of the Claim. - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: >- - #/components/schemas/AdminPostOrdersOrderClaimsClaimFulfillmentsReq - x-codegen: - method: fulfillClaim - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.orders.fulfillClaim(order_id, claim_id) - - .then(({ order }) => { - console.log(order.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/orders/{id}/claims/{claim_id}/fulfillments' - \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Fulfillment - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminOrdersRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - '/orders/{id}/swaps/{swap_id}/fulfillments': - post: - operationId: PostOrdersOrderSwapsSwapFulfillments - summary: Create Swap Fulfillment - description: Creates a Fulfillment for a Swap. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Order. - schema: - type: string - - in: path - name: swap_id - required: true - description: The ID of the Swap. - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: >- - #/components/schemas/AdminPostOrdersOrderSwapsSwapFulfillmentsReq - x-codegen: - method: fulfillSwap - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.orders.fulfillSwap(order_id, swap_id) - - .then(({ order }) => { - console.log(order.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/orders/{id}/swaps/{swap_id}/fulfillments' - \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Fulfillment - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminOrdersRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - '/orders/{id}': - get: - operationId: GetOrdersOrder - summary: Get an Order - description: Retrieves an Order - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Order. - schema: - type: string - - in: query - name: expand - description: Comma separated list of relations to include in the results. - schema: - type: string - - in: query - name: fields - description: Comma separated list of fields to include in the results. - schema: - type: string - x-codegen: - method: retrieve - queryParams: AdminGetOrdersOrderParams - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.orders.retrieve(order_id) - - .then(({ order }) => { - console.log(order.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request GET - 'https://medusa-url.com/admin/orders/{id}' \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Order - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminOrdersRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - post: - operationId: PostOrdersOrder - summary: Update an Order - description: Updates and order - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Order. - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPostOrdersOrderReq' - x-codegen: - method: update - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.orders.update(order_id, { - email: 'user@example.com' - }) - - .then(({ order }) => { - console.log(order.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/orders/adasda' \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "email": "user@example.com" - }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Order - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminOrdersRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - '/orders/{id}/reservations': - get: - operationId: GetOrdersOrderReservations - summary: Get reservations for an Order - description: Retrieves reservations for an Order - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Order. - schema: - type: string - - in: query - name: offset - description: How many reservations to skip before the results. - schema: - type: integer - default: 0 - - in: query - name: limit - description: Limit the number of reservations returned. - schema: - type: integer - default: 20 - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.orders.retrieveReservations(order_id) - - .then(({ reservations }) => { - console.log(reservations[0].id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request GET - 'https://medusa-url.com/admin/orders/{id}/reservations' \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Order - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminGetReservationReservationsReq' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - /orders: - get: - operationId: GetOrders - summary: List Orders - description: Retrieves a list of Orders - x-authenticated: true - parameters: - - in: query - name: q - description: >- - Query used for searching orders by shipping address first name, - orders' email, and orders' display ID - schema: - type: string - - in: query - name: id - description: ID of the order to search for. - schema: - type: string - - in: query - name: status - style: form - explode: false - description: Status to search for - schema: - type: array - items: - type: string - enum: - - pending - - completed - - archived - - canceled - - requires_action - - in: query - name: fulfillment_status - style: form - explode: false - description: Fulfillment status to search for. - schema: - type: array - items: - type: string - enum: - - not_fulfilled - - fulfilled - - partially_fulfilled - - shipped - - partially_shipped - - canceled - - returned - - partially_returned - - requires_action - - in: query - name: payment_status - style: form - explode: false - description: Payment status to search for. - schema: - type: array - items: - type: string - enum: - - captured - - awaiting - - not_paid - - refunded - - partially_refunded - - canceled - - requires_action - - in: query - name: display_id - description: Display ID to search for. - schema: - type: string - - in: query - name: cart_id - description: to search for. - schema: - type: string - - in: query - name: customer_id - description: to search for. - schema: - type: string - - in: query - name: email - description: to search for. - schema: - type: string - - in: query - name: region_id - style: form - explode: false - description: Regions to search orders by - schema: - oneOf: - - type: string - description: ID of a Region. - - type: array - items: - type: string - description: ID of a Region. - - in: query - name: currency_code - style: form - explode: false - description: Currency code to search for - schema: - type: string - externalDocs: - url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes' - description: See a list of codes. - - in: query - name: tax_rate - description: to search for. - schema: - type: string - - in: query - name: created_at - description: Date comparison for when resulting orders 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 orders 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: canceled_at - description: Date comparison for when resulting orders were canceled. - 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: sales_channel_id - style: form - explode: false - description: Filter by Sales Channels - schema: - type: array - items: - type: string - description: The ID of a Sales Channel - - in: query - name: offset - description: How many orders to skip before the results. - schema: - type: integer - default: 0 - - in: query - name: limit - description: Limit the number of orders returned. - schema: - type: integer - default: 50 - - 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 - x-codegen: - method: list - queryParams: AdminGetOrdersParams - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.orders.list() - - .then(({ orders, limit, offset, count }) => { - console.log(orders.length); - }); - - lang: Shell - label: cURL - source: > - curl --location --request GET 'https://medusa-url.com/admin/orders' - \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Order - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminOrdersListRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - '/orders/{id}/swaps/{swap_id}/process-payment': - post: - operationId: PostOrdersOrderSwapsSwapProcessPayment - summary: Process Swap Payment - description: >- - When there are differences between the returned and shipped Products in - a Swap, the difference must be processed. Either a Refund will be issued - or a Payment will be captured. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Order. - schema: - type: string - - in: path - name: swap_id - required: true - description: The ID of the Swap. - schema: - type: string - x-codegen: - method: processSwapPayment - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.orders.processSwapPayment(order_id, swap_id) - - .then(({ order }) => { - console.log(order.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/orders/{id}/swaps/{swap_id}/process-payment' - \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Swap - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminOrdersRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - '/orders/{id}/refund': - post: - operationId: PostOrdersOrderRefunds - summary: Create a Refund - description: Issues a Refund. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Order. - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPostOrdersOrderRefundsReq' - x-codegen: - method: refundPayment - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.orders.refundPayment(order_id, { - amount: 1000, - reason: 'Do not like it' - }) - - .then(({ order }) => { - console.log(order.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/orders/adasda/refund' \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "amount": 1000, - "reason": "Do not like it" - }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Order - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminOrdersRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - '/orders/{id}/return': - post: - operationId: PostOrdersOrderReturns - summary: Request a Return - description: >- - Requests a Return. If applicable a return label will be created and - other plugins notified. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Order. - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPostOrdersOrderReturnsReq' - x-codegen: - method: requestReturn - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.orders.requestReturn(order_id, { - items: [ - { - item_id, - quantity: 1 - } - ] - }) - - .then(({ order }) => { - console.log(order.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/orders/{id}/return' \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "items": [ - { - "item_id": "{item_id}", - "quantity": 1 - } - ] - }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Return - - Order - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminOrdersRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - '/order/{id}/claims/{claim_id}': - post: - operationId: PostOrdersOrderClaimsClaim - summary: Update a Claim - description: Updates a Claim. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Order. - schema: - type: string - - in: path - name: claim_id - required: true - description: The ID of the Claim. - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPostOrdersOrderClaimsClaimReq' - x-codegen: - method: updateClaim - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.orders.updateClaim(order_id, claim_id, { - no_notification: true - }) - - .then(({ order }) => { - console.log(order.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/orders/{id}/claims/{claim_id}' \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "no_notification": true - }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Claim - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminOrdersRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' '/price-lists/{id}/prices/batch': post: operationId: PostPriceListsPriceListPricesBatch @@ -11048,6 +11305,604 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' + '/product-categories/{id}/products/batch': + post: + operationId: PostProductCategoriesCategoryProductsBatch + summary: Add Products to a category + description: Assign a batch of products to a product category. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Product Category. + schema: + type: string + - in: query + name: expand + description: (Comma separated) Category fields to be expanded in the response. + schema: + type: string + - in: query + name: fields + description: (Comma separated) Category fields to be retrieved in the response. + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: >- + #/components/schemas/AdminPostProductCategoriesCategoryProductsBatchReq + x-codegen: + method: addProducts + queryParams: AdminPostProductCategoriesCategoryProductsBatchParams + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.productCategories.addProducts(product_category_id, { + product_ids: [ + { + id: product_id + } + ] + }) + + .then(({ product_category }) => { + console.log(product_category.id); + }); + - lang: Shell + label: cURL + source: > + curl --location \ + + --request POST + 'https://medusa-url.com/admin/product-categories/{product_category_id}/products/batch' + \ + + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "product_ids": [ + { + "id": "{product_id}" + } + ] + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Product Category + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminProductCategoriesCategoryRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + delete: + operationId: DeleteProductCategoriesCategoryProductsBatch + summary: Delete Products + description: Remove a list of products from a product category. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Product Category. + schema: + type: string + - in: query + name: expand + description: (Comma separated) Category fields to be expanded in the response. + schema: + type: string + - in: query + name: fields + description: (Comma separated) Category fields to be retrieved in the response. + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: >- + #/components/schemas/AdminDeleteProductCategoriesCategoryProductsBatchReq + x-codegen: + method: removeProducts + queryParams: AdminDeleteProductCategoriesCategoryProductsBatchParams + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.productCategories.removeProducts(product_category_id, { + product_ids: [ + { + id: product_id + } + ] + }) + + .then(({ product_category }) => { + console.log(product_category.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request DELETE + 'https://medusa-url.com/admin/product-categories/{id}/products/batch' + \ + + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "product_ids": [ + { + "id": "{product_id}" + } + ] + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Product Category + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminProductCategoriesCategoryRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + /product-categories: + post: + operationId: PostProductCategories + summary: Create a Product Category + description: Creates a Product Category. + x-authenticated: true + parameters: + - in: query + name: expand + description: (Comma separated) Which fields should be expanded in the results. + schema: + type: string + - in: query + name: fields + description: (Comma separated) Which fields should be retrieved in the results. + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPostProductCategoriesReq' + x-codegen: + method: create + queryParams: AdminPostProductCategoriesParams + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.productCategories.create({ + name: "Skinny Jeans", + }) + + .then(({ product_category }) => { + console.log(product_category.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/product-categories' \ + + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "name": "Skinny Jeans", + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Product Category + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminProductCategoriesCategoryRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + get: + operationId: GetProductCategories + summary: List Product Categories + description: Retrieve a list of product categories. + x-authenticated: true + parameters: + - in: query + name: q + description: Query used for searching product category names orhandles. + schema: + type: string + - in: query + name: is_internal + description: Search for only internal categories. + schema: + type: boolean + - in: query + name: is_active + description: Search for only active categories + schema: + type: boolean + - in: query + name: parent_category_id + description: Returns categories scoped by parent + schema: + type: string + - in: query + name: offset + description: How many product categories to skip in the result. + schema: + type: integer + default: 0 + - in: query + name: limit + description: Limit the number of product categories returned. + schema: + type: integer + default: 100 + - in: query + name: expand + description: >- + (Comma separated) Which fields should be expanded in the product + category. + schema: + type: string + - in: query + name: fields + description: >- + (Comma separated) Which fields should be included in the product + category. + schema: + type: string + x-codegen: + method: list + queryParams: AdminGetProductCategoriesParams + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.productCategories.list() + + .then(({ product_categories, limit, offset, count }) => { + console.log(product_categories.length); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/admin/product-categories' \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Product Category + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminProductCategoriesListRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + '/product-categories/{id}': + delete: + operationId: DeleteProductCategoriesCategory + summary: Delete a Product Category + description: Deletes a ProductCategory. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Product Category + schema: + type: string + x-codegen: + method: delete + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.productCategories.delete(product_category_id) + + .then(({ id, object, deleted }) => { + console.log(id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request DELETE + 'https://medusa-url.com/admin/product-categories/{id}' \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Product Category + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminProductCategoriesCategoryDeleteRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + get: + operationId: GetProductCategoriesCategory + summary: Get a Product Category + description: Retrieves a Product Category. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Product Category + schema: + type: string + - in: query + name: expand + description: (Comma separated) Which fields should be expanded in the results. + schema: + type: string + - in: query + name: fields + description: (Comma separated) Which fields should be included in the results. + schema: + type: string + x-codegen: + method: retrieve + queryParams: AdminGetProductCategoryParams + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.productCategories.retrieve(product_category_id) + + .then(({ product_category }) => { + console.log(product_category.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/admin/product-categories/{id}' \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Product Category + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminProductCategoriesCategoryRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + post: + operationId: PostProductCategoriesCategory + summary: Update a Product Category + description: Updates a Product Category. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Product Category. + schema: + type: string + - in: query + name: expand + description: >- + (Comma separated) Which fields should be expanded in each product + category. + schema: + type: string + - in: query + name: fields + description: >- + (Comma separated) Which fields should be retrieved in each product + category. + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPostProductCategoriesCategoryReq' + x-codegen: + method: update + queryParams: AdminPostProductCategoriesCategoryParams + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.productCategories.update(product_category_id, { + name: "Skinny Jeans" + }) + + .then(({ product_category }) => { + console.log(product_category.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/product-categories/{id}' \ + + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "name": "Skinny Jeans" + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Product Category + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminProductCategoriesCategoryRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' /product-tags: get: operationId: GetProductTags @@ -12633,604 +13488,6 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - '/product-categories/{id}/products/batch': - post: - operationId: PostProductCategoriesCategoryProductsBatch - summary: Add Products to a category - description: Assign a batch of products to a product category. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Product Category. - schema: - type: string - - in: query - name: expand - description: (Comma separated) Category fields to be expanded in the response. - schema: - type: string - - in: query - name: fields - description: (Comma separated) Category fields to be retrieved in the response. - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: >- - #/components/schemas/AdminPostProductCategoriesCategoryProductsBatchReq - x-codegen: - method: addProducts - queryParams: AdminPostProductCategoriesCategoryProductsBatchParams - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.productCategories.addProducts(product_category_id, { - product_ids: [ - { - id: product_id - } - ] - }) - - .then(({ product_category }) => { - console.log(product_category.id); - }); - - lang: Shell - label: cURL - source: > - curl --location \ - - --request POST - 'https://medusa-url.com/admin/product-categories/{product_category_id}/products/batch' - \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "product_ids": [ - { - "id": "{product_id}" - } - ] - }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Product Category - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminProductCategoriesCategoryRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - delete: - operationId: DeleteProductCategoriesCategoryProductsBatch - summary: Delete Products - description: Remove a list of products from a product category. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Product Category. - schema: - type: string - - in: query - name: expand - description: (Comma separated) Category fields to be expanded in the response. - schema: - type: string - - in: query - name: fields - description: (Comma separated) Category fields to be retrieved in the response. - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: >- - #/components/schemas/AdminDeleteProductCategoriesCategoryProductsBatchReq - x-codegen: - method: removeProducts - queryParams: AdminDeleteProductCategoriesCategoryProductsBatchParams - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.productCategories.removeProducts(product_category_id, { - product_ids: [ - { - id: product_id - } - ] - }) - - .then(({ product_category }) => { - console.log(product_category.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request DELETE - 'https://medusa-url.com/admin/product-categories/{id}/products/batch' - \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "product_ids": [ - { - "id": "{product_id}" - } - ] - }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Product Category - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminProductCategoriesCategoryRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - /product-categories: - post: - operationId: PostProductCategories - summary: Create a Product Category - description: Creates a Product Category. - x-authenticated: true - parameters: - - in: query - name: expand - description: (Comma separated) Which fields should be expanded in the results. - schema: - type: string - - in: query - name: fields - description: (Comma separated) Which fields should be retrieved in the results. - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPostProductCategoriesReq' - x-codegen: - method: create - queryParams: AdminPostProductCategoriesParams - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.productCategories.create({ - name: "Skinny Jeans", - }) - - .then(({ product_category }) => { - console.log(product_category.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/product-categories' \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "name": "Skinny Jeans", - }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Product Category - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminProductCategoriesCategoryRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - get: - operationId: GetProductCategories - summary: List Product Categories - description: Retrieve a list of product categories. - x-authenticated: true - parameters: - - in: query - name: q - description: Query used for searching product category names orhandles. - schema: - type: string - - in: query - name: is_internal - description: Search for only internal categories. - schema: - type: boolean - - in: query - name: is_active - description: Search for only active categories - schema: - type: boolean - - in: query - name: parent_category_id - description: Returns categories scoped by parent - schema: - type: string - - in: query - name: offset - description: How many product categories to skip in the result. - schema: - type: integer - default: 0 - - in: query - name: limit - description: Limit the number of product categories returned. - schema: - type: integer - default: 100 - - in: query - name: expand - description: >- - (Comma separated) Which fields should be expanded in the product - category. - schema: - type: string - - in: query - name: fields - description: >- - (Comma separated) Which fields should be included in the product - category. - schema: - type: string - x-codegen: - method: list - queryParams: AdminGetProductCategoriesParams - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.productCategories.list() - - .then(({ product_categories, limit, offset, count }) => { - console.log(product_categories.length); - }); - - lang: Shell - label: cURL - source: > - curl --location --request GET - 'https://medusa-url.com/admin/product-categories' \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Product Category - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminProductCategoriesListRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - '/product-categories/{id}': - delete: - operationId: DeleteProductCategoriesCategory - summary: Delete a Product Category - description: Deletes a ProductCategory. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Product Category - schema: - type: string - x-codegen: - method: delete - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.productCategories.delete(product_category_id) - - .then(({ id, object, deleted }) => { - console.log(id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request DELETE - 'https://medusa-url.com/admin/product-categories/{id}' \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Product Category - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminProductCategoriesCategoryDeleteRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - get: - operationId: GetProductCategoriesCategory - summary: Get a Product Category - description: Retrieves a Product Category. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Product Category - schema: - type: string - - in: query - name: expand - description: (Comma separated) Which fields should be expanded in the results. - schema: - type: string - - in: query - name: fields - description: (Comma separated) Which fields should be included in the results. - schema: - type: string - x-codegen: - method: retrieve - queryParams: AdminGetProductCategoryParams - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.productCategories.retrieve(product_category_id) - - .then(({ product_category }) => { - console.log(product_category.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request GET - 'https://medusa-url.com/admin/product-categories/{id}' \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Product Category - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminProductCategoriesCategoryRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - post: - operationId: PostProductCategoriesCategory - summary: Update a Product Category - description: Updates a Product Category. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Product Category. - schema: - type: string - - in: query - name: expand - description: >- - (Comma separated) Which fields should be expanded in each product - category. - schema: - type: string - - in: query - name: fields - description: >- - (Comma separated) Which fields should be retrieved in each product - category. - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPostProductCategoriesCategoryReq' - x-codegen: - method: update - queryParams: AdminPostProductCategoriesCategoryParams - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.productCategories.update(product_category_id, { - name: "Skinny Jeans" - }) - - .then(({ product_category }) => { - console.log(product_category.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/product-categories/{id}' \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "name": "Skinny Jeans" - }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Product Category - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminProductCategoriesCategoryRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' '/publishable-api-keys/{id}/sales-channels/batch': post: operationId: PostPublishableApiKeySalesChannelsChannelsBatch @@ -13870,394 +14127,6 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - /reservations: - post: - operationId: PostReservations - summary: Creates a Reservation - description: >- - Creates a Reservation which can be associated with any resource as - required. - x-authenticated: true - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPostReservationsReq' - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.reservations.create({ - - }) - - .then(({ reservations }) => { - console.log(reservations.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/reservations' \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "resource_id": "{resource_id}", - "resource_type": "order", - "value": "We delivered this order" - }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Reservation - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPostReservationsReq' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - get: - operationId: GetReservations - summary: List Reservations - description: Retrieve a list of Reservations. - x-authenticated: true - parameters: - - in: query - name: location_id - style: form - explode: false - description: Location ids to search for. - schema: - type: array - items: - type: string - - in: query - name: inventory_item_id - style: form - explode: false - description: Inventory Item ids to search for. - schema: - type: array - items: - type: string - - in: query - name: line_item_id - style: form - explode: false - description: Line Item ids to search for. - schema: - type: array - items: - type: string - - in: query - name: quantity - description: Filter by reservation quantity - schema: - type: object - properties: - lt: - type: number - description: filter by reservation quantity less than this number - gt: - type: number - description: filter by reservation quantity greater than this number - lte: - type: number - description: >- - filter by reservation quantity less than or equal to this - number - gte: - type: number - description: >- - filter by reservation quantity greater than or equal to this - number - - in: query - name: offset - description: How many Reservations to skip in the result. - schema: - type: integer - default: 0 - - in: query - name: limit - description: Limit the number of Reservations returned. - schema: - type: integer - default: 20 - - in: query - name: expand - description: >- - (Comma separated) Which fields should be expanded in the product - category. - schema: - type: string - - in: query - name: fields - description: >- - (Comma separated) Which fields should be included in the product - category. - schema: - type: string - x-codeSamples: - - lang: Shell - label: cURL - source: > - curl --location --request GET - 'https://medusa-url.com/admin/product-categories' \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Product Category - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminGetReservationReservationsReq' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - '/reservations/{id}': - delete: - operationId: DeleteReservationsReservation - summary: Delete a Reservation - description: Deletes a Reservation. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Reservation to delete. - schema: - type: string - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.reservations.delete(reservation.id) - - .then(({ id, object, deleted }) => { - console.log(id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request DELETE - 'https://medusa-url.com/admin/reservations/{id}' \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Reservation - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - id: - type: string - description: The ID of the deleted Reservation. - object: - type: string - description: The type of the object that was deleted. - default: reservation - deleted: - type: boolean - description: Whether or not the Reservation was deleted. - default: true - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - get: - operationId: GetReservationsReservation - summary: Get a Reservation - description: Retrieves a single reservation using its id - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the reservation to retrieve. - schema: - type: string - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.reservations.retrieve(reservation_id) - - .then(({ reservation }) => { - console.log(reservation.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request GET - 'https://medusa-url.com/admin/reservations/{id}' \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Reservation - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPostReservationsReq' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - post: - operationId: PostReservationsReservation - summary: Updates a Reservation - description: >- - Updates a Reservation which can be associated with any resource as - required. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Reservation to update. - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPostReservationsReservationReq' - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.reservations.update(reservation.id, { - quantity: 3 - }) - - .then(({ reservations }) => { - console.log(reservations.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/reservations/{id}' \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "quantity": 3, - }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Reservation - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPostReservationsReq' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' '/regions/{id}/countries': post: operationId: PostRegionsRegionCountries @@ -15137,6 +15006,394 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' + /reservations: + post: + operationId: PostReservations + summary: Creates a Reservation + description: >- + Creates a Reservation which can be associated with any resource as + required. + x-authenticated: true + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPostReservationsReq' + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.reservations.create({ + + }) + + .then(({ reservations }) => { + console.log(reservations.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/reservations' \ + + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "resource_id": "{resource_id}", + "resource_type": "order", + "value": "We delivered this order" + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Reservation + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPostReservationsReq' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + get: + operationId: GetReservations + summary: List Reservations + description: Retrieve a list of Reservations. + x-authenticated: true + parameters: + - in: query + name: location_id + style: form + explode: false + description: Location ids to search for. + schema: + type: array + items: + type: string + - in: query + name: inventory_item_id + style: form + explode: false + description: Inventory Item ids to search for. + schema: + type: array + items: + type: string + - in: query + name: line_item_id + style: form + explode: false + description: Line Item ids to search for. + schema: + type: array + items: + type: string + - in: query + name: quantity + description: Filter by reservation quantity + schema: + type: object + properties: + lt: + type: number + description: filter by reservation quantity less than this number + gt: + type: number + description: filter by reservation quantity greater than this number + lte: + type: number + description: >- + filter by reservation quantity less than or equal to this + number + gte: + type: number + description: >- + filter by reservation quantity greater than or equal to this + number + - in: query + name: offset + description: How many Reservations to skip in the result. + schema: + type: integer + default: 0 + - in: query + name: limit + description: Limit the number of Reservations returned. + schema: + type: integer + default: 20 + - in: query + name: expand + description: >- + (Comma separated) Which fields should be expanded in the product + category. + schema: + type: string + - in: query + name: fields + description: >- + (Comma separated) Which fields should be included in the product + category. + schema: + type: string + x-codeSamples: + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/admin/product-categories' \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Product Category + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminGetReservationReservationsReq' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + '/reservations/{id}': + delete: + operationId: DeleteReservationsReservation + summary: Delete a Reservation + description: Deletes a Reservation. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Reservation to delete. + schema: + type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.reservations.delete(reservation.id) + + .then(({ id, object, deleted }) => { + console.log(id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request DELETE + 'https://medusa-url.com/admin/reservations/{id}' \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Reservation + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + id: + type: string + description: The ID of the deleted Reservation. + object: + type: string + description: The type of the object that was deleted. + default: reservation + deleted: + type: boolean + description: Whether or not the Reservation was deleted. + default: true + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + get: + operationId: GetReservationsReservation + summary: Get a Reservation + description: Retrieves a single reservation using its id + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the reservation to retrieve. + schema: + type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.reservations.retrieve(reservation_id) + + .then(({ reservation }) => { + console.log(reservation.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/admin/reservations/{id}' \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Reservation + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPostReservationsReq' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + post: + operationId: PostReservationsReservation + summary: Updates a Reservation + description: >- + Updates a Reservation which can be associated with any resource as + required. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Reservation to update. + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPostReservationsReservationReq' + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.reservations.update(reservation.id, { + quantity: 3 + }) + + .then(({ reservations }) => { + console.log(reservations.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/reservations/{id}' \ + + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "quantity": 3, + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Reservation + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPostReservationsReq' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' /return-reasons: post: operationId: PostReturnReasons @@ -15458,6 +15715,221 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' + '/returns/{id}/cancel': + post: + operationId: PostReturnsReturnCancel + summary: Cancel a Return + description: Registers a Return as canceled. + parameters: + - in: path + name: id + required: true + description: The ID of the Return. + schema: + type: string + x-codegen: + method: cancel + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.returns.cancel(return_id) + + .then(({ order }) => { + console.log(order.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/returns/{id}/cancel' \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Return + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminReturnsCancelRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + /returns: + get: + operationId: GetReturns + summary: List Returns + description: Retrieves a list of Returns + parameters: + - in: query + name: limit + description: The upper limit for the amount of responses returned. + schema: + type: number + default: '50' + - in: query + name: offset + description: The offset of the list returned. + schema: + type: number + default: '0' + x-codegen: + method: list + queryParams: AdminGetReturnsParams + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.returns.list() + + .then(({ returns, limit, offset, count }) => { + console.log(returns.length); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET 'https://medusa-url.com/admin/returns' + \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Return + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminReturnsListRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + '/returns/{id}/receive': + post: + operationId: PostReturnsReturnReceive + summary: Receive a Return + description: >- + Registers a Return as received. Updates statuses on Orders and Swaps + accordingly. + parameters: + - in: path + name: id + required: true + description: The ID of the Return. + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPostReturnsReturnReceiveReq' + x-codegen: + method: receive + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.returns.receive(return_id, { + items: [ + { + item_id, + quantity: 1 + } + ] + }) + + .then((data) => { + console.log(data.return.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/returns/{id}/receive' \ + + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "items": [ + { + "item_id": "asafg", + "quantity": 1 + } + ] + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Return + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminReturnsRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' '/sales-channels/{id}/products/batch': post: operationId: PostSalesChannelsChannelProductsBatch @@ -16215,221 +16687,6 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - '/returns/{id}/cancel': - post: - operationId: PostReturnsReturnCancel - summary: Cancel a Return - description: Registers a Return as canceled. - parameters: - - in: path - name: id - required: true - description: The ID of the Return. - schema: - type: string - x-codegen: - method: cancel - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.returns.cancel(return_id) - - .then(({ order }) => { - console.log(order.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/returns/{id}/cancel' \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Return - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminReturnsCancelRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - /returns: - get: - operationId: GetReturns - summary: List Returns - description: Retrieves a list of Returns - parameters: - - in: query - name: limit - description: The upper limit for the amount of responses returned. - schema: - type: number - default: '50' - - in: query - name: offset - description: The offset of the list returned. - schema: - type: number - default: '0' - x-codegen: - method: list - queryParams: AdminGetReturnsParams - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.returns.list() - - .then(({ returns, limit, offset, count }) => { - console.log(returns.length); - }); - - lang: Shell - label: cURL - source: > - curl --location --request GET 'https://medusa-url.com/admin/returns' - \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Return - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminReturnsListRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - '/returns/{id}/receive': - post: - operationId: PostReturnsReturnReceive - summary: Receive a Return - description: >- - Registers a Return as received. Updates statuses on Orders and Swaps - accordingly. - parameters: - - in: path - name: id - required: true - description: The ID of the Return. - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPostReturnsReturnReceiveReq' - x-codegen: - method: receive - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.returns.receive(return_id, { - items: [ - { - item_id, - quantity: 1 - } - ] - }) - - .then((data) => { - console.log(data.return.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/returns/{id}/receive' \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "items": [ - { - "item_id": "asafg", - "quantity": 1 - } - ] - }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Return - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminReturnsRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' /shipping-options: post: operationId: PostShippingOptions @@ -17553,135 +17810,6 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - '/swaps/{id}': - get: - operationId: GetSwapsSwap - summary: Get a Swap - description: Retrieves a Swap. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Swap. - schema: - type: string - x-codegen: - method: retrieve - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.swaps.retrieve(swap_id) - - .then(({ swap }) => { - console.log(swap.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request GET - 'https://medusa-url.com/admin/swaps/{id}' \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Swap - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminSwapsRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - /swaps: - get: - operationId: GetSwaps - summary: List Swaps - description: Retrieves a list of Swaps. - parameters: - - in: query - name: limit - description: The upper limit for the amount of responses returned. - schema: - type: number - default: '50' - - in: query - name: offset - description: The offset of the list returned. - schema: - type: number - default: '0' - x-authenticated: true - x-codegen: - method: list - queryParams: AdminGetSwapsParams - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.swaps.list() - - .then(({ swaps }) => { - console.log(swaps.length); - }); - - lang: Shell - label: cURL - source: | - curl --location --request GET 'https://medusa-url.com/admin/swaps' \ - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Swap - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminSwapsListRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' '/store/currencies/{code}': post: operationId: PostStoreCurrenciesCode @@ -18041,6 +18169,135 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' + '/swaps/{id}': + get: + operationId: GetSwapsSwap + summary: Get a Swap + description: Retrieves a Swap. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Swap. + schema: + type: string + x-codegen: + method: retrieve + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.swaps.retrieve(swap_id) + + .then(({ swap }) => { + console.log(swap.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/admin/swaps/{id}' \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Swap + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminSwapsRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + /swaps: + get: + operationId: GetSwaps + summary: List Swaps + description: Retrieves a list of Swaps. + parameters: + - in: query + name: limit + description: The upper limit for the amount of responses returned. + schema: + type: number + default: '50' + - in: query + name: offset + description: The offset of the list returned. + schema: + type: number + default: '0' + x-authenticated: true + x-codegen: + method: list + queryParams: AdminGetSwapsParams + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.swaps.list() + + .then(({ swaps }) => { + console.log(swaps.length); + }); + - lang: Shell + label: cURL + source: | + curl --location --request GET 'https://medusa-url.com/admin/swaps' \ + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Swap + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminSwapsListRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' '/tax-rates/{id}/product-types/batch': post: operationId: PostTaxRatesTaxRateProductTypes @@ -23794,6 +24051,13 @@ components: description: The total of gift cards with taxes type: integer example: 0 + returnable_items: + description: >- + The items that are returnable as part of the order, order swaps or + order claims + type: array + items: + $ref: '#/components/schemas/LineItem' created_at: description: The date with timezone at which the resource was created. type: string @@ -27478,89 +27742,6 @@ components: metadata: description: An optional set of key-value pairs to hold additional information. type: object - AdminPostCustomersReq: - type: object - required: - - email - - first_name - - last_name - - password - properties: - email: - type: string - description: The customer's email. - format: email - first_name: - type: string - description: The customer's first name. - last_name: - type: string - description: The customer's last name. - password: - type: string - description: The customer's password. - format: password - phone: - type: string - description: The customer's phone number. - metadata: - description: An optional set of key-value pairs to hold additional information. - type: object - AdminCustomersRes: - type: object - properties: - customer: - $ref: '#/components/schemas/Customer' - AdminCustomersListRes: - type: object - properties: - customers: - type: array - items: - $ref: '#/components/schemas/Customer' - 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 - AdminPostCustomersCustomerReq: - type: object - properties: - email: - type: string - description: The Customer's email. - format: email - first_name: - type: string - description: The Customer's first name. - last_name: - type: string - description: The Customer's last name. - phone: - type: string - description: The Customer's phone number. - password: - type: string - description: The Customer's password. - format: password - groups: - type: array - items: - type: object - required: - - id - properties: - id: - description: The ID of a customer group - type: string - description: A list of customer groups to which the customer belongs. - metadata: - description: An optional set of key-value pairs to hold additional information. - type: object AdminCurrenciesListRes: type: object properties: @@ -27675,6 +27856,89 @@ components: metadata: description: Metadata for the customer. type: object + AdminPostCustomersReq: + type: object + required: + - email + - first_name + - last_name + - password + properties: + email: + type: string + description: The customer's email. + format: email + first_name: + type: string + description: The customer's first name. + last_name: + type: string + description: The customer's last name. + password: + type: string + description: The customer's password. + format: password + phone: + type: string + description: The customer's phone number. + metadata: + description: An optional set of key-value pairs to hold additional information. + type: object + AdminCustomersRes: + type: object + properties: + customer: + $ref: '#/components/schemas/Customer' + AdminCustomersListRes: + type: object + properties: + customers: + type: array + items: + $ref: '#/components/schemas/Customer' + 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 + AdminPostCustomersCustomerReq: + type: object + properties: + email: + type: string + description: The Customer's email. + format: email + first_name: + type: string + description: The Customer's first name. + last_name: + type: string + description: The Customer's last name. + phone: + type: string + description: The Customer's phone number. + password: + type: string + description: The Customer's password. + format: password + groups: + type: array + items: + type: object + required: + - id + properties: + id: + description: The ID of a customer group + type: string + description: A list of customer groups to which the customer belongs. + metadata: + description: An optional set of key-value pairs to hold additional information. + type: object AdminPostDiscountsDiscountConditionsConditionBatchReq: type: object required: @@ -28103,85 +28367,6 @@ components: metadata: description: An object containing metadata of the discount type: object - AdminPostGiftCardsReq: - type: object - required: - - region_id - properties: - value: - type: integer - description: The value (excluding VAT) that the Gift Card should represent. - is_disabled: - type: boolean - description: >- - Whether the Gift Card is disabled on creation. You will have to - enable it later to make it available to Customers. - ends_at: - type: string - format: date-time - description: The time at which the Gift Card should no longer be available. - region_id: - description: The ID of the Region in which the Gift Card can be used. - type: string - metadata: - description: An optional set of key-value pairs to hold additional information. - type: object - AdminGiftCardsRes: - type: object - properties: - gift_card: - $ref: '#/components/schemas/GiftCard' - AdminGiftCardsDeleteRes: - type: object - properties: - id: - type: string - description: The ID of the deleted Gift Card - object: - type: string - description: The type of the object that was deleted. - default: gift-card - deleted: - type: boolean - description: Whether the gift card was deleted successfully or not. - default: true - AdminGiftCardsListRes: - type: object - properties: - gift_cards: - type: array - items: - $ref: '#/components/schemas/GiftCard' - 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 - AdminPostGiftCardsGiftCardReq: - type: object - properties: - balance: - type: integer - description: The value (excluding VAT) that the Gift Card should represent. - is_disabled: - type: boolean - description: >- - Whether the Gift Card is disabled on creation. You will have to - enable it later to make it available to Customers. - ends_at: - type: string - format: date-time - description: The time at which the Gift Card should no longer be available. - region_id: - description: The ID of the Region in which the Gift Card can be used. - type: string - metadata: - description: An optional set of key-value pairs to hold additional information. - type: object AdminPostDraftOrdersReq: type: object required: @@ -28404,71 +28589,85 @@ components: The optional key-value map with additional details about the Line Item. type: object - AdminPostInvitesInviteAcceptReq: + AdminPostGiftCardsReq: type: object required: - - token - - user + - region_id properties: - token: - description: The invite token provided by the admin. + value: + type: integer + description: The value (excluding VAT) that the Gift Card should represent. + is_disabled: + type: boolean + description: >- + Whether the Gift Card is disabled on creation. You will have to + enable it later to make it available to Customers. + ends_at: type: string - user: - description: The User to create. + format: date-time + description: The time at which the Gift Card should no longer be available. + region_id: + description: The ID of the Region in which the Gift Card can be used. + type: string + metadata: + description: An optional set of key-value pairs to hold additional information. type: object - required: - - first_name - - last_name - - password - properties: - first_name: - type: string - description: the first name of the User - last_name: - type: string - description: the last name of the User - password: - description: The desired password for the User - type: string - format: password - AdminPostInvitesReq: + AdminGiftCardsRes: type: object - required: - - user - - role properties: - user: - description: The email for the user to be created. - type: string - format: email - role: - description: The role of the user to be created. - type: string - enum: - - admin - - member - - developer - AdminInviteDeleteRes: + gift_card: + $ref: '#/components/schemas/GiftCard' + AdminGiftCardsDeleteRes: type: object properties: id: type: string - description: The ID of the deleted Invite. + description: The ID of the deleted Gift Card object: type: string description: The type of the object that was deleted. - default: invite + default: gift-card deleted: type: boolean - description: Whether or not the Invite was deleted. + description: Whether the gift card was deleted successfully or not. default: true - AdminListInvitesRes: + AdminGiftCardsListRes: type: object properties: - invites: + gift_cards: type: array items: - $ref: '#/components/schemas/Invite' + $ref: '#/components/schemas/GiftCard' + 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 + AdminPostGiftCardsGiftCardReq: + type: object + properties: + balance: + type: integer + description: The value (excluding VAT) that the Gift Card should represent. + is_disabled: + type: boolean + description: >- + Whether the Gift Card is disabled on creation. You will have to + enable it later to make it available to Customers. + ends_at: + type: string + format: date-time + description: The time at which the Gift Card should no longer be available. + region_id: + description: The ID of the Region in which the Gift Card can be used. + type: string + metadata: + description: An optional set of key-value pairs to hold additional information. + type: object AdminPostInventoryItemsItemLocationLevelsReq: type: object required: @@ -28623,6 +28822,71 @@ components: the incoming stock quantity of an inventory item at the given location ID type: number + AdminPostInvitesInviteAcceptReq: + type: object + required: + - token + - user + properties: + token: + description: The invite token provided by the admin. + type: string + user: + description: The User to create. + type: object + required: + - first_name + - last_name + - password + properties: + first_name: + type: string + description: the first name of the User + last_name: + type: string + description: the last name of the User + password: + description: The desired password for the User + type: string + format: password + AdminPostInvitesReq: + type: object + required: + - user + - role + properties: + user: + description: The email for the user to be created. + type: string + format: email + role: + description: The role of the user to be created. + type: string + enum: + - admin + - member + - developer + AdminInviteDeleteRes: + type: object + properties: + id: + type: string + description: The ID of the deleted Invite. + object: + type: string + description: The type of the object that was deleted. + default: invite + deleted: + type: boolean + description: Whether or not the Invite was deleted. + default: true + AdminListInvitesRes: + type: object + properties: + invites: + type: array + items: + $ref: '#/components/schemas/Invite' AdminPostNotesReq: type: object required: @@ -28791,59 +29055,6 @@ components: internal_note: description: An optional note to create or update for the order edit. type: string - AdminPaymentCollectionsRes: - type: object - properties: - payment_collection: - $ref: '#/components/schemas/PaymentCollection' - AdminPaymentCollectionDeleteRes: - type: object - properties: - id: - type: string - description: The ID of the deleted Payment Collection. - object: - type: string - description: The type of the object that was deleted. - default: payment_collection - deleted: - type: boolean - description: Whether or not the Payment Collection was deleted. - default: true - AdminUpdatePaymentCollectionsReq: - type: object - properties: - description: - description: An optional description to create or update the payment collection. - type: string - metadata: - description: An optional set of key-value pairs to hold additional information. - type: object - AdminPaymentRes: - type: object - properties: - payment: - $ref: '#/components/schemas/Payment' - AdminRefundRes: - type: object - properties: - refund: - $ref: '#/components/schemas/Refund' - AdminPostPaymentRefundsReq: - type: object - required: - - amount - - reason - properties: - amount: - description: The amount to refund. - type: integer - reason: - description: The reason for the Refund. - type: string - note: - description: A note with additional details about the Refund. - type: string AdminPostOrdersOrderShippingMethodsReq: type: object required: @@ -29409,6 +29620,59 @@ components: A flag to indicate if no notifications should be emitted related to the updated order. type: boolean + AdminPaymentCollectionsRes: + type: object + properties: + payment_collection: + $ref: '#/components/schemas/PaymentCollection' + AdminPaymentCollectionDeleteRes: + type: object + properties: + id: + type: string + description: The ID of the deleted Payment Collection. + object: + type: string + description: The type of the object that was deleted. + default: payment_collection + deleted: + type: boolean + description: Whether or not the Payment Collection was deleted. + default: true + AdminUpdatePaymentCollectionsReq: + type: object + properties: + description: + description: An optional description to create or update the payment collection. + type: string + metadata: + description: An optional set of key-value pairs to hold additional information. + type: object + AdminPaymentRes: + type: object + properties: + payment: + $ref: '#/components/schemas/Payment' + AdminRefundRes: + type: object + properties: + refund: + $ref: '#/components/schemas/Refund' + AdminPostPaymentRefundsReq: + type: object + required: + - amount + - reason + properties: + amount: + description: The amount to refund. + type: integer + reason: + description: The reason for the Refund. + type: string + note: + description: A note with additional details about the Refund. + type: string AdminPostPriceListPricesPricesReq: type: object properties: @@ -29723,6 +29987,113 @@ components: includes_tax: description: '[EXPERIMENTAL] Tax included in prices of price list' type: boolean + AdminPostProductCategoriesCategoryProductsBatchReq: + type: object + required: + - product_ids + properties: + product_ids: + description: The IDs of the products to add to the Product Category + type: array + items: + type: object + required: + - id + properties: + id: + type: string + description: The ID of the product + AdminPostProductCategoriesReq: + type: object + required: + - name + properties: + name: + type: string + description: The name to identify the Product Category by. + handle: + type: string + description: >- + An optional handle to be used in slugs, if none is provided we will + kebab-case the title. + is_internal: + type: boolean + description: A flag to make product category an internal category for admins + is_active: + type: boolean + description: A flag to make product category visible/hidden in the store front + parent_category_id: + type: string + description: The ID of the parent product category + AdminDeleteProductCategoriesCategoryProductsBatchReq: + type: object + required: + - product_ids + properties: + product_ids: + description: The IDs of the products to delete from the Product Category. + type: array + items: + type: object + required: + - id + properties: + id: + description: The ID of a product + type: string + AdminProductCategoriesCategoryRes: + type: object + properties: + product_category: + $ref: '#/components/schemas/ProductCategory' + AdminProductCategoriesCategoryDeleteRes: + type: object + properties: + id: + type: string + description: The ID of the deleted product category + object: + type: string + description: The type of the object that was deleted. + default: product-category + deleted: + type: boolean + description: Whether or not the items were deleted. + default: true + AdminProductCategoriesListRes: + type: object + properties: + product_categories: + type: array + items: + $ref: '#/components/schemas/ProductCategory' + 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 + AdminPostProductCategoriesCategoryReq: + type: object + properties: + name: + type: string + description: The name to identify the Product Category by. + handle: + type: string + description: A handle to be used in slugs. + is_internal: + type: boolean + description: A flag to make product category an internal category for admins + is_active: + type: boolean + description: A flag to make product category visible/hidden in the store front + parent_category_id: + type: string + description: The ID of the parent product category AdminProductTagsListRes: type: object properties: @@ -30574,113 +30945,6 @@ components: value: description: The value to give for the Product Option. type: string - AdminPostProductCategoriesCategoryProductsBatchReq: - type: object - required: - - product_ids - properties: - product_ids: - description: The IDs of the products to add to the Product Category - type: array - items: - type: object - required: - - id - properties: - id: - type: string - description: The ID of the product - AdminPostProductCategoriesReq: - type: object - required: - - name - properties: - name: - type: string - description: The name to identify the Product Category by. - handle: - type: string - description: >- - An optional handle to be used in slugs, if none is provided we will - kebab-case the title. - is_internal: - type: boolean - description: A flag to make product category an internal category for admins - is_active: - type: boolean - description: A flag to make product category visible/hidden in the store front - parent_category_id: - type: string - description: The ID of the parent product category - AdminDeleteProductCategoriesCategoryProductsBatchReq: - type: object - required: - - product_ids - properties: - product_ids: - description: The IDs of the products to delete from the Product Category. - type: array - items: - type: object - required: - - id - properties: - id: - description: The ID of a product - type: string - AdminProductCategoriesCategoryRes: - type: object - properties: - product_category: - $ref: '#/components/schemas/ProductCategory' - AdminProductCategoriesCategoryDeleteRes: - type: object - properties: - id: - type: string - description: The ID of the deleted product category - object: - type: string - description: The type of the object that was deleted. - default: product-category - deleted: - type: boolean - description: Whether or not the items were deleted. - default: true - AdminProductCategoriesListRes: - type: object - properties: - product_categories: - type: array - items: - $ref: '#/components/schemas/ProductCategory' - 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 - AdminPostProductCategoriesCategoryReq: - type: object - properties: - name: - type: string - description: The name to identify the Product Category by. - handle: - type: string - description: A handle to be used in slugs. - is_internal: - type: boolean - description: A flag to make product category an internal category for admins - is_active: - type: boolean - description: A flag to make product category visible/hidden in the store front - parent_category_id: - type: string - description: The ID of the parent product category AdminPostPublishableApiKeySalesChannelsBatchReq: type: object required: @@ -30769,41 +31033,6 @@ components: title: description: A title to update for the key. type: string - AdminPostReservationsReq: - type: object - required: - - reservation - properties: - reservation: - $ref: '#/components/schemas/ReservationItemDTO' - AdminGetReservationReservationsReq: - type: object - properties: - reservations: - type: array - items: - $ref: '#/components/schemas/ReservationItemDTO' - 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 - AdminPostReservationsReservationReq: - type: object - properties: - location_id: - description: The id of the location of the reservation - type: string - quantity: - description: The id of the reservation item - type: number - metadata: - description: An optional set of key-value pairs with additional information. - type: object AdminPostRegionsRegionCountriesReq: type: object required: @@ -30989,6 +31218,41 @@ components: type: array items: type: string + AdminPostReservationsReq: + type: object + required: + - reservation + properties: + reservation: + $ref: '#/components/schemas/ReservationItemDTO' + AdminGetReservationReservationsReq: + type: object + properties: + reservations: + type: array + items: + $ref: '#/components/schemas/ReservationItemDTO' + 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 + AdminPostReservationsReservationReq: + type: object + properties: + location_id: + description: The id of the location of the reservation + type: string + quantity: + description: The id of the reservation item + type: number + metadata: + description: An optional set of key-value pairs with additional information. + type: object AdminPostReturnReasonsReq: type: object required: @@ -31055,6 +31319,55 @@ components: metadata: description: An optional set of key-value pairs with additional information. type: object + AdminReturnsCancelRes: + type: object + properties: + order: + $ref: '#/components/schemas/Order' + AdminReturnsListRes: + type: object + properties: + returns: + type: array + items: + $ref: '#/components/schemas/Return' + 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 + AdminReturnsRes: + type: object + properties: + return: + $ref: '#/components/schemas/Return' + AdminPostReturnsReturnReceiveReq: + type: object + required: + - items + properties: + items: + description: The Line Items that have been received. + type: array + items: + type: object + required: + - item_id + - quantity + properties: + item_id: + description: The ID of the Line Item. + type: string + quantity: + description: The quantity of the Line Item. + type: integer + refund: + description: The amount to refund. + type: number AdminPostSalesChannelsChannelProductsBatchReq: type: object required: @@ -31178,55 +31491,6 @@ components: is_disabled: type: boolean description: Indication of if the sales channel is active. - AdminReturnsCancelRes: - type: object - properties: - order: - $ref: '#/components/schemas/Order' - AdminReturnsListRes: - type: object - properties: - returns: - type: array - items: - $ref: '#/components/schemas/Return' - 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 - AdminReturnsRes: - type: object - properties: - return: - $ref: '#/components/schemas/Return' - AdminPostReturnsReturnReceiveReq: - type: object - required: - - items - properties: - items: - description: The Line Items that have been received. - type: array - items: - type: object - required: - - item_id - - quantity - properties: - item_id: - description: The ID of the Line Item. - type: string - quantity: - description: The quantity of the Line Item. - type: integer - refund: - description: The amount to refund. - type: number AdminPostShippingOptionsReq: type: object required: @@ -31505,27 +31769,6 @@ components: car: white address: $ref: '#/components/schemas/StockLocationAddressInput' - AdminSwapsListRes: - type: object - properties: - swaps: - type: array - items: - $ref: '#/components/schemas/Swap' - 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 - AdminSwapsRes: - type: object - properties: - swap: - $ref: '#/components/schemas/Swap' AdminStoresRes: type: object properties: @@ -31580,6 +31823,27 @@ components: metadata: description: An optional set of key-value pairs with additional information. type: object + AdminSwapsListRes: + type: object + properties: + swaps: + type: array + items: + $ref: '#/components/schemas/Swap' + 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 + AdminSwapsRes: + type: object + properties: + swap: + $ref: '#/components/schemas/Swap' AdminPostTaxRatesTaxRateProductTypesReq: type: object required: diff --git a/docs/api/admin-spec3.yaml b/docs/api/admin-spec3.yaml index 2089e9a46b..e9e89a984d 100644 --- a/docs/api/admin-spec3.yaml +++ b/docs/api/admin-spec3.yaml @@ -1455,282 +1455,6 @@ paths: application/json: schema: $ref: '#/components/schemas/AdminCurrenciesRes' - /customers: - post: - operationId: PostCustomers - summary: Create a Customer - description: Creates a Customer. - x-authenticated: true - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPostCustomersReq' - x-codegen: - method: create - x-codeSamples: - - lang: JavaScript - label: JS Client - source: | - import Medusa from "@medusajs/medusa-js" - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) - // must be previously logged in or use api token - medusa.admin.customers.create({ - email: 'user@example.com', - first_name: 'Caterina', - last_name: 'Yost', - password: 'supersecret' - }) - .then(({ customer }) => { - console.log(customer.id); - }); - - lang: Shell - label: cURL - source: | - curl --location --request POST 'https://medusa-url.com/admin/customers' \ - --header 'Authorization: Bearer {api_token}' \ - --header 'Content-Type: application/json' \ - --data-raw '{ - "email": "user@example.com", - "first_name": "Caterina", - "last_name": "Yost", - "password": "supersecret" - }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Customer - responses: - '201': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminCustomersRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - get: - operationId: GetCustomers - summary: List Customers - description: Retrieves a list of Customers. - x-authenticated: true - parameters: - - in: query - name: limit - description: The number of items to return. - schema: - type: integer - default: 50 - - in: query - name: offset - description: The items to skip before result. - schema: - type: integer - default: 0 - - in: query - name: expand - description: (Comma separated) Which fields should be expanded in each customer. - schema: - type: string - - in: query - name: q - description: a search term to search email, first_name, and last_name. - schema: - type: string - x-codegen: - method: list - queryParams: AdminGetCustomersParams - x-codeSamples: - - lang: JavaScript - label: JS Client - source: | - import Medusa from "@medusajs/medusa-js" - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) - // must be previously logged in or use api token - medusa.admin.customers.list() - .then(({ customers, limit, offset, count }) => { - console.log(customers.length); - }); - - lang: Shell - label: cURL - source: | - curl --location --request GET 'https://medusa-url.com/admin/customers' \ - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Customer - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminCustomersListRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - /customers/{id}: - get: - operationId: GetCustomersCustomer - summary: Get a Customer - description: Retrieves a Customer. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Customer. - schema: - type: string - - in: query - name: expand - description: (Comma separated) Which fields should be expanded in the customer. - schema: - type: string - - in: query - name: fields - description: (Comma separated) Which fields should be included in the customer. - schema: - type: string - x-codegen: - method: retrieve - x-codeSamples: - - lang: JavaScript - label: JS Client - source: | - import Medusa from "@medusajs/medusa-js" - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) - // must be previously logged in or use api token - medusa.admin.customers.retrieve(customer_id) - .then(({ customer }) => { - console.log(customer.id); - }); - - lang: Shell - label: cURL - source: | - curl --location --request GET 'https://medusa-url.com/admin/customers/{id}' \ - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Customer - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminCustomersRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - post: - operationId: PostCustomersCustomer - summary: Update a Customer - description: Updates a Customer. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Customer. - schema: - type: string - - in: query - name: expand - description: (Comma separated) Which fields should be expanded in each customer. - schema: - type: string - - in: query - name: fields - description: (Comma separated) Which fields should be retrieved in each customer. - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPostCustomersCustomerReq' - x-codegen: - method: update - x-codeSamples: - - lang: JavaScript - label: JS Client - source: | - import Medusa from "@medusajs/medusa-js" - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) - // must be previously logged in or use api token - medusa.admin.customers.update(customer_id, { - first_name: 'Dolly' - }) - .then(({ customer }) => { - console.log(customer.id); - }); - - lang: Shell - label: cURL - source: | - curl --location --request POST 'https://medusa-url.com/admin/customers/{id}' \ - --header 'Authorization: Bearer {api_token}' \ - --header 'Content-Type: application/json' \ - --data-raw '{ - "first_name": "Dolly" - }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Customer - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminCustomersRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' /customer-groups/{id}/customers/batch: post: operationId: PostCustomerGroupsGroupCustomersBatch @@ -2363,6 +2087,282 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' + /customers: + post: + operationId: PostCustomers + summary: Create a Customer + description: Creates a Customer. + x-authenticated: true + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPostCustomersReq' + x-codegen: + method: create + x-codeSamples: + - lang: JavaScript + label: JS Client + source: | + import Medusa from "@medusajs/medusa-js" + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) + // must be previously logged in or use api token + medusa.admin.customers.create({ + email: 'user@example.com', + first_name: 'Caterina', + last_name: 'Yost', + password: 'supersecret' + }) + .then(({ customer }) => { + console.log(customer.id); + }); + - lang: Shell + label: cURL + source: | + curl --location --request POST 'https://medusa-url.com/admin/customers' \ + --header 'Authorization: Bearer {api_token}' \ + --header 'Content-Type: application/json' \ + --data-raw '{ + "email": "user@example.com", + "first_name": "Caterina", + "last_name": "Yost", + "password": "supersecret" + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Customer + responses: + '201': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminCustomersRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + get: + operationId: GetCustomers + summary: List Customers + description: Retrieves a list of Customers. + x-authenticated: true + parameters: + - in: query + name: limit + description: The number of items to return. + schema: + type: integer + default: 50 + - in: query + name: offset + description: The items to skip before result. + schema: + type: integer + default: 0 + - in: query + name: expand + description: (Comma separated) Which fields should be expanded in each customer. + schema: + type: string + - in: query + name: q + description: a search term to search email, first_name, and last_name. + schema: + type: string + x-codegen: + method: list + queryParams: AdminGetCustomersParams + x-codeSamples: + - lang: JavaScript + label: JS Client + source: | + import Medusa from "@medusajs/medusa-js" + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) + // must be previously logged in or use api token + medusa.admin.customers.list() + .then(({ customers, limit, offset, count }) => { + console.log(customers.length); + }); + - lang: Shell + label: cURL + source: | + curl --location --request GET 'https://medusa-url.com/admin/customers' \ + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminCustomersListRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + /customers/{id}: + get: + operationId: GetCustomersCustomer + summary: Get a Customer + description: Retrieves a Customer. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Customer. + schema: + type: string + - in: query + name: expand + description: (Comma separated) Which fields should be expanded in the customer. + schema: + type: string + - in: query + name: fields + description: (Comma separated) Which fields should be included in the customer. + schema: + type: string + x-codegen: + method: retrieve + x-codeSamples: + - lang: JavaScript + label: JS Client + source: | + import Medusa from "@medusajs/medusa-js" + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) + // must be previously logged in or use api token + medusa.admin.customers.retrieve(customer_id) + .then(({ customer }) => { + console.log(customer.id); + }); + - lang: Shell + label: cURL + source: | + curl --location --request GET 'https://medusa-url.com/admin/customers/{id}' \ + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminCustomersRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + post: + operationId: PostCustomersCustomer + summary: Update a Customer + description: Updates a Customer. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Customer. + schema: + type: string + - in: query + name: expand + description: (Comma separated) Which fields should be expanded in each customer. + schema: + type: string + - in: query + name: fields + description: (Comma separated) Which fields should be retrieved in each customer. + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPostCustomersCustomerReq' + x-codegen: + method: update + x-codeSamples: + - lang: JavaScript + label: JS Client + source: | + import Medusa from "@medusajs/medusa-js" + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) + // must be previously logged in or use api token + medusa.admin.customers.update(customer_id, { + first_name: 'Dolly' + }) + .then(({ customer }) => { + console.log(customer.id); + }); + - lang: Shell + label: cURL + source: | + curl --location --request POST 'https://medusa-url.com/admin/customers/{id}' \ + --header 'Authorization: Bearer {api_token}' \ + --header 'Content-Type: application/json' \ + --data-raw '{ + "first_name": "Dolly" + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminCustomersRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' /discounts/{id}/regions/{region_id}: post: operationId: PostDiscountsDiscountRegionsRegion @@ -4405,289 +4405,6 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - /invites/accept: - post: - operationId: PostInvitesInviteAccept - summary: Accept an Invite - description: Accepts an Invite and creates a corresponding user - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPostInvitesInviteAcceptReq' - x-codegen: - method: accept - x-codeSamples: - - lang: JavaScript - label: JS Client - source: | - import Medusa from "@medusajs/medusa-js" - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) - // must be previously logged in or use api token - medusa.admin.invites.accept({ - token, - user: { - first_name: 'Brigitte', - last_name: 'Collier', - password: 'supersecret' - } - }) - .then(() => { - // successful - }) - .catch(() => { - // an error occurred - }); - - lang: Shell - label: cURL - source: | - curl --location --request POST 'https://medusa-url.com/admin/invites/accept' \ - --header 'Authorization: Bearer {api_token}' \ - --header 'Content-Type: application/json' \ - --data-raw '{ - "token": "{token}", - "user": { - "first_name": "Brigitte", - "last_name": "Collier", - "password": "supersecret" - } - }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Invite - responses: - '200': - description: OK - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - /invites: - post: - operationId: PostInvites - summary: Create an Invite - description: Creates an Invite and triggers an 'invite' created event - x-authenticated: true - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPostInvitesReq' - x-codegen: - method: create - x-codeSamples: - - lang: JavaScript - label: JS Client - source: | - import Medusa from "@medusajs/medusa-js" - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) - // must be previously logged in or use api token - medusa.admin.invites.create({ - user: "user@example.com", - role: "admin" - }) - .then(() => { - // successful - }) - .catch(() => { - // an error occurred - }); - - lang: Shell - label: cURL - source: | - curl --location --request POST 'https://medusa-url.com/admin/invites' \ - --header 'Authorization: Bearer {api_token}' \ - --header 'Content-Type: application/json' \ - --data-raw '{ - "user": "user@example.com", - "role": "admin" - }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Invite - responses: - '200': - description: OK - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - get: - operationId: GetInvites - summary: Lists Invites - description: Lists all Invites - x-authenticated: true - x-codegen: - method: list - x-codeSamples: - - lang: JavaScript - label: JS Client - source: | - import Medusa from "@medusajs/medusa-js" - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) - // must be previously logged in or use api token - medusa.admin.invites.list() - .then(({ invites }) => { - console.log(invites.length); - }); - - lang: Shell - label: cURL - source: | - curl --location --request GET 'https://medusa-url.com/admin/invites' \ - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Invite - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminListInvitesRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - /invites/{invite_id}: - delete: - operationId: DeleteInvitesInvite - summary: Delete an Invite - description: Deletes an Invite - x-authenticated: true - parameters: - - in: path - name: invite_id - required: true - description: The ID of the Invite - schema: - type: string - x-codegen: - method: delete - x-codeSamples: - - lang: JavaScript - label: JS Client - source: | - import Medusa from "@medusajs/medusa-js" - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) - // must be previously logged in or use api token - medusa.admin.invites.delete(invite_id) - .then(({ id, object, deleted }) => { - console.log(id); - }); - - lang: Shell - label: cURL - source: | - curl --location --request DELETE 'https://medusa-url.com/admin/invites/{invite_id}' \ - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Invite - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminInviteDeleteRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - /invites/{invite_id}/resend: - post: - operationId: PostInvitesInviteResend - summary: Resend an Invite - description: Resends an Invite by triggering the 'invite' created event again - x-authenticated: true - parameters: - - in: path - name: invite_id - required: true - description: The ID of the Invite - schema: - type: string - x-codegen: - method: resend - x-codeSamples: - - lang: JavaScript - label: JS Client - source: | - import Medusa from "@medusajs/medusa-js" - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) - // must be previously logged in or use api token - medusa.admin.invites.resend(invite_id) - .then(() => { - // successful - }) - .catch(() => { - // an error occurred - }); - - lang: Shell - label: cURL - source: | - curl --location --request POST 'https://medusa-url.com/admin/invites/{invite_id}/resend' \ - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Invite - responses: - '200': - description: OK - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' /inventory-items/{id}/location-levels: post: operationId: PostInventoryItemsInventoryItemLocationLevels @@ -5306,63 +5023,18 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - /notifications: - get: - operationId: GetNotifications - summary: List Notifications - description: Retrieves a list of Notifications. - x-authenticated: true - parameters: - - in: query - name: offset - description: The number of notifications to skip before starting to collect the notifications set - schema: - type: integer - default: 0 - - in: query - name: limit - description: The number of notifications to return - schema: - type: integer - default: 50 - - in: query - name: fields - description: Comma separated fields to include in the result set - schema: - type: string - - in: query - name: expand - description: Comma separated fields to populate - schema: - type: string - - in: query - name: event_name - description: The name of the event that the notification was sent for. - schema: - type: string - - in: query - name: resource_type - description: The type of resource that the Notification refers to. - schema: - type: string - - in: query - name: resource_id - description: The ID of the resource that the Notification refers to. - schema: - type: string - - in: query - name: to - description: The address that the Notification was sent to. This will usually be an email address, but represent other addresses such as a chat bot user id - schema: - type: string - - in: query - name: include_resends - description: A boolean indicating whether the result set should include resent notifications or not - schema: - type: string + /invites/accept: + post: + operationId: PostInvitesInviteAccept + summary: Accept an Invite + description: Accepts an Invite and creates a corresponding user + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPostInvitesInviteAcceptReq' x-codegen: - method: list - queryParams: AdminGetNotificationsParams + method: accept x-codeSamples: - lang: JavaScript label: JS Client @@ -5370,27 +5042,42 @@ paths: import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token - medusa.admin.notifications.list() - .then(({ notifications }) => { - console.log(notifications.length); + medusa.admin.invites.accept({ + token, + user: { + first_name: 'Brigitte', + last_name: 'Collier', + password: 'supersecret' + } + }) + .then(() => { + // successful + }) + .catch(() => { + // an error occurred }); - lang: Shell label: cURL source: | - curl --location --request GET 'https://medusa-url.com/admin/notifications' \ - --header 'Authorization: Bearer {api_token}' + curl --location --request POST 'https://medusa-url.com/admin/invites/accept' \ + --header 'Authorization: Bearer {api_token}' \ + --header 'Content-Type: application/json' \ + --data-raw '{ + "token": "{token}", + "user": { + "first_name": "Brigitte", + "last_name": "Collier", + "password": "supersecret" + } + }' security: - api_token: [] - cookie_auth: [] tags: - - Notification + - Invite responses: '200': description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminNotificationsListRes' '400': $ref: '#/components/responses/400_error' '401': @@ -5403,24 +5090,181 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - /notifications/{id}/resend: + /invites: post: - operationId: PostNotificationsNotificationResend - summary: Resend Notification - description: Resends a previously sent notifications, with the same data but optionally to a different address + operationId: PostInvites + summary: Create an Invite + description: Creates an Invite and triggers an 'invite' created event x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Notification - schema: - type: string requestBody: content: application/json: schema: - $ref: '#/components/schemas/AdminPostNotificationsNotificationResendReq' + $ref: '#/components/schemas/AdminPostInvitesReq' + x-codegen: + method: create + x-codeSamples: + - lang: JavaScript + label: JS Client + source: | + import Medusa from "@medusajs/medusa-js" + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) + // must be previously logged in or use api token + medusa.admin.invites.create({ + user: "user@example.com", + role: "admin" + }) + .then(() => { + // successful + }) + .catch(() => { + // an error occurred + }); + - lang: Shell + label: cURL + source: | + curl --location --request POST 'https://medusa-url.com/admin/invites' \ + --header 'Authorization: Bearer {api_token}' \ + --header 'Content-Type: application/json' \ + --data-raw '{ + "user": "user@example.com", + "role": "admin" + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Invite + responses: + '200': + description: OK + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + get: + operationId: GetInvites + summary: Lists Invites + description: Lists all Invites + x-authenticated: true + x-codegen: + method: list + x-codeSamples: + - lang: JavaScript + label: JS Client + source: | + import Medusa from "@medusajs/medusa-js" + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) + // must be previously logged in or use api token + medusa.admin.invites.list() + .then(({ invites }) => { + console.log(invites.length); + }); + - lang: Shell + label: cURL + source: | + curl --location --request GET 'https://medusa-url.com/admin/invites' \ + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Invite + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminListInvitesRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + /invites/{invite_id}: + delete: + operationId: DeleteInvitesInvite + summary: Delete an Invite + description: Deletes an Invite + x-authenticated: true + parameters: + - in: path + name: invite_id + required: true + description: The ID of the Invite + schema: + type: string + x-codegen: + method: delete + x-codeSamples: + - lang: JavaScript + label: JS Client + source: | + import Medusa from "@medusajs/medusa-js" + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) + // must be previously logged in or use api token + medusa.admin.invites.delete(invite_id) + .then(({ id, object, deleted }) => { + console.log(id); + }); + - lang: Shell + label: cURL + source: | + curl --location --request DELETE 'https://medusa-url.com/admin/invites/{invite_id}' \ + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Invite + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminInviteDeleteRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + /invites/{invite_id}/resend: + post: + operationId: PostInvitesInviteResend + summary: Resend an Invite + description: Resends an Invite by triggering the 'invite' created event again + x-authenticated: true + parameters: + - in: path + name: invite_id + required: true + description: The ID of the Invite + schema: + type: string x-codegen: method: resend x-codeSamples: @@ -5430,27 +5274,26 @@ paths: import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token - medusa.admin.notifications.resend(notification_id) - .then(({ notification }) => { - console.log(notification.id); + medusa.admin.invites.resend(invite_id) + .then(() => { + // successful + }) + .catch(() => { + // an error occurred }); - lang: Shell label: cURL source: | - curl --location --request POST 'https://medusa-url.com/admin/notifications/{id}/resend' \ + curl --location --request POST 'https://medusa-url.com/admin/invites/{invite_id}/resend' \ --header 'Authorization: Bearer {api_token}' security: - api_token: [] - cookie_auth: [] tags: - - Notification + - Invite responses: '200': description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminNotificationsRes' '400': $ref: '#/components/responses/400_error' '401': @@ -5766,6 +5609,163 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' + /notifications: + get: + operationId: GetNotifications + summary: List Notifications + description: Retrieves a list of Notifications. + x-authenticated: true + parameters: + - in: query + name: offset + description: The number of notifications to skip before starting to collect the notifications set + schema: + type: integer + default: 0 + - in: query + name: limit + description: The number of notifications to return + schema: + type: integer + default: 50 + - in: query + name: fields + description: Comma separated fields to include in the result set + schema: + type: string + - in: query + name: expand + description: Comma separated fields to populate + schema: + type: string + - in: query + name: event_name + description: The name of the event that the notification was sent for. + schema: + type: string + - in: query + name: resource_type + description: The type of resource that the Notification refers to. + schema: + type: string + - in: query + name: resource_id + description: The ID of the resource that the Notification refers to. + schema: + type: string + - in: query + name: to + description: The address that the Notification was sent to. This will usually be an email address, but represent other addresses such as a chat bot user id + schema: + type: string + - in: query + name: include_resends + description: A boolean indicating whether the result set should include resent notifications or not + schema: + type: string + x-codegen: + method: list + queryParams: AdminGetNotificationsParams + x-codeSamples: + - lang: JavaScript + label: JS Client + source: | + import Medusa from "@medusajs/medusa-js" + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) + // must be previously logged in or use api token + medusa.admin.notifications.list() + .then(({ notifications }) => { + console.log(notifications.length); + }); + - lang: Shell + label: cURL + source: | + curl --location --request GET 'https://medusa-url.com/admin/notifications' \ + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Notification + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminNotificationsListRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + /notifications/{id}/resend: + post: + operationId: PostNotificationsNotificationResend + summary: Resend Notification + description: Resends a previously sent notifications, with the same data but optionally to a different address + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Notification + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPostNotificationsNotificationResendReq' + x-codegen: + method: resend + x-codeSamples: + - lang: JavaScript + label: JS Client + source: | + import Medusa from "@medusajs/medusa-js" + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) + // must be previously logged in or use api token + medusa.admin.notifications.resend(notification_id) + .then(({ notification }) => { + console.log(notification.id); + }); + - lang: Shell + label: cURL + source: | + curl --location --request POST 'https://medusa-url.com/admin/notifications/{id}/resend' \ + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Notification + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminNotificationsRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' /order-edits/{id}/items: post: operationId: PostOrderEditsEditLineItems @@ -6476,238 +6476,6 @@ paths: $ref: '#/components/responses/not_found_error' '500': $ref: '#/components/responses/500_error' - /payment-collections/{id}: - delete: - operationId: DeletePaymentCollectionsPaymentCollection - summary: Del a PaymentCollection - description: Deletes a Payment Collection - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Payment Collection to delete. - schema: - type: string - x-codegen: - method: delete - x-codeSamples: - - lang: JavaScript - label: JS Client - source: | - import Medusa from "@medusajs/medusa-js" - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) - // must be previously logged in or use api token - medusa.admin.paymentCollections.delete(payment_collection_id) - .then(({ id, object, deleted }) => { - console.log(id) - }) - - lang: Shell - label: cURL - source: | - curl --location --request DELETE 'https://medusa-url.com/admin/payment-collections/{id}' \ - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - PaymentCollection - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPaymentCollectionDeleteRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - get: - operationId: GetPaymentCollectionsPaymentCollection - summary: Get a PaymentCollection - description: Retrieves a PaymentCollection. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the PaymentCollection. - schema: - type: string - - in: query - name: expand - description: Comma separated list of relations to include in the results. - schema: - type: string - - in: query - name: fields - description: Comma separated list of fields to include in the results. - schema: - type: string - x-codegen: - method: retrieve - queryParams: GetPaymentCollectionsParams - x-codeSamples: - - lang: JavaScript - label: JS Client - source: | - import Medusa from "@medusajs/medusa-js" - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) - // must be previously logged in or use api token - medusa.admin.paymentCollections.retrieve(paymentCollectionId) - .then(({ payment_collection }) => { - console.log(payment_collection.id) - }) - - lang: Shell - label: cURL - source: | - curl --location --request GET 'https://medusa-url.com/admin/payment-collections/{id}' \ - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - PaymentCollection - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPaymentCollectionsRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - post: - operationId: PostPaymentCollectionsPaymentCollection - summary: Update PaymentCollection - description: Updates a PaymentCollection. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the PaymentCollection. - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AdminUpdatePaymentCollectionsReq' - x-codegen: - method: update - x-codeSamples: - - lang: JavaScript - label: JS Client - source: | - import Medusa from "@medusajs/medusa-js" - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) - // must be previously logged in or use api token - medusa.admin.paymentCollections.update(payment_collection_id, { - description: "Description of payCol" - }) - .then(({ payment_collection }) => { - console.log(payment_collection.id) - }) - - lang: Shell - label: cURL - source: | - curl --location --request POST 'https://medusa-url.com/admin/payment-collections/{id}' \ - --header 'Authorization: Bearer {api_token}' \ - --header 'Content-Type: application/json' \ - --data-raw '{ - "description": "Description of payCol" - }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - PaymentCollection - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPaymentCollectionsRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - /payment-collections/{id}/authorize: - post: - operationId: PostPaymentCollectionsPaymentCollectionAuthorize - summary: Mark Authorized - description: Sets the status of PaymentCollection as Authorized. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the PaymentCollection. - schema: - type: string - x-codegen: - method: markAsAuthorized - x-codeSamples: - - lang: JavaScript - label: JS Client - source: | - import Medusa from "@medusajs/medusa-js" - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) - // must be previously logged in or use api token - medusa.admin.paymentCollections.markAsAuthorized(payment_collection_id) - .then(({ payment_collection }) => { - console.log(payment_collection.id) - }) - - lang: Shell - label: cURL - source: | - curl --location --request POST 'https://medusa-url.com/admin/payment-collections/{id}/authorize' \ - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - PaymentCollection - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPaymentCollectionsRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' /orders/{id}/shipping-methods: post: operationId: PostOrdersOrderShippingMethods @@ -6720,6 +6488,16 @@ paths: description: The ID of the Order. schema: type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string requestBody: content: application/json: @@ -6728,6 +6506,7 @@ paths: x-authenticated: true x-codegen: method: addShippingMethod + params: AdminPostOrdersOrderShippingMethodsParams x-codeSamples: - lang: JavaScript label: JS Client @@ -6789,8 +6568,19 @@ paths: description: The ID of the Order. schema: type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string x-codegen: method: archive + params: AdminPostOrdersOrderArchiveParams x-codeSamples: - lang: JavaScript label: JS Client @@ -6850,8 +6640,19 @@ paths: description: The ID of the Claim. schema: type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string x-codegen: method: cancelClaim + params: AdminPostOrdersClaimCancel x-codeSamples: - lang: JavaScript label: JS Client @@ -6917,8 +6718,19 @@ paths: description: The ID of the Fulfillment. schema: type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string x-codegen: method: cancelClaimFulfillment + params: AdminPostOrdersClaimFulfillmentsCancelParams x-codeSamples: - lang: JavaScript label: JS Client @@ -6984,8 +6796,19 @@ paths: description: The ID of the Fulfillment. schema: type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string x-codegen: method: cancelSwapFulfillment + params: AdminPostOrdersSwapFulfillementsCancelParams x-codeSamples: - lang: JavaScript label: JS Client @@ -7045,8 +6868,19 @@ paths: description: The ID of the Fulfillment schema: type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string x-codegen: method: cancelFulfillment + params: AdminPostOrdersOrderFulfillementsCancelParams x-codeSamples: - lang: JavaScript label: JS Client @@ -7100,8 +6934,19 @@ paths: description: The ID of the Order. schema: type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string x-codegen: method: cancel + params: AdminPostOrdersOrderCancel x-codeSamples: - lang: JavaScript label: JS Client @@ -7161,8 +7006,19 @@ paths: description: The ID of the Swap. schema: type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string x-codegen: method: cancelSwap + params: AdminPostOrdersSwapCancelParams x-codeSamples: - lang: JavaScript label: JS Client @@ -7216,8 +7072,19 @@ paths: description: The ID of the Order. schema: type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string x-codegen: method: capturePayment + params: AdminPostOrdersOrderCaptureParams x-codeSamples: - lang: JavaScript label: JS Client @@ -7271,8 +7138,19 @@ paths: description: The ID of the Order. schema: type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string x-codegen: method: complete + params: AdminPostOrdersOrderCompleteParams x-codeSamples: - lang: JavaScript label: JS Client @@ -7332,6 +7210,16 @@ paths: description: The ID of the Claim. schema: type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string requestBody: content: application/json: @@ -7339,6 +7227,7 @@ paths: $ref: '#/components/schemas/AdminPostOrdersOrderClaimsClaimShipmentsReq' x-codegen: method: createClaimShipment + params: AdminPostOrdersOrderClaimsClaimShipmentsParams x-codeSamples: - lang: JavaScript label: JS Client @@ -7398,6 +7287,16 @@ paths: description: The ID of the Order. schema: type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string requestBody: content: application/json: @@ -7405,6 +7304,7 @@ paths: $ref: '#/components/schemas/AdminPostOrdersOrderClaimsReq' x-codegen: method: createClaim + params: AdminPostOrdersOrderClaimsParams x-codeSamples: - lang: JavaScript label: JS Client @@ -7476,6 +7376,16 @@ paths: description: The ID of the Order. schema: type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string requestBody: content: application/json: @@ -7483,6 +7393,7 @@ paths: $ref: '#/components/schemas/AdminPostOrdersOrderFulfillmentsReq' x-codegen: method: createFulfillment + params: AdminPostOrdersOrderFulfillmentsParams x-codeSamples: - lang: JavaScript label: JS Client @@ -7622,6 +7533,16 @@ paths: description: The ID of the Order. schema: type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string requestBody: content: application/json: @@ -7629,6 +7550,7 @@ paths: $ref: '#/components/schemas/AdminPostOrdersOrderShipmentReq' x-codegen: method: createShipment + params: AdminPostOrdersOrderShipmentParams x-codeSamples: - lang: JavaScript label: JS Client @@ -7694,6 +7616,16 @@ paths: description: The ID of the Swap. schema: type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string requestBody: content: application/json: @@ -7701,6 +7633,7 @@ paths: $ref: '#/components/schemas/AdminPostOrdersOrderSwapsSwapShipmentsReq' x-codegen: method: createSwapShipment + params: AdminPostOrdersOrderSwapsSwapShipmentsParams x-codeSamples: - lang: JavaScript label: JS Client @@ -7760,6 +7693,16 @@ paths: description: The ID of the Order. schema: type: string + - in: query + name: expand + description: (Comma separated) Which fields should be expanded the order of the result. + schema: + type: string + - in: query + name: fields + description: (Comma separated) Which fields should be included the order of the result. + schema: + type: string requestBody: content: application/json: @@ -7767,6 +7710,7 @@ paths: $ref: '#/components/schemas/AdminPostOrdersOrderSwapsReq' x-codegen: method: createSwap + queryParams: AdminPostOrdersOrderSwapsParams x-codeSamples: - lang: JavaScript label: JS Client @@ -7842,6 +7786,16 @@ paths: description: The ID of the Claim. schema: type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string requestBody: content: application/json: @@ -7849,6 +7803,7 @@ paths: $ref: '#/components/schemas/AdminPostOrdersOrderClaimsClaimFulfillmentsReq' x-codegen: method: fulfillClaim + params: AdminPostOrdersOrderClaimsClaimFulfillmentsReq x-codeSamples: - lang: JavaScript label: JS Client @@ -7908,6 +7863,16 @@ paths: description: The ID of the Swap. schema: type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string requestBody: content: application/json: @@ -7915,6 +7880,7 @@ paths: $ref: '#/components/schemas/AdminPostOrdersOrderSwapsSwapFulfillmentsReq' x-codegen: method: fulfillSwap + params: AdminPostOrdersOrderSwapsSwapFulfillmentsParams x-codeSamples: - lang: JavaScript label: JS Client @@ -8033,6 +7999,16 @@ paths: description: The ID of the Order. schema: type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string requestBody: content: application/json: @@ -8040,6 +8016,7 @@ paths: $ref: '#/components/schemas/AdminPostOrdersOrderReq' x-codegen: method: update + params: AdminPostOrdersOrderParams x-codeSamples: - lang: JavaScript label: JS Client @@ -8427,8 +8404,19 @@ paths: description: The ID of the Swap. schema: type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string x-codegen: method: processSwapPayment + params: AdminPostOrdersOrderSwapsSwapProcessPaymentParams x-codeSamples: - lang: JavaScript label: JS Client @@ -8482,6 +8470,16 @@ paths: description: The ID of the Order. schema: type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string requestBody: content: application/json: @@ -8489,6 +8487,7 @@ paths: $ref: '#/components/schemas/AdminPostOrdersOrderRefundsReq' x-codegen: method: refundPayment + params: AdminPostOrdersOrderRefundsParams x-codeSamples: - lang: JavaScript label: JS Client @@ -8550,6 +8549,16 @@ paths: description: The ID of the Order. schema: type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string requestBody: content: application/json: @@ -8557,6 +8566,7 @@ paths: $ref: '#/components/schemas/AdminPostOrdersOrderReturnsReq' x-codegen: method: requestReturn + params: AdminPostOrdersOrderReturnsParams x-codeSamples: - lang: JavaScript label: JS Client @@ -8633,6 +8643,16 @@ paths: description: The ID of the Claim. schema: type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string requestBody: content: application/json: @@ -8640,6 +8660,7 @@ paths: $ref: '#/components/schemas/AdminPostOrdersOrderClaimsClaimReq' x-codegen: method: updateClaim + params: AdminPostOrdersOrderClaimsClaimParams x-codeSamples: - lang: JavaScript label: JS Client @@ -8686,6 +8707,238 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' + /payment-collections/{id}: + delete: + operationId: DeletePaymentCollectionsPaymentCollection + summary: Del a PaymentCollection + description: Deletes a Payment Collection + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Payment Collection to delete. + schema: + type: string + x-codegen: + method: delete + x-codeSamples: + - lang: JavaScript + label: JS Client + source: | + import Medusa from "@medusajs/medusa-js" + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) + // must be previously logged in or use api token + medusa.admin.paymentCollections.delete(payment_collection_id) + .then(({ id, object, deleted }) => { + console.log(id) + }) + - lang: Shell + label: cURL + source: | + curl --location --request DELETE 'https://medusa-url.com/admin/payment-collections/{id}' \ + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - PaymentCollection + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPaymentCollectionDeleteRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + get: + operationId: GetPaymentCollectionsPaymentCollection + summary: Get a PaymentCollection + description: Retrieves a PaymentCollection. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the PaymentCollection. + schema: + type: string + - in: query + name: expand + description: Comma separated list of relations to include in the results. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the results. + schema: + type: string + x-codegen: + method: retrieve + queryParams: GetPaymentCollectionsParams + x-codeSamples: + - lang: JavaScript + label: JS Client + source: | + import Medusa from "@medusajs/medusa-js" + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) + // must be previously logged in or use api token + medusa.admin.paymentCollections.retrieve(paymentCollectionId) + .then(({ payment_collection }) => { + console.log(payment_collection.id) + }) + - lang: Shell + label: cURL + source: | + curl --location --request GET 'https://medusa-url.com/admin/payment-collections/{id}' \ + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - PaymentCollection + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPaymentCollectionsRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + post: + operationId: PostPaymentCollectionsPaymentCollection + summary: Update PaymentCollection + description: Updates a PaymentCollection. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the PaymentCollection. + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AdminUpdatePaymentCollectionsReq' + x-codegen: + method: update + x-codeSamples: + - lang: JavaScript + label: JS Client + source: | + import Medusa from "@medusajs/medusa-js" + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) + // must be previously logged in or use api token + medusa.admin.paymentCollections.update(payment_collection_id, { + description: "Description of payCol" + }) + .then(({ payment_collection }) => { + console.log(payment_collection.id) + }) + - lang: Shell + label: cURL + source: | + curl --location --request POST 'https://medusa-url.com/admin/payment-collections/{id}' \ + --header 'Authorization: Bearer {api_token}' \ + --header 'Content-Type: application/json' \ + --data-raw '{ + "description": "Description of payCol" + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - PaymentCollection + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPaymentCollectionsRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + /payment-collections/{id}/authorize: + post: + operationId: PostPaymentCollectionsPaymentCollectionAuthorize + summary: Mark Authorized + description: Sets the status of PaymentCollection as Authorized. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the PaymentCollection. + schema: + type: string + x-codegen: + method: markAsAuthorized + x-codeSamples: + - lang: JavaScript + label: JS Client + source: | + import Medusa from "@medusajs/medusa-js" + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) + // must be previously logged in or use api token + medusa.admin.paymentCollections.markAsAuthorized(payment_collection_id) + .then(({ payment_collection }) => { + console.log(payment_collection.id) + }) + - lang: Shell + label: cURL + source: | + curl --location --request POST 'https://medusa-url.com/admin/payment-collections/{id}/authorize' \ + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - PaymentCollection + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPaymentCollectionsRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' /payments/{id}/capture: post: operationId: PostPaymentsPaymentCapture @@ -9789,6 +10042,534 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' + /product-categories/{id}/products/batch: + post: + operationId: PostProductCategoriesCategoryProductsBatch + summary: Add Products to a category + description: Assign a batch of products to a product category. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Product Category. + schema: + type: string + - in: query + name: expand + description: (Comma separated) Category fields to be expanded in the response. + schema: + type: string + - in: query + name: fields + description: (Comma separated) Category fields to be retrieved in the response. + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPostProductCategoriesCategoryProductsBatchReq' + x-codegen: + method: addProducts + queryParams: AdminPostProductCategoriesCategoryProductsBatchParams + x-codeSamples: + - lang: JavaScript + label: JS Client + source: | + import Medusa from "@medusajs/medusa-js" + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) + // must be previously logged in or use api token + medusa.admin.productCategories.addProducts(product_category_id, { + product_ids: [ + { + id: product_id + } + ] + }) + .then(({ product_category }) => { + console.log(product_category.id); + }); + - lang: Shell + label: cURL + source: | + curl --location \ + --request POST 'https://medusa-url.com/admin/product-categories/{product_category_id}/products/batch' \ + --header 'Authorization: Bearer {api_token}' \ + --header 'Content-Type: application/json' \ + --data-raw '{ + "product_ids": [ + { + "id": "{product_id}" + } + ] + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Product Category + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminProductCategoriesCategoryRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + delete: + operationId: DeleteProductCategoriesCategoryProductsBatch + summary: Delete Products + description: Remove a list of products from a product category. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Product Category. + schema: + type: string + - in: query + name: expand + description: (Comma separated) Category fields to be expanded in the response. + schema: + type: string + - in: query + name: fields + description: (Comma separated) Category fields to be retrieved in the response. + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AdminDeleteProductCategoriesCategoryProductsBatchReq' + x-codegen: + method: removeProducts + queryParams: AdminDeleteProductCategoriesCategoryProductsBatchParams + x-codeSamples: + - lang: JavaScript + label: JS Client + source: | + import Medusa from "@medusajs/medusa-js" + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) + // must be previously logged in or use api token + medusa.admin.productCategories.removeProducts(product_category_id, { + product_ids: [ + { + id: product_id + } + ] + }) + .then(({ product_category }) => { + console.log(product_category.id); + }); + - lang: Shell + label: cURL + source: | + curl --location --request DELETE 'https://medusa-url.com/admin/product-categories/{id}/products/batch' \ + --header 'Authorization: Bearer {api_token}' \ + --header 'Content-Type: application/json' \ + --data-raw '{ + "product_ids": [ + { + "id": "{product_id}" + } + ] + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Product Category + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminProductCategoriesCategoryRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + /product-categories: + post: + operationId: PostProductCategories + summary: Create a Product Category + description: Creates a Product Category. + x-authenticated: true + parameters: + - in: query + name: expand + description: (Comma separated) Which fields should be expanded in the results. + schema: + type: string + - in: query + name: fields + description: (Comma separated) Which fields should be retrieved in the results. + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPostProductCategoriesReq' + x-codegen: + method: create + queryParams: AdminPostProductCategoriesParams + x-codeSamples: + - lang: JavaScript + label: JS Client + source: | + import Medusa from "@medusajs/medusa-js" + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) + // must be previously logged in or use api token + medusa.admin.productCategories.create({ + name: "Skinny Jeans", + }) + .then(({ product_category }) => { + console.log(product_category.id); + }); + - lang: Shell + label: cURL + source: | + curl --location --request POST 'https://medusa-url.com/admin/product-categories' \ + --header 'Authorization: Bearer {api_token}' \ + --header 'Content-Type: application/json' \ + --data-raw '{ + "name": "Skinny Jeans", + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Product Category + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminProductCategoriesCategoryRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + get: + operationId: GetProductCategories + summary: List Product Categories + description: Retrieve a list of product categories. + x-authenticated: true + parameters: + - in: query + name: q + description: Query used for searching product category names orhandles. + schema: + type: string + - in: query + name: is_internal + description: Search for only internal categories. + schema: + type: boolean + - in: query + name: is_active + description: Search for only active categories + schema: + type: boolean + - in: query + name: parent_category_id + description: Returns categories scoped by parent + schema: + type: string + - in: query + name: offset + description: How many product categories to skip in the result. + schema: + type: integer + default: 0 + - in: query + name: limit + description: Limit the number of product categories returned. + schema: + type: integer + default: 100 + - in: query + name: expand + description: (Comma separated) Which fields should be expanded in the product category. + schema: + type: string + - in: query + name: fields + description: (Comma separated) Which fields should be included in the product category. + schema: + type: string + x-codegen: + method: list + queryParams: AdminGetProductCategoriesParams + x-codeSamples: + - lang: JavaScript + label: JS Client + source: | + import Medusa from "@medusajs/medusa-js" + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) + // must be previously logged in or use api token + medusa.admin.productCategories.list() + .then(({ product_categories, limit, offset, count }) => { + console.log(product_categories.length); + }); + - lang: Shell + label: cURL + source: | + curl --location --request GET 'https://medusa-url.com/admin/product-categories' \ + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Product Category + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminProductCategoriesListRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + /product-categories/{id}: + delete: + operationId: DeleteProductCategoriesCategory + summary: Delete a Product Category + description: Deletes a ProductCategory. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Product Category + schema: + type: string + x-codegen: + method: delete + x-codeSamples: + - lang: JavaScript + label: JS Client + source: | + import Medusa from "@medusajs/medusa-js" + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) + // must be previously logged in or use api token + medusa.admin.productCategories.delete(product_category_id) + .then(({ id, object, deleted }) => { + console.log(id); + }); + - lang: Shell + label: cURL + source: | + curl --location --request DELETE 'https://medusa-url.com/admin/product-categories/{id}' \ + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Product Category + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminProductCategoriesCategoryDeleteRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + get: + operationId: GetProductCategoriesCategory + summary: Get a Product Category + description: Retrieves a Product Category. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Product Category + schema: + type: string + - in: query + name: expand + description: (Comma separated) Which fields should be expanded in the results. + schema: + type: string + - in: query + name: fields + description: (Comma separated) Which fields should be included in the results. + schema: + type: string + x-codegen: + method: retrieve + queryParams: AdminGetProductCategoryParams + x-codeSamples: + - lang: JavaScript + label: JS Client + source: | + import Medusa from "@medusajs/medusa-js" + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) + // must be previously logged in or use api token + medusa.admin.productCategories.retrieve(product_category_id) + .then(({ product_category }) => { + console.log(product_category.id); + }); + - lang: Shell + label: cURL + source: | + curl --location --request GET 'https://medusa-url.com/admin/product-categories/{id}' \ + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Product Category + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminProductCategoriesCategoryRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + post: + operationId: PostProductCategoriesCategory + summary: Update a Product Category + description: Updates a Product Category. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Product Category. + schema: + type: string + - in: query + name: expand + description: (Comma separated) Which fields should be expanded in each product category. + schema: + type: string + - in: query + name: fields + description: (Comma separated) Which fields should be retrieved in each product category. + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPostProductCategoriesCategoryReq' + x-codegen: + method: update + queryParams: AdminPostProductCategoriesCategoryParams + x-codeSamples: + - lang: JavaScript + label: JS Client + source: | + import Medusa from "@medusajs/medusa-js" + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) + // must be previously logged in or use api token + medusa.admin.productCategories.update(product_category_id, { + name: "Skinny Jeans" + }) + .then(({ product_category }) => { + console.log(product_category.id); + }); + - lang: Shell + label: cURL + source: | + curl --location --request POST 'https://medusa-url.com/admin/product-categories/{id}' \ + --header 'Authorization: Bearer {api_token}' \ + --header 'Content-Type: application/json' \ + --data-raw '{ + "name": "Skinny Jeans" + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Product Category + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminProductCategoriesCategoryRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' /product-tags: get: operationId: GetProductTags @@ -11233,534 +12014,6 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - /product-categories/{id}/products/batch: - post: - operationId: PostProductCategoriesCategoryProductsBatch - summary: Add Products to a category - description: Assign a batch of products to a product category. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Product Category. - schema: - type: string - - in: query - name: expand - description: (Comma separated) Category fields to be expanded in the response. - schema: - type: string - - in: query - name: fields - description: (Comma separated) Category fields to be retrieved in the response. - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPostProductCategoriesCategoryProductsBatchReq' - x-codegen: - method: addProducts - queryParams: AdminPostProductCategoriesCategoryProductsBatchParams - x-codeSamples: - - lang: JavaScript - label: JS Client - source: | - import Medusa from "@medusajs/medusa-js" - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) - // must be previously logged in or use api token - medusa.admin.productCategories.addProducts(product_category_id, { - product_ids: [ - { - id: product_id - } - ] - }) - .then(({ product_category }) => { - console.log(product_category.id); - }); - - lang: Shell - label: cURL - source: | - curl --location \ - --request POST 'https://medusa-url.com/admin/product-categories/{product_category_id}/products/batch' \ - --header 'Authorization: Bearer {api_token}' \ - --header 'Content-Type: application/json' \ - --data-raw '{ - "product_ids": [ - { - "id": "{product_id}" - } - ] - }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Product Category - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminProductCategoriesCategoryRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - delete: - operationId: DeleteProductCategoriesCategoryProductsBatch - summary: Delete Products - description: Remove a list of products from a product category. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Product Category. - schema: - type: string - - in: query - name: expand - description: (Comma separated) Category fields to be expanded in the response. - schema: - type: string - - in: query - name: fields - description: (Comma separated) Category fields to be retrieved in the response. - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AdminDeleteProductCategoriesCategoryProductsBatchReq' - x-codegen: - method: removeProducts - queryParams: AdminDeleteProductCategoriesCategoryProductsBatchParams - x-codeSamples: - - lang: JavaScript - label: JS Client - source: | - import Medusa from "@medusajs/medusa-js" - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) - // must be previously logged in or use api token - medusa.admin.productCategories.removeProducts(product_category_id, { - product_ids: [ - { - id: product_id - } - ] - }) - .then(({ product_category }) => { - console.log(product_category.id); - }); - - lang: Shell - label: cURL - source: | - curl --location --request DELETE 'https://medusa-url.com/admin/product-categories/{id}/products/batch' \ - --header 'Authorization: Bearer {api_token}' \ - --header 'Content-Type: application/json' \ - --data-raw '{ - "product_ids": [ - { - "id": "{product_id}" - } - ] - }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Product Category - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminProductCategoriesCategoryRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - /product-categories: - post: - operationId: PostProductCategories - summary: Create a Product Category - description: Creates a Product Category. - x-authenticated: true - parameters: - - in: query - name: expand - description: (Comma separated) Which fields should be expanded in the results. - schema: - type: string - - in: query - name: fields - description: (Comma separated) Which fields should be retrieved in the results. - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPostProductCategoriesReq' - x-codegen: - method: create - queryParams: AdminPostProductCategoriesParams - x-codeSamples: - - lang: JavaScript - label: JS Client - source: | - import Medusa from "@medusajs/medusa-js" - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) - // must be previously logged in or use api token - medusa.admin.productCategories.create({ - name: "Skinny Jeans", - }) - .then(({ product_category }) => { - console.log(product_category.id); - }); - - lang: Shell - label: cURL - source: | - curl --location --request POST 'https://medusa-url.com/admin/product-categories' \ - --header 'Authorization: Bearer {api_token}' \ - --header 'Content-Type: application/json' \ - --data-raw '{ - "name": "Skinny Jeans", - }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Product Category - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminProductCategoriesCategoryRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - get: - operationId: GetProductCategories - summary: List Product Categories - description: Retrieve a list of product categories. - x-authenticated: true - parameters: - - in: query - name: q - description: Query used for searching product category names orhandles. - schema: - type: string - - in: query - name: is_internal - description: Search for only internal categories. - schema: - type: boolean - - in: query - name: is_active - description: Search for only active categories - schema: - type: boolean - - in: query - name: parent_category_id - description: Returns categories scoped by parent - schema: - type: string - - in: query - name: offset - description: How many product categories to skip in the result. - schema: - type: integer - default: 0 - - in: query - name: limit - description: Limit the number of product categories returned. - schema: - type: integer - default: 100 - - in: query - name: expand - description: (Comma separated) Which fields should be expanded in the product category. - schema: - type: string - - in: query - name: fields - description: (Comma separated) Which fields should be included in the product category. - schema: - type: string - x-codegen: - method: list - queryParams: AdminGetProductCategoriesParams - x-codeSamples: - - lang: JavaScript - label: JS Client - source: | - import Medusa from "@medusajs/medusa-js" - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) - // must be previously logged in or use api token - medusa.admin.productCategories.list() - .then(({ product_categories, limit, offset, count }) => { - console.log(product_categories.length); - }); - - lang: Shell - label: cURL - source: | - curl --location --request GET 'https://medusa-url.com/admin/product-categories' \ - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Product Category - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminProductCategoriesListRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - /product-categories/{id}: - delete: - operationId: DeleteProductCategoriesCategory - summary: Delete a Product Category - description: Deletes a ProductCategory. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Product Category - schema: - type: string - x-codegen: - method: delete - x-codeSamples: - - lang: JavaScript - label: JS Client - source: | - import Medusa from "@medusajs/medusa-js" - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) - // must be previously logged in or use api token - medusa.admin.productCategories.delete(product_category_id) - .then(({ id, object, deleted }) => { - console.log(id); - }); - - lang: Shell - label: cURL - source: | - curl --location --request DELETE 'https://medusa-url.com/admin/product-categories/{id}' \ - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Product Category - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminProductCategoriesCategoryDeleteRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - get: - operationId: GetProductCategoriesCategory - summary: Get a Product Category - description: Retrieves a Product Category. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Product Category - schema: - type: string - - in: query - name: expand - description: (Comma separated) Which fields should be expanded in the results. - schema: - type: string - - in: query - name: fields - description: (Comma separated) Which fields should be included in the results. - schema: - type: string - x-codegen: - method: retrieve - queryParams: AdminGetProductCategoryParams - x-codeSamples: - - lang: JavaScript - label: JS Client - source: | - import Medusa from "@medusajs/medusa-js" - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) - // must be previously logged in or use api token - medusa.admin.productCategories.retrieve(product_category_id) - .then(({ product_category }) => { - console.log(product_category.id); - }); - - lang: Shell - label: cURL - source: | - curl --location --request GET 'https://medusa-url.com/admin/product-categories/{id}' \ - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Product Category - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminProductCategoriesCategoryRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - post: - operationId: PostProductCategoriesCategory - summary: Update a Product Category - description: Updates a Product Category. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Product Category. - schema: - type: string - - in: query - name: expand - description: (Comma separated) Which fields should be expanded in each product category. - schema: - type: string - - in: query - name: fields - description: (Comma separated) Which fields should be retrieved in each product category. - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPostProductCategoriesCategoryReq' - x-codegen: - method: update - queryParams: AdminPostProductCategoriesCategoryParams - x-codeSamples: - - lang: JavaScript - label: JS Client - source: | - import Medusa from "@medusajs/medusa-js" - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) - // must be previously logged in or use api token - medusa.admin.productCategories.update(product_category_id, { - name: "Skinny Jeans" - }) - .then(({ product_category }) => { - console.log(product_category.id); - }); - - lang: Shell - label: cURL - source: | - curl --location --request POST 'https://medusa-url.com/admin/product-categories/{id}' \ - --header 'Authorization: Bearer {api_token}' \ - --header 'Content-Type: application/json' \ - --data-raw '{ - "name": "Skinny Jeans" - }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Product Category - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminProductCategoriesCategoryRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' /publishable-api-keys/{id}/sales-channels/batch: post: operationId: PostPublishableApiKeySalesChannelsChannelsBatch @@ -13722,6 +13975,196 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' + /returns/{id}/cancel: + post: + operationId: PostReturnsReturnCancel + summary: Cancel a Return + description: Registers a Return as canceled. + parameters: + - in: path + name: id + required: true + description: The ID of the Return. + schema: + type: string + x-codegen: + method: cancel + x-codeSamples: + - lang: JavaScript + label: JS Client + source: | + import Medusa from "@medusajs/medusa-js" + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) + // must be previously logged in or use api token + medusa.admin.returns.cancel(return_id) + .then(({ order }) => { + console.log(order.id); + }); + - lang: Shell + label: cURL + source: | + curl --location --request POST 'https://medusa-url.com/admin/returns/{id}/cancel' \ + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Return + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminReturnsCancelRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + /returns: + get: + operationId: GetReturns + summary: List Returns + description: Retrieves a list of Returns + parameters: + - in: query + name: limit + description: The upper limit for the amount of responses returned. + schema: + type: number + default: '50' + - in: query + name: offset + description: The offset of the list returned. + schema: + type: number + default: '0' + x-codegen: + method: list + queryParams: AdminGetReturnsParams + x-codeSamples: + - lang: JavaScript + label: JS Client + source: | + import Medusa from "@medusajs/medusa-js" + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) + // must be previously logged in or use api token + medusa.admin.returns.list() + .then(({ returns, limit, offset, count }) => { + console.log(returns.length); + }); + - lang: Shell + label: cURL + source: | + curl --location --request GET 'https://medusa-url.com/admin/returns' \ + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Return + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminReturnsListRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + /returns/{id}/receive: + post: + operationId: PostReturnsReturnReceive + summary: Receive a Return + description: Registers a Return as received. Updates statuses on Orders and Swaps accordingly. + parameters: + - in: path + name: id + required: true + description: The ID of the Return. + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPostReturnsReturnReceiveReq' + x-codegen: + method: receive + x-codeSamples: + - lang: JavaScript + label: JS Client + source: | + import Medusa from "@medusajs/medusa-js" + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) + // must be previously logged in or use api token + medusa.admin.returns.receive(return_id, { + items: [ + { + item_id, + quantity: 1 + } + ] + }) + .then((data) => { + console.log(data.return.id); + }); + - lang: Shell + label: cURL + source: | + curl --location --request POST 'https://medusa-url.com/admin/returns/{id}/receive' \ + --header 'Authorization: Bearer {api_token}' \ + --header 'Content-Type: application/json' \ + --data-raw '{ + "items": [ + { + "item_id": "asafg", + "quantity": 1 + } + ] + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Return + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminReturnsRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' /sales-channels/{id}/products/batch: post: operationId: PostSalesChannelsChannelProductsBatch @@ -14396,196 +14839,6 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - /returns/{id}/cancel: - post: - operationId: PostReturnsReturnCancel - summary: Cancel a Return - description: Registers a Return as canceled. - parameters: - - in: path - name: id - required: true - description: The ID of the Return. - schema: - type: string - x-codegen: - method: cancel - x-codeSamples: - - lang: JavaScript - label: JS Client - source: | - import Medusa from "@medusajs/medusa-js" - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) - // must be previously logged in or use api token - medusa.admin.returns.cancel(return_id) - .then(({ order }) => { - console.log(order.id); - }); - - lang: Shell - label: cURL - source: | - curl --location --request POST 'https://medusa-url.com/admin/returns/{id}/cancel' \ - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Return - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminReturnsCancelRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - /returns: - get: - operationId: GetReturns - summary: List Returns - description: Retrieves a list of Returns - parameters: - - in: query - name: limit - description: The upper limit for the amount of responses returned. - schema: - type: number - default: '50' - - in: query - name: offset - description: The offset of the list returned. - schema: - type: number - default: '0' - x-codegen: - method: list - queryParams: AdminGetReturnsParams - x-codeSamples: - - lang: JavaScript - label: JS Client - source: | - import Medusa from "@medusajs/medusa-js" - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) - // must be previously logged in or use api token - medusa.admin.returns.list() - .then(({ returns, limit, offset, count }) => { - console.log(returns.length); - }); - - lang: Shell - label: cURL - source: | - curl --location --request GET 'https://medusa-url.com/admin/returns' \ - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Return - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminReturnsListRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - /returns/{id}/receive: - post: - operationId: PostReturnsReturnReceive - summary: Receive a Return - description: Registers a Return as received. Updates statuses on Orders and Swaps accordingly. - parameters: - - in: path - name: id - required: true - description: The ID of the Return. - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPostReturnsReturnReceiveReq' - x-codegen: - method: receive - x-codeSamples: - - lang: JavaScript - label: JS Client - source: | - import Medusa from "@medusajs/medusa-js" - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) - // must be previously logged in or use api token - medusa.admin.returns.receive(return_id, { - items: [ - { - item_id, - quantity: 1 - } - ] - }) - .then((data) => { - console.log(data.return.id); - }); - - lang: Shell - label: cURL - source: | - curl --location --request POST 'https://medusa-url.com/admin/returns/{id}/receive' \ - --header 'Authorization: Bearer {api_token}' \ - --header 'Content-Type: application/json' \ - --data-raw '{ - "items": [ - { - "item_id": "asafg", - "quantity": 1 - } - ] - }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Return - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminReturnsRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' /shipping-options: post: operationId: PostShippingOptions @@ -15589,6 +15842,323 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' + /store/currencies/{code}: + post: + operationId: PostStoreCurrenciesCode + summary: Add a Currency Code + description: Adds a Currency Code to the available currencies. + x-authenticated: true + parameters: + - in: path + name: code + required: true + description: The 3 character ISO currency code. + schema: + type: string + externalDocs: + url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes + description: See a list of codes. + x-codegen: + method: addCurrency + x-codeSamples: + - lang: JavaScript + label: JS Client + source: | + import Medusa from "@medusajs/medusa-js" + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) + // must be previously logged in or use api token + medusa.admin.store.addCurrency('eur') + .then(({ store }) => { + console.log(store.id); + }); + - lang: Shell + label: cURL + source: | + curl --location --request POST 'https://medusa-url.com/admin/store/currencies/eur' \ + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Store + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminStoresRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + delete: + operationId: DeleteStoreCurrenciesCode + summary: Delete a Currency Code + description: Removes a Currency Code from the available currencies. + x-authenticated: true + parameters: + - in: path + name: code + required: true + description: The 3 character ISO currency code. + schema: + type: string + externalDocs: + url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes + description: See a list of codes. + x-codegen: + method: deleteCurrency + x-codeSamples: + - lang: JavaScript + label: JS Client + source: | + import Medusa from "@medusajs/medusa-js" + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) + // must be previously logged in or use api token + medusa.admin.store.deleteCurrency('eur') + .then(({ store }) => { + console.log(store.id); + }); + - lang: Shell + label: cURL + source: | + curl --location --request DELETE 'https://medusa-url.com/admin/store/currencies/eur' \ + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Store + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminStoresRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + /store: + get: + operationId: GetStore + summary: Get Store details + description: Retrieves the Store details + x-authenticated: true + x-codegen: + method: retrieve + x-codeSamples: + - lang: JavaScript + label: JS Client + source: | + import Medusa from "@medusajs/medusa-js" + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) + // must be previously logged in or use api token + medusa.admin.store.retrieve() + .then(({ store }) => { + console.log(store.id); + }); + - lang: Shell + label: cURL + source: | + curl --location --request GET 'https://medusa-url.com/admin/store' \ + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Store + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminStoresRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + post: + operationId: PostStore + summary: Update Store Details + description: Updates the Store details + x-authenticated: true + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPostStoreReq' + x-codegen: + method: update + x-codeSamples: + - lang: JavaScript + label: JS Client + source: | + import Medusa from "@medusajs/medusa-js" + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) + // must be previously logged in or use api token + medusa.admin.store.update({ + name: 'Medusa Store' + }) + .then(({ store }) => { + console.log(store.id); + }); + - lang: Shell + label: cURL + source: | + curl --location --request POST 'https://medusa-url.com/admin/store' \ + --header 'Authorization: Bearer {api_token}' \ + --header 'Content-Type: application/json' \ + --data-raw '{ + "name": "Medusa Store" + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Store + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminStoresRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + /store/payment-providers: + get: + operationId: GetStorePaymentProviders + summary: List Payment Providers + description: Retrieves the configured Payment Providers + x-authenticated: true + x-codegen: + method: listPaymentProviders + x-codeSamples: + - lang: JavaScript + label: JS Client + source: | + import Medusa from "@medusajs/medusa-js" + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) + // must be previously logged in or use api token + medusa.admin.store.listPaymentProviders() + .then(({ payment_providers }) => { + console.log(payment_providers.length); + }); + - lang: Shell + label: cURL + source: | + curl --location --request GET 'https://medusa-url.com/admin/store/payment-providers' \ + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Store + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPaymentProvidersList' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + /store/tax-providers: + get: + operationId: GetStoreTaxProviders + summary: List Tax Providers + description: Retrieves the configured Tax Providers + x-authenticated: true + x-codegen: + method: listTaxProviders + x-codeSamples: + - lang: JavaScript + label: JS Client + source: | + import Medusa from "@medusajs/medusa-js" + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) + // must be previously logged in or use api token + medusa.admin.store.listTaxProviders() + .then(({ tax_providers }) => { + console.log(tax_providers.length); + }); + - lang: Shell + label: cURL + source: | + curl --location --request GET 'https://medusa-url.com/admin/store/tax-providers' \ + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Store + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminTaxProvidersList' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' /swaps/{id}: get: operationId: GetSwapsSwap @@ -16654,323 +17224,6 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - /store/currencies/{code}: - post: - operationId: PostStoreCurrenciesCode - summary: Add a Currency Code - description: Adds a Currency Code to the available currencies. - x-authenticated: true - parameters: - - in: path - name: code - required: true - description: The 3 character ISO currency code. - schema: - type: string - externalDocs: - url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes - description: See a list of codes. - x-codegen: - method: addCurrency - x-codeSamples: - - lang: JavaScript - label: JS Client - source: | - import Medusa from "@medusajs/medusa-js" - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) - // must be previously logged in or use api token - medusa.admin.store.addCurrency('eur') - .then(({ store }) => { - console.log(store.id); - }); - - lang: Shell - label: cURL - source: | - curl --location --request POST 'https://medusa-url.com/admin/store/currencies/eur' \ - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Store - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminStoresRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - delete: - operationId: DeleteStoreCurrenciesCode - summary: Delete a Currency Code - description: Removes a Currency Code from the available currencies. - x-authenticated: true - parameters: - - in: path - name: code - required: true - description: The 3 character ISO currency code. - schema: - type: string - externalDocs: - url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes - description: See a list of codes. - x-codegen: - method: deleteCurrency - x-codeSamples: - - lang: JavaScript - label: JS Client - source: | - import Medusa from "@medusajs/medusa-js" - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) - // must be previously logged in or use api token - medusa.admin.store.deleteCurrency('eur') - .then(({ store }) => { - console.log(store.id); - }); - - lang: Shell - label: cURL - source: | - curl --location --request DELETE 'https://medusa-url.com/admin/store/currencies/eur' \ - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Store - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminStoresRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - /store: - get: - operationId: GetStore - summary: Get Store details - description: Retrieves the Store details - x-authenticated: true - x-codegen: - method: retrieve - x-codeSamples: - - lang: JavaScript - label: JS Client - source: | - import Medusa from "@medusajs/medusa-js" - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) - // must be previously logged in or use api token - medusa.admin.store.retrieve() - .then(({ store }) => { - console.log(store.id); - }); - - lang: Shell - label: cURL - source: | - curl --location --request GET 'https://medusa-url.com/admin/store' \ - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Store - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminStoresRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - post: - operationId: PostStore - summary: Update Store Details - description: Updates the Store details - x-authenticated: true - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPostStoreReq' - x-codegen: - method: update - x-codeSamples: - - lang: JavaScript - label: JS Client - source: | - import Medusa from "@medusajs/medusa-js" - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) - // must be previously logged in or use api token - medusa.admin.store.update({ - name: 'Medusa Store' - }) - .then(({ store }) => { - console.log(store.id); - }); - - lang: Shell - label: cURL - source: | - curl --location --request POST 'https://medusa-url.com/admin/store' \ - --header 'Authorization: Bearer {api_token}' \ - --header 'Content-Type: application/json' \ - --data-raw '{ - "name": "Medusa Store" - }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Store - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminStoresRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - /store/payment-providers: - get: - operationId: GetStorePaymentProviders - summary: List Payment Providers - description: Retrieves the configured Payment Providers - x-authenticated: true - x-codegen: - method: listPaymentProviders - x-codeSamples: - - lang: JavaScript - label: JS Client - source: | - import Medusa from "@medusajs/medusa-js" - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) - // must be previously logged in or use api token - medusa.admin.store.listPaymentProviders() - .then(({ payment_providers }) => { - console.log(payment_providers.length); - }); - - lang: Shell - label: cURL - source: | - curl --location --request GET 'https://medusa-url.com/admin/store/payment-providers' \ - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Store - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPaymentProvidersList' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - /store/tax-providers: - get: - operationId: GetStoreTaxProviders - summary: List Tax Providers - description: Retrieves the configured Tax Providers - x-authenticated: true - x-codegen: - method: listTaxProviders - x-codeSamples: - - lang: JavaScript - label: JS Client - source: | - import Medusa from "@medusajs/medusa-js" - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) - // must be previously logged in or use api token - medusa.admin.store.listTaxProviders() - .then(({ tax_providers }) => { - console.log(tax_providers.length); - }); - - lang: Shell - label: cURL - source: | - curl --location --request GET 'https://medusa-url.com/admin/store/tax-providers' \ - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Store - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminTaxProvidersList' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' /uploads/protected: post: operationId: PostUploadsProtected @@ -21249,6 +21502,11 @@ components: description: The total of gift cards with taxes type: integer example: 0 + returnable_items: + description: The items that are returnable as part of the order, order swaps or order claims + type: array + items: + $ref: '#/components/schemas/LineItem' created_at: description: The date with timezone at which the resource was created. type: string @@ -24566,89 +24824,6 @@ components: includes_tax: type: boolean description: '[EXPERIMENTAL] Tax included in prices of currency.' - AdminPostCustomersReq: - type: object - required: - - email - - first_name - - last_name - - password - properties: - email: - type: string - description: The customer's email. - format: email - first_name: - type: string - description: The customer's first name. - last_name: - type: string - description: The customer's last name. - password: - type: string - description: The customer's password. - format: password - phone: - type: string - description: The customer's phone number. - metadata: - description: An optional set of key-value pairs to hold additional information. - type: object - AdminCustomersRes: - type: object - properties: - customer: - $ref: '#/components/schemas/Customer' - AdminCustomersListRes: - type: object - properties: - customers: - type: array - items: - $ref: '#/components/schemas/Customer' - 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 - AdminPostCustomersCustomerReq: - type: object - properties: - email: - type: string - description: The Customer's email. - format: email - first_name: - type: string - description: The Customer's first name. - last_name: - type: string - description: The Customer's last name. - phone: - type: string - description: The Customer's phone number. - password: - type: string - description: The Customer's password. - format: password - groups: - type: array - items: - type: object - required: - - id - properties: - id: - description: The ID of a customer group - type: string - description: A list of customer groups to which the customer belongs. - metadata: - description: An optional set of key-value pairs to hold additional information. - type: object AdminPostCustomerGroupsGroupCustomersBatchReq: type: object required: @@ -24736,6 +24911,89 @@ components: metadata: description: Metadata for the customer. type: object + AdminPostCustomersReq: + type: object + required: + - email + - first_name + - last_name + - password + properties: + email: + type: string + description: The customer's email. + format: email + first_name: + type: string + description: The customer's first name. + last_name: + type: string + description: The customer's last name. + password: + type: string + description: The customer's password. + format: password + phone: + type: string + description: The customer's phone number. + metadata: + description: An optional set of key-value pairs to hold additional information. + type: object + AdminCustomersRes: + type: object + properties: + customer: + $ref: '#/components/schemas/Customer' + AdminCustomersListRes: + type: object + properties: + customers: + type: array + items: + $ref: '#/components/schemas/Customer' + 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 + AdminPostCustomersCustomerReq: + type: object + properties: + email: + type: string + description: The Customer's email. + format: email + first_name: + type: string + description: The Customer's first name. + last_name: + type: string + description: The Customer's last name. + phone: + type: string + description: The Customer's phone number. + password: + type: string + description: The Customer's password. + format: password + groups: + type: array + items: + type: object + required: + - id + properties: + id: + description: The ID of a customer group + type: string + description: A list of customer groups to which the customer belongs. + metadata: + description: An optional set of key-value pairs to hold additional information. + type: object AdminPostDiscountsDiscountConditionsConditionBatchReq: type: object required: @@ -25390,71 +25648,6 @@ components: metadata: description: An optional set of key-value pairs to hold additional information. type: object - AdminPostInvitesInviteAcceptReq: - type: object - required: - - token - - user - properties: - token: - description: The invite token provided by the admin. - type: string - user: - description: The User to create. - type: object - required: - - first_name - - last_name - - password - properties: - first_name: - type: string - description: the first name of the User - last_name: - type: string - description: the last name of the User - password: - description: The desired password for the User - type: string - format: password - AdminPostInvitesReq: - type: object - required: - - user - - role - properties: - user: - description: The email for the user to be created. - type: string - format: email - role: - description: The role of the user to be created. - type: string - enum: - - admin - - member - - developer - AdminInviteDeleteRes: - type: object - properties: - id: - type: string - description: The ID of the deleted Invite. - object: - type: string - description: The type of the object that was deleted. - default: invite - deleted: - type: boolean - description: Whether or not the Invite was deleted. - default: true - AdminListInvitesRes: - type: object - properties: - invites: - type: array - items: - $ref: '#/components/schemas/Invite' AdminPostInventoryItemsItemLocationLevelsReq: type: object required: @@ -25583,24 +25776,71 @@ components: incoming_quantity: description: the incoming stock quantity of an inventory item at the given location ID type: number - AdminNotificationsListRes: + AdminPostInvitesInviteAcceptReq: + type: object + required: + - token + - user + properties: + token: + description: The invite token provided by the admin. + type: string + user: + description: The User to create. + type: object + required: + - first_name + - last_name + - password + properties: + first_name: + type: string + description: the first name of the User + last_name: + type: string + description: the last name of the User + password: + description: The desired password for the User + type: string + format: password + AdminPostInvitesReq: + type: object + required: + - user + - role + properties: + user: + description: The email for the user to be created. + type: string + format: email + role: + description: The role of the user to be created. + type: string + enum: + - admin + - member + - developer + AdminInviteDeleteRes: type: object properties: - notifications: + id: + type: string + description: The ID of the deleted Invite. + object: + type: string + description: The type of the object that was deleted. + default: invite + deleted: + type: boolean + description: Whether or not the Invite was deleted. + default: true + AdminListInvitesRes: + type: object + properties: + invites: type: array items: - $ref: '#/components/schemas/Notification' - AdminNotificationsRes: - type: object - properties: - notification: - $ref: '#/components/schemas/Notification' - AdminPostNotificationsNotificationResendReq: - type: object - properties: - to: - description: A new address or user identifier that the Notification should be sent to - type: string + $ref: '#/components/schemas/Invite' AdminPostNotesReq: type: object required: @@ -25660,6 +25900,24 @@ components: value: type: string description: The updated description of the Note. + AdminNotificationsListRes: + type: object + properties: + notifications: + type: array + items: + $ref: '#/components/schemas/Notification' + AdminNotificationsRes: + type: object + properties: + notification: + $ref: '#/components/schemas/Notification' + AdminPostNotificationsNotificationResendReq: + type: object + properties: + to: + description: A new address or user identifier that the Notification should be sent to + type: string AdminPostOrderEditsEditLineItemsReq: type: object required: @@ -25749,34 +26007,6 @@ components: internal_note: description: An optional note to create or update for the order edit. type: string - AdminPaymentCollectionsRes: - type: object - properties: - payment_collection: - $ref: '#/components/schemas/PaymentCollection' - AdminPaymentCollectionDeleteRes: - type: object - properties: - id: - type: string - description: The ID of the deleted Payment Collection. - object: - type: string - description: The type of the object that was deleted. - default: payment_collection - deleted: - type: boolean - description: Whether or not the Payment Collection was deleted. - default: true - AdminUpdatePaymentCollectionsReq: - type: object - properties: - description: - description: An optional description to create or update the payment collection. - type: string - metadata: - description: An optional set of key-value pairs to hold additional information. - type: object AdminPostOrdersOrderShippingMethodsReq: type: object required: @@ -26306,6 +26536,34 @@ components: no_notification: description: A flag to indicate if no notifications should be emitted related to the updated order. type: boolean + AdminPaymentCollectionsRes: + type: object + properties: + payment_collection: + $ref: '#/components/schemas/PaymentCollection' + AdminPaymentCollectionDeleteRes: + type: object + properties: + id: + type: string + description: The ID of the deleted Payment Collection. + object: + type: string + description: The type of the object that was deleted. + default: payment_collection + deleted: + type: boolean + description: Whether or not the Payment Collection was deleted. + default: true + AdminUpdatePaymentCollectionsReq: + type: object + properties: + description: + description: An optional description to create or update the payment collection. + type: string + metadata: + description: An optional set of key-value pairs to hold additional information. + type: object AdminPaymentRes: type: object properties: @@ -26631,6 +26889,111 @@ components: includes_tax: description: '[EXPERIMENTAL] Tax included in prices of price list' type: boolean + AdminPostProductCategoriesCategoryProductsBatchReq: + type: object + required: + - product_ids + properties: + product_ids: + description: The IDs of the products to add to the Product Category + type: array + items: + type: object + required: + - id + properties: + id: + type: string + description: The ID of the product + AdminPostProductCategoriesReq: + type: object + required: + - name + properties: + name: + type: string + description: The name to identify the Product Category by. + handle: + type: string + description: An optional handle to be used in slugs, if none is provided we will kebab-case the title. + is_internal: + type: boolean + description: A flag to make product category an internal category for admins + is_active: + type: boolean + description: A flag to make product category visible/hidden in the store front + parent_category_id: + type: string + description: The ID of the parent product category + AdminDeleteProductCategoriesCategoryProductsBatchReq: + type: object + required: + - product_ids + properties: + product_ids: + description: The IDs of the products to delete from the Product Category. + type: array + items: + type: object + required: + - id + properties: + id: + description: The ID of a product + type: string + AdminProductCategoriesCategoryRes: + type: object + properties: + product_category: + $ref: '#/components/schemas/ProductCategory' + AdminProductCategoriesCategoryDeleteRes: + type: object + properties: + id: + type: string + description: The ID of the deleted product category + object: + type: string + description: The type of the object that was deleted. + default: product-category + deleted: + type: boolean + description: Whether or not the items were deleted. + default: true + AdminProductCategoriesListRes: + type: object + properties: + product_categories: + type: array + items: + $ref: '#/components/schemas/ProductCategory' + 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 + AdminPostProductCategoriesCategoryReq: + type: object + properties: + name: + type: string + description: The name to identify the Product Category by. + handle: + type: string + description: A handle to be used in slugs. + is_internal: + type: boolean + description: A flag to make product category an internal category for admins + is_active: + type: boolean + description: A flag to make product category visible/hidden in the store front + parent_category_id: + type: string + description: The ID of the parent product category AdminProductTagsListRes: type: object properties: @@ -27435,111 +27798,6 @@ components: value: description: The value to give for the Product Option. type: string - AdminPostProductCategoriesCategoryProductsBatchReq: - type: object - required: - - product_ids - properties: - product_ids: - description: The IDs of the products to add to the Product Category - type: array - items: - type: object - required: - - id - properties: - id: - type: string - description: The ID of the product - AdminPostProductCategoriesReq: - type: object - required: - - name - properties: - name: - type: string - description: The name to identify the Product Category by. - handle: - type: string - description: An optional handle to be used in slugs, if none is provided we will kebab-case the title. - is_internal: - type: boolean - description: A flag to make product category an internal category for admins - is_active: - type: boolean - description: A flag to make product category visible/hidden in the store front - parent_category_id: - type: string - description: The ID of the parent product category - AdminDeleteProductCategoriesCategoryProductsBatchReq: - type: object - required: - - product_ids - properties: - product_ids: - description: The IDs of the products to delete from the Product Category. - type: array - items: - type: object - required: - - id - properties: - id: - description: The ID of a product - type: string - AdminProductCategoriesCategoryRes: - type: object - properties: - product_category: - $ref: '#/components/schemas/ProductCategory' - AdminProductCategoriesCategoryDeleteRes: - type: object - properties: - id: - type: string - description: The ID of the deleted product category - object: - type: string - description: The type of the object that was deleted. - default: product-category - deleted: - type: boolean - description: Whether or not the items were deleted. - default: true - AdminProductCategoriesListRes: - type: object - properties: - product_categories: - type: array - items: - $ref: '#/components/schemas/ProductCategory' - 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 - AdminPostProductCategoriesCategoryReq: - type: object - properties: - name: - type: string - description: The name to identify the Product Category by. - handle: - type: string - description: A handle to be used in slugs. - is_internal: - type: boolean - description: A flag to make product category an internal category for admins - is_active: - type: boolean - description: A flag to make product category visible/hidden in the store front - parent_category_id: - type: string - description: The ID of the parent product category AdminPostPublishableApiKeySalesChannelsBatchReq: type: object required: @@ -27895,6 +28153,55 @@ components: metadata: description: An optional set of key-value pairs with additional information. type: object + AdminReturnsCancelRes: + type: object + properties: + order: + $ref: '#/components/schemas/Order' + AdminReturnsListRes: + type: object + properties: + returns: + type: array + items: + $ref: '#/components/schemas/Return' + 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 + AdminReturnsRes: + type: object + properties: + return: + $ref: '#/components/schemas/Return' + AdminPostReturnsReturnReceiveReq: + type: object + required: + - items + properties: + items: + description: The Line Items that have been received. + type: array + items: + type: object + required: + - item_id + - quantity + properties: + item_id: + description: The ID of the Line Item. + type: string + quantity: + description: The quantity of the Line Item. + type: integer + refund: + description: The amount to refund. + type: number AdminPostSalesChannelsChannelProductsBatchReq: type: object required: @@ -28018,55 +28325,6 @@ components: is_disabled: type: boolean description: Indication of if the sales channel is active. - AdminReturnsCancelRes: - type: object - properties: - order: - $ref: '#/components/schemas/Order' - AdminReturnsListRes: - type: object - properties: - returns: - type: array - items: - $ref: '#/components/schemas/Return' - 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 - AdminReturnsRes: - type: object - properties: - return: - $ref: '#/components/schemas/Return' - AdminPostReturnsReturnReceiveReq: - type: object - required: - - items - properties: - items: - description: The Line Items that have been received. - type: array - items: - type: object - required: - - item_id - - quantity - properties: - item_id: - description: The ID of the Line Item. - type: string - quantity: - description: The quantity of the Line Item. - type: integer - refund: - description: The amount to refund. - type: number AdminPostShippingOptionsReq: type: object required: @@ -28335,6 +28593,54 @@ components: car: white address: $ref: '#/components/schemas/StockLocationAddressInput' + AdminStoresRes: + type: object + properties: + store: + $ref: '#/components/schemas/Store' + AdminTaxProvidersList: + type: object + properties: + tax_providers: + type: array + items: + $ref: '#/components/schemas/TaxProvider' + AdminPaymentProvidersList: + type: object + properties: + payment_providers: + type: array + items: + $ref: '#/components/schemas/PaymentProvider' + AdminPostStoreReq: + type: object + properties: + name: + description: The name of the Store + type: string + swap_link_template: + description: A template for Swap links - use `{{cart_id}}` to insert the Swap Cart id + type: string + payment_link_template: + description: A template for payment links links - use `{{cart_id}}` to insert the Cart id + type: string + invite_link_template: + description: A template for invite links - use `{{invite_token}}` to insert the invite token + type: string + default_currency_code: + description: The default currency code for the Store. + type: string + externalDocs: + url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes + description: See a list of codes. + currencies: + description: Array of currencies in 2 character ISO code format. + type: array + items: + type: string + metadata: + description: An optional set of key-value pairs with additional information. + type: object AdminSwapsListRes: type: object properties: @@ -28515,54 +28821,6 @@ components: description: The IDs of the types of products associated with this tax rate items: type: string - AdminStoresRes: - type: object - properties: - store: - $ref: '#/components/schemas/Store' - AdminTaxProvidersList: - type: object - properties: - tax_providers: - type: array - items: - $ref: '#/components/schemas/TaxProvider' - AdminPaymentProvidersList: - type: object - properties: - payment_providers: - type: array - items: - $ref: '#/components/schemas/PaymentProvider' - AdminPostStoreReq: - type: object - properties: - name: - description: The name of the Store - type: string - swap_link_template: - description: A template for Swap links - use `{{cart_id}}` to insert the Swap Cart id - type: string - payment_link_template: - description: A template for payment links links - use `{{cart_id}}` to insert the Cart id - type: string - invite_link_template: - description: A template for invite links - use `{{invite_token}}` to insert the invite token - type: string - default_currency_code: - description: The default currency code for the Store. - type: string - externalDocs: - url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes - description: See a list of codes. - currencies: - description: Array of currencies in 2 character ISO code format. - type: array - items: - type: string - metadata: - description: An optional set of key-value pairs with additional information. - type: object AdminDeleteUploadsReq: type: object required: diff --git a/docs/api/admin/components/schemas/Order.yaml b/docs/api/admin/components/schemas/Order.yaml index 5247e989ad..26d73485be 100644 --- a/docs/api/admin/components/schemas/Order.yaml +++ b/docs/api/admin/components/schemas/Order.yaml @@ -303,6 +303,13 @@ properties: description: The total of gift cards with taxes type: integer example: 0 + returnable_items: + description: >- + The items that are returnable as part of the order, order swaps or order + claims + type: array + items: + $ref: ./LineItem.yaml created_at: description: The date with timezone at which the resource was created. type: string diff --git a/docs/api/admin/openapi.yaml b/docs/api/admin/openapi.yaml index eb6c23a7f1..df9e611bb6 100644 --- a/docs/api/admin/openapi.yaml +++ b/docs/api/admin/openapi.yaml @@ -197,10 +197,6 @@ paths: $ref: paths/currencies.yaml /currencies/{code}: $ref: paths/currencies_{code}.yaml - /customers: - $ref: paths/customers.yaml - /customers/{id}: - $ref: paths/customers_{id}.yaml /customer-groups/{id}/customers/batch: $ref: paths/customer-groups_{id}_customers_batch.yaml /customer-groups: @@ -209,6 +205,10 @@ paths: $ref: paths/customer-groups_{id}.yaml /customer-groups/{id}/customers: $ref: paths/customer-groups_{id}_customers.yaml + /customers: + $ref: paths/customers.yaml + /customers/{id}: + $ref: paths/customers_{id}.yaml /discounts/{id}/regions/{region_id}: $ref: paths/discounts_{id}_regions_{region_id}.yaml /discounts/{discount_id}/conditions/{condition_id}/batch: @@ -243,14 +243,6 @@ paths: $ref: paths/gift-cards.yaml /gift-cards/{id}: $ref: paths/gift-cards_{id}.yaml - /invites/accept: - $ref: paths/invites_accept.yaml - /invites: - $ref: paths/invites.yaml - /invites/{invite_id}: - $ref: paths/invites_{invite_id}.yaml - /invites/{invite_id}/resend: - $ref: paths/invites_{invite_id}_resend.yaml /inventory-items/{id}/location-levels: $ref: paths/inventory-items_{id}_location-levels.yaml /inventory-items/{id}: @@ -259,14 +251,22 @@ paths: $ref: paths/inventory-items_{id}_location-levels_{location_id}.yaml /inventory-items: $ref: paths/inventory-items.yaml - /notifications: - $ref: paths/notifications.yaml - /notifications/{id}/resend: - $ref: paths/notifications_{id}_resend.yaml + /invites/accept: + $ref: paths/invites_accept.yaml + /invites: + $ref: paths/invites.yaml + /invites/{invite_id}: + $ref: paths/invites_{invite_id}.yaml + /invites/{invite_id}/resend: + $ref: paths/invites_{invite_id}_resend.yaml /notes: $ref: paths/notes.yaml /notes/{id}: $ref: paths/notes_{id}.yaml + /notifications: + $ref: paths/notifications.yaml + /notifications/{id}/resend: + $ref: paths/notifications_{id}_resend.yaml /order-edits/{id}/items: $ref: paths/order-edits_{id}_items.yaml /order-edits/{id}/cancel: @@ -283,10 +283,6 @@ paths: $ref: paths/order-edits_{id}.yaml /order-edits/{id}/request: $ref: paths/order-edits_{id}_request.yaml - /payment-collections/{id}: - $ref: paths/payment-collections_{id}.yaml - /payment-collections/{id}/authorize: - $ref: paths/payment-collections_{id}_authorize.yaml /orders/{id}/shipping-methods: $ref: paths/orders_{id}_shipping-methods.yaml /orders/{id}/archive: @@ -341,6 +337,10 @@ paths: $ref: paths/orders_{id}_return.yaml /order/{id}/claims/{claim_id}: $ref: paths/order_{id}_claims_{claim_id}.yaml + /payment-collections/{id}: + $ref: paths/payment-collections_{id}.yaml + /payment-collections/{id}/authorize: + $ref: paths/payment-collections_{id}_authorize.yaml /payments/{id}/capture: $ref: paths/payments_{id}_capture.yaml /payments/{id}: @@ -359,6 +359,12 @@ paths: $ref: paths/price-lists_{id}_variants_{variant_id}_prices.yaml /price-lists/{id}/products: $ref: paths/price-lists_{id}_products.yaml + /product-categories/{id}/products/batch: + $ref: paths/product-categories_{id}_products_batch.yaml + /product-categories: + $ref: paths/product-categories.yaml + /product-categories/{id}: + $ref: paths/product-categories_{id}.yaml /product-tags: $ref: paths/product-tags.yaml /product-types: @@ -381,12 +387,6 @@ paths: $ref: paths/products_types.yaml /products/{id}/metadata: $ref: paths/products_{id}_metadata.yaml - /product-categories/{id}/products/batch: - $ref: paths/product-categories_{id}_products_batch.yaml - /product-categories: - $ref: paths/product-categories.yaml - /product-categories/{id}: - $ref: paths/product-categories_{id}.yaml /publishable-api-keys/{id}/sales-channels/batch: $ref: paths/publishable-api-keys_{id}_sales-channels_batch.yaml /publishable-api-keys: @@ -425,6 +425,12 @@ paths: $ref: paths/return-reasons.yaml /return-reasons/{id}: $ref: paths/return-reasons_{id}.yaml + /returns/{id}/cancel: + $ref: paths/returns_{id}_cancel.yaml + /returns: + $ref: paths/returns.yaml + /returns/{id}/receive: + $ref: paths/returns_{id}_receive.yaml /sales-channels/{id}/products/batch: $ref: paths/sales-channels_{id}_products_batch.yaml /sales-channels/{id}/stock-locations: @@ -433,12 +439,6 @@ paths: $ref: paths/sales-channels.yaml /sales-channels/{id}: $ref: paths/sales-channels_{id}.yaml - /returns/{id}/cancel: - $ref: paths/returns_{id}_cancel.yaml - /returns: - $ref: paths/returns.yaml - /returns/{id}/receive: - $ref: paths/returns_{id}_receive.yaml /shipping-options: $ref: paths/shipping-options.yaml /shipping-options/{id}: @@ -451,6 +451,14 @@ paths: $ref: paths/stock-locations.yaml /stock-locations/{id}: $ref: paths/stock-locations_{id}.yaml + /store/currencies/{code}: + $ref: paths/store_currencies_{code}.yaml + /store: + $ref: paths/store.yaml + /store/payment-providers: + $ref: paths/store_payment-providers.yaml + /store/tax-providers: + $ref: paths/store_tax-providers.yaml /swaps/{id}: $ref: paths/swaps_{id}.yaml /swaps: @@ -465,14 +473,6 @@ paths: $ref: paths/tax-rates.yaml /tax-rates/{id}: $ref: paths/tax-rates_{id}.yaml - /store/currencies/{code}: - $ref: paths/store_currencies_{code}.yaml - /store: - $ref: paths/store.yaml - /store/payment-providers: - $ref: paths/store_payment-providers.yaml - /store/tax-providers: - $ref: paths/store_tax-providers.yaml /uploads/protected: $ref: paths/uploads_protected.yaml /uploads: diff --git a/docs/api/admin/paths/order_{id}_claims.yaml b/docs/api/admin/paths/order_{id}_claims.yaml index 79b864b18e..b9e5445e8c 100644 --- a/docs/api/admin/paths/order_{id}_claims.yaml +++ b/docs/api/admin/paths/order_{id}_claims.yaml @@ -10,6 +10,16 @@ post: description: The ID of the Order. schema: type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string requestBody: content: application/json: @@ -17,6 +27,7 @@ post: $ref: ../components/schemas/AdminPostOrdersOrderClaimsReq.yaml x-codegen: method: createClaim + params: AdminPostOrdersOrderClaimsParams x-codeSamples: - lang: JavaScript label: JS Client diff --git a/docs/api/admin/paths/order_{id}_claims_{claim_id}.yaml b/docs/api/admin/paths/order_{id}_claims_{claim_id}.yaml index f54dfd8f8c..a91f61b942 100644 --- a/docs/api/admin/paths/order_{id}_claims_{claim_id}.yaml +++ b/docs/api/admin/paths/order_{id}_claims_{claim_id}.yaml @@ -16,6 +16,16 @@ post: description: The ID of the Claim. schema: type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string requestBody: content: application/json: @@ -23,6 +33,7 @@ post: $ref: ../components/schemas/AdminPostOrdersOrderClaimsClaimReq.yaml x-codegen: method: updateClaim + params: AdminPostOrdersOrderClaimsClaimParams x-codeSamples: - lang: JavaScript label: JS Client diff --git a/docs/api/admin/paths/order_{id}_swaps.yaml b/docs/api/admin/paths/order_{id}_swaps.yaml index 7961755f41..1aa00a6fb7 100644 --- a/docs/api/admin/paths/order_{id}_swaps.yaml +++ b/docs/api/admin/paths/order_{id}_swaps.yaml @@ -12,6 +12,20 @@ post: description: The ID of the Order. schema: type: string + - in: query + name: expand + description: >- + (Comma separated) Which fields should be expanded the order of the + result. + schema: + type: string + - in: query + name: fields + description: >- + (Comma separated) Which fields should be included the order of the + result. + schema: + type: string requestBody: content: application/json: @@ -19,6 +33,7 @@ post: $ref: ../components/schemas/AdminPostOrdersOrderSwapsReq.yaml x-codegen: method: createSwap + queryParams: AdminPostOrdersOrderSwapsParams x-codeSamples: - lang: JavaScript label: JS Client diff --git a/docs/api/admin/paths/orders_{id}.yaml b/docs/api/admin/paths/orders_{id}.yaml index 4f13709710..555f7b277a 100644 --- a/docs/api/admin/paths/orders_{id}.yaml +++ b/docs/api/admin/paths/orders_{id}.yaml @@ -68,6 +68,16 @@ post: description: The ID of the Order. schema: type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string requestBody: content: application/json: @@ -75,6 +85,7 @@ post: $ref: ../components/schemas/AdminPostOrdersOrderReq.yaml x-codegen: method: update + params: AdminPostOrdersOrderParams x-codeSamples: - lang: JavaScript label: JS Client diff --git a/docs/api/admin/paths/orders_{id}_archive.yaml b/docs/api/admin/paths/orders_{id}_archive.yaml index 887fde4edb..10fbab9ecc 100644 --- a/docs/api/admin/paths/orders_{id}_archive.yaml +++ b/docs/api/admin/paths/orders_{id}_archive.yaml @@ -10,8 +10,19 @@ post: description: The ID of the Order. schema: type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string x-codegen: method: archive + params: AdminPostOrdersOrderArchiveParams x-codeSamples: - lang: JavaScript label: JS Client diff --git a/docs/api/admin/paths/orders_{id}_cancel.yaml b/docs/api/admin/paths/orders_{id}_cancel.yaml index 3435f201c3..7c499cbd0a 100644 --- a/docs/api/admin/paths/orders_{id}_cancel.yaml +++ b/docs/api/admin/paths/orders_{id}_cancel.yaml @@ -13,8 +13,19 @@ post: description: The ID of the Order. schema: type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string x-codegen: method: cancel + params: AdminPostOrdersOrderCancel x-codeSamples: - lang: JavaScript label: JS Client diff --git a/docs/api/admin/paths/orders_{id}_capture.yaml b/docs/api/admin/paths/orders_{id}_capture.yaml index c123df3c15..240ae56920 100644 --- a/docs/api/admin/paths/orders_{id}_capture.yaml +++ b/docs/api/admin/paths/orders_{id}_capture.yaml @@ -10,8 +10,19 @@ post: description: The ID of the Order. schema: type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string x-codegen: method: capturePayment + params: AdminPostOrdersOrderCaptureParams x-codeSamples: - lang: JavaScript label: JS Client diff --git a/docs/api/admin/paths/orders_{id}_claims_{claim_id}_cancel.yaml b/docs/api/admin/paths/orders_{id}_claims_{claim_id}_cancel.yaml index 3121aeadd5..c380d75a35 100644 --- a/docs/api/admin/paths/orders_{id}_claims_{claim_id}_cancel.yaml +++ b/docs/api/admin/paths/orders_{id}_claims_{claim_id}_cancel.yaml @@ -16,8 +16,19 @@ post: description: The ID of the Claim. schema: type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string x-codegen: method: cancelClaim + params: AdminPostOrdersClaimCancel x-codeSamples: - lang: JavaScript label: JS Client diff --git a/docs/api/admin/paths/orders_{id}_claims_{claim_id}_fulfillments.yaml b/docs/api/admin/paths/orders_{id}_claims_{claim_id}_fulfillments.yaml index a5765acd2f..4c0fa7d0a4 100644 --- a/docs/api/admin/paths/orders_{id}_claims_{claim_id}_fulfillments.yaml +++ b/docs/api/admin/paths/orders_{id}_claims_{claim_id}_fulfillments.yaml @@ -16,6 +16,16 @@ post: description: The ID of the Claim. schema: type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string requestBody: content: application/json: @@ -24,6 +34,7 @@ post: ../components/schemas/AdminPostOrdersOrderClaimsClaimFulfillmentsReq.yaml x-codegen: method: fulfillClaim + params: AdminPostOrdersOrderClaimsClaimFulfillmentsReq x-codeSamples: - lang: JavaScript label: JS Client diff --git a/docs/api/admin/paths/orders_{id}_claims_{claim_id}_fulfillments_{fulfillment_id}_cancel.yaml b/docs/api/admin/paths/orders_{id}_claims_{claim_id}_fulfillments_{fulfillment_id}_cancel.yaml index 1b710a2a4d..dcfb4b1201 100644 --- a/docs/api/admin/paths/orders_{id}_claims_{claim_id}_fulfillments_{fulfillment_id}_cancel.yaml +++ b/docs/api/admin/paths/orders_{id}_claims_{claim_id}_fulfillments_{fulfillment_id}_cancel.yaml @@ -22,8 +22,19 @@ post: description: The ID of the Fulfillment. schema: type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string x-codegen: method: cancelClaimFulfillment + params: AdminPostOrdersClaimFulfillmentsCancelParams x-codeSamples: - lang: JavaScript label: JS Client diff --git a/docs/api/admin/paths/orders_{id}_claims_{claim_id}_shipments.yaml b/docs/api/admin/paths/orders_{id}_claims_{claim_id}_shipments.yaml index 4105a6e953..c510f0ac12 100644 --- a/docs/api/admin/paths/orders_{id}_claims_{claim_id}_shipments.yaml +++ b/docs/api/admin/paths/orders_{id}_claims_{claim_id}_shipments.yaml @@ -16,6 +16,16 @@ post: description: The ID of the Claim. schema: type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string requestBody: content: application/json: @@ -24,6 +34,7 @@ post: ../components/schemas/AdminPostOrdersOrderClaimsClaimShipmentsReq.yaml x-codegen: method: createClaimShipment + params: AdminPostOrdersOrderClaimsClaimShipmentsParams x-codeSamples: - lang: JavaScript label: JS Client diff --git a/docs/api/admin/paths/orders_{id}_complete.yaml b/docs/api/admin/paths/orders_{id}_complete.yaml index 77a3ccd082..29d3d5a529 100644 --- a/docs/api/admin/paths/orders_{id}_complete.yaml +++ b/docs/api/admin/paths/orders_{id}_complete.yaml @@ -10,8 +10,19 @@ post: description: The ID of the Order. schema: type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string x-codegen: method: complete + params: AdminPostOrdersOrderCompleteParams x-codeSamples: - lang: JavaScript label: JS Client diff --git a/docs/api/admin/paths/orders_{id}_fulfillment.yaml b/docs/api/admin/paths/orders_{id}_fulfillment.yaml index 959a9fdbe8..78331b8a72 100644 --- a/docs/api/admin/paths/orders_{id}_fulfillment.yaml +++ b/docs/api/admin/paths/orders_{id}_fulfillment.yaml @@ -12,6 +12,16 @@ post: description: The ID of the Order. schema: type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string requestBody: content: application/json: @@ -19,6 +29,7 @@ post: $ref: ../components/schemas/AdminPostOrdersOrderFulfillmentsReq.yaml x-codegen: method: createFulfillment + params: AdminPostOrdersOrderFulfillmentsParams x-codeSamples: - lang: JavaScript label: JS Client diff --git a/docs/api/admin/paths/orders_{id}_fulfillments_{fulfillment_id}_cancel.yaml b/docs/api/admin/paths/orders_{id}_fulfillments_{fulfillment_id}_cancel.yaml index 28d300c753..ad8e739fda 100644 --- a/docs/api/admin/paths/orders_{id}_fulfillments_{fulfillment_id}_cancel.yaml +++ b/docs/api/admin/paths/orders_{id}_fulfillments_{fulfillment_id}_cancel.yaml @@ -16,8 +16,19 @@ post: description: The ID of the Fulfillment schema: type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string x-codegen: method: cancelFulfillment + params: AdminPostOrdersOrderFulfillementsCancelParams x-codeSamples: - lang: JavaScript label: JS Client diff --git a/docs/api/admin/paths/orders_{id}_refund.yaml b/docs/api/admin/paths/orders_{id}_refund.yaml index 505319e781..d05590568a 100644 --- a/docs/api/admin/paths/orders_{id}_refund.yaml +++ b/docs/api/admin/paths/orders_{id}_refund.yaml @@ -10,6 +10,16 @@ post: description: The ID of the Order. schema: type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string requestBody: content: application/json: @@ -17,6 +27,7 @@ post: $ref: ../components/schemas/AdminPostOrdersOrderRefundsReq.yaml x-codegen: method: refundPayment + params: AdminPostOrdersOrderRefundsParams x-codeSamples: - lang: JavaScript label: JS Client diff --git a/docs/api/admin/paths/orders_{id}_return.yaml b/docs/api/admin/paths/orders_{id}_return.yaml index 209c6b1367..d034374384 100644 --- a/docs/api/admin/paths/orders_{id}_return.yaml +++ b/docs/api/admin/paths/orders_{id}_return.yaml @@ -12,6 +12,16 @@ post: description: The ID of the Order. schema: type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string requestBody: content: application/json: @@ -19,6 +29,7 @@ post: $ref: ../components/schemas/AdminPostOrdersOrderReturnsReq.yaml x-codegen: method: requestReturn + params: AdminPostOrdersOrderReturnsParams x-codeSamples: - lang: JavaScript label: JS Client diff --git a/docs/api/admin/paths/orders_{id}_shipment.yaml b/docs/api/admin/paths/orders_{id}_shipment.yaml index e515068d65..138e916c1b 100644 --- a/docs/api/admin/paths/orders_{id}_shipment.yaml +++ b/docs/api/admin/paths/orders_{id}_shipment.yaml @@ -10,6 +10,16 @@ post: description: The ID of the Order. schema: type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string requestBody: content: application/json: @@ -17,6 +27,7 @@ post: $ref: ../components/schemas/AdminPostOrdersOrderShipmentReq.yaml x-codegen: method: createShipment + params: AdminPostOrdersOrderShipmentParams x-codeSamples: - lang: JavaScript label: JS Client diff --git a/docs/api/admin/paths/orders_{id}_shipping-methods.yaml b/docs/api/admin/paths/orders_{id}_shipping-methods.yaml index 33f35845e3..27014e6203 100644 --- a/docs/api/admin/paths/orders_{id}_shipping-methods.yaml +++ b/docs/api/admin/paths/orders_{id}_shipping-methods.yaml @@ -11,6 +11,16 @@ post: description: The ID of the Order. schema: type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string requestBody: content: application/json: @@ -19,6 +29,7 @@ post: x-authenticated: true x-codegen: method: addShippingMethod + params: AdminPostOrdersOrderShippingMethodsParams x-codeSamples: - lang: JavaScript label: JS Client diff --git a/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_cancel.yaml b/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_cancel.yaml index 14f3e851aa..2dec550158 100644 --- a/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_cancel.yaml +++ b/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_cancel.yaml @@ -16,8 +16,19 @@ post: description: The ID of the Swap. schema: type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string x-codegen: method: cancelSwap + params: AdminPostOrdersSwapCancelParams x-codeSamples: - lang: JavaScript label: JS Client diff --git a/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_fulfillments.yaml b/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_fulfillments.yaml index 930b2c27da..cacdf51ac9 100644 --- a/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_fulfillments.yaml +++ b/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_fulfillments.yaml @@ -16,6 +16,16 @@ post: description: The ID of the Swap. schema: type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string requestBody: content: application/json: @@ -24,6 +34,7 @@ post: ../components/schemas/AdminPostOrdersOrderSwapsSwapFulfillmentsReq.yaml x-codegen: method: fulfillSwap + params: AdminPostOrdersOrderSwapsSwapFulfillmentsParams x-codeSamples: - lang: JavaScript label: JS Client diff --git a/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_fulfillments_{fulfillment_id}_cancel.yaml b/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_fulfillments_{fulfillment_id}_cancel.yaml index bbb2ee1119..e1a205e7e9 100644 --- a/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_fulfillments_{fulfillment_id}_cancel.yaml +++ b/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_fulfillments_{fulfillment_id}_cancel.yaml @@ -22,8 +22,19 @@ post: description: The ID of the Fulfillment. schema: type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string x-codegen: method: cancelSwapFulfillment + params: AdminPostOrdersSwapFulfillementsCancelParams x-codeSamples: - lang: JavaScript label: JS Client diff --git a/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_process-payment.yaml b/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_process-payment.yaml index 0e8e6662af..c5aca27e66 100644 --- a/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_process-payment.yaml +++ b/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_process-payment.yaml @@ -19,8 +19,19 @@ post: description: The ID of the Swap. schema: type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string x-codegen: method: processSwapPayment + params: AdminPostOrdersOrderSwapsSwapProcessPaymentParams x-codeSamples: - lang: JavaScript label: JS Client diff --git a/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_shipments.yaml b/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_shipments.yaml index da59a0ff0c..8339a2ea01 100644 --- a/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_shipments.yaml +++ b/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_shipments.yaml @@ -16,6 +16,16 @@ post: description: The ID of the Swap. schema: type: string + - in: query + name: expand + description: Comma separated list of relations to include in the result. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the result. + schema: + type: string requestBody: content: application/json: @@ -23,6 +33,7 @@ post: $ref: ../components/schemas/AdminPostOrdersOrderSwapsSwapShipmentsReq.yaml x-codegen: method: createSwapShipment + params: AdminPostOrdersOrderSwapsSwapShipmentsParams x-codeSamples: - lang: JavaScript label: JS Client diff --git a/docs/api/store-spec3.json b/docs/api/store-spec3.json index 6e5cd0fcc5..da7d1fb54f 100644 --- a/docs/api/store-spec3.json +++ b/docs/api/store-spec3.json @@ -1170,551 +1170,6 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - '/gift-cards/{code}': - get: - operationId: GetGiftCardsCode - summary: Get Gift Card by Code - description: Retrieves a Gift Card by its associated unique code. - parameters: - - in: path - name: code - required: true - description: The unique Gift Card code. - schema: - type: string - x-codegen: - method: retrieve - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - medusa.giftCards.retrieve(code) - - .then(({ gift_card }) => { - console.log(gift_card.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request GET - 'https://medusa-url.com/store/gift-cards/{code}' - tags: - - Gift Card - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/StoreGiftCardsRes' - '400': - $ref: '#/components/responses/400_error' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - '/order-edits/{id}/complete': - post: - operationId: PostOrderEditsOrderEditComplete - summary: Completes an OrderEdit - description: Completes an OrderEdit. - parameters: - - in: path - name: id - required: true - description: The ID of the Order Edit. - schema: - type: string - x-codegen: - method: complete - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - medusa.orderEdits.complete(order_edit_id) - .then(({ order_edit }) => { - console.log(order_edit.id) - }) - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/store/order-edits/{id}/complete' - tags: - - OrderEdit - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/StoreOrderEditsRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '500': - $ref: '#/components/responses/500_error' - '/order-edits/{id}/decline': - post: - operationId: PostOrderEditsOrderEditDecline - summary: Decline an OrderEdit - description: Declines an OrderEdit. - parameters: - - in: path - name: id - required: true - description: The ID of the OrderEdit. - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/StorePostOrderEditsOrderEditDecline' - x-codegen: - method: decline - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - medusa.orderEdits.decline(order_edit_id) - .then(({ order_edit }) => { - console.log(order_edit.id); - }) - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/store/order-edits/{id}/decline' - tags: - - OrderEdit - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/StoreOrderEditsRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '500': - $ref: '#/components/responses/500_error' - '/order-edits/{id}': - get: - operationId: GetOrderEditsOrderEdit - summary: Retrieve an OrderEdit - description: Retrieves a OrderEdit. - parameters: - - in: path - name: id - required: true - description: The ID of the OrderEdit. - schema: - type: string - x-codegen: - method: retrieve - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - medusa.orderEdits.retrieve(order_edit_id) - - .then(({ order_edit }) => { - console.log(order_edit.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request GET - 'https://medusa-url.com/store/order-edits/{id}' - tags: - - OrderEdit - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/StoreOrderEditsRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - /orders/customer/confirm: - post: - operationId: PostOrdersCustomerOrderClaimsCustomerOrderClaimAccept - summary: Verify an Order Claim - description: >- - Verifies the claim order token provided to the customer upon request of - order ownership - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/StorePostCustomersCustomerAcceptClaimReq' - x-codegen: - method: confirmRequest - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.orders.confirmRequest( - token, - ) - - .then(() => { - // successful - }) - - .catch(() => { - // an error occurred - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/store/orders/customer/confirm' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "token": "{token}", - }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Order - responses: - '200': - description: OK - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - '/orders/cart/{cart_id}': - get: - operationId: GetOrdersOrderCartId - summary: Get 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 - x-codegen: - method: retrieveByCartId - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - medusa.orders.retrieveByCartId(cart_id) - - .then(({ order }) => { - console.log(order.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request GET - 'https://medusa-url.com/store/orders/cart/{id}' - tags: - - Order - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/StoreOrdersRes' - '400': - $ref: '#/components/responses/400_error' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - '/orders/{id}': - get: - operationId: GetOrdersOrder - summary: Get an Order - description: Retrieves an Order - parameters: - - in: path - name: id - required: true - description: The id of the Order. - schema: - type: string - - in: query - name: fields - description: (Comma separated) Which fields should be included in the result. - schema: - type: string - - in: query - name: expand - description: (Comma separated) Which fields should be expanded in the result. - schema: - type: string - x-codegen: - method: retrieve - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - medusa.orders.retrieve(order_id) - - .then(({ order }) => { - console.log(order.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request GET - 'https://medusa-url.com/store/orders/{id}' - tags: - - Order - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/StoreOrdersRes' - '400': - $ref: '#/components/responses/400_error' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - /orders: - 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: fields - description: (Comma separated) Which fields should be included in the result. - schema: - type: string - - in: query - name: expand - description: (Comma separated) Which fields should be expanded in the result. - schema: - type: string - - 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 - x-codegen: - method: lookupOrder - queryParams: StoreGetOrdersParams - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - medusa.orders.lookupOrder({ - display_id: 1, - email: 'user@example.com' - }) - - .then(({ order }) => { - console.log(order.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request GET - 'https://medusa-url.com/store/orders?display_id=1&email=user@example.com' - tags: - - Order - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/StoreOrdersRes' - '400': - $ref: '#/components/responses/400_error' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - /orders/batch/customer/token: - post: - operationId: PostOrdersCustomerOrderClaim - summary: Claim an Order - description: >- - Sends an email to emails registered to orders provided with link to - transfer order ownership - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/StorePostCustomersCustomerOrderClaimReq' - x-codegen: - method: requestCustomerOrders - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.orders.claimOrders({ - display_ids, - }) - - .then(() => { - // successful - }) - - .catch(() => { - // an error occurred - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/store/batch/customer/token' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "display_ids": ["id"], - }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Invite - responses: - '200': - description: OK - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' '/collections/{id}': get: operationId: GetCollectionsCollection @@ -2705,6 +2160,551 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' + '/gift-cards/{code}': + get: + operationId: GetGiftCardsCode + summary: Get Gift Card by Code + description: Retrieves a Gift Card by its associated unique code. + parameters: + - in: path + name: code + required: true + description: The unique Gift Card code. + schema: + type: string + x-codegen: + method: retrieve + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + medusa.giftCards.retrieve(code) + + .then(({ gift_card }) => { + console.log(gift_card.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/gift-cards/{code}' + tags: + - Gift Card + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/StoreGiftCardsRes' + '400': + $ref: '#/components/responses/400_error' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + '/order-edits/{id}/complete': + post: + operationId: PostOrderEditsOrderEditComplete + summary: Completes an OrderEdit + description: Completes an OrderEdit. + parameters: + - in: path + name: id + required: true + description: The ID of the Order Edit. + schema: + type: string + x-codegen: + method: complete + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + medusa.orderEdits.complete(order_edit_id) + .then(({ order_edit }) => { + console.log(order_edit.id) + }) + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/store/order-edits/{id}/complete' + tags: + - OrderEdit + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/StoreOrderEditsRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '500': + $ref: '#/components/responses/500_error' + '/order-edits/{id}/decline': + post: + operationId: PostOrderEditsOrderEditDecline + summary: Decline an OrderEdit + description: Declines an OrderEdit. + parameters: + - in: path + name: id + required: true + description: The ID of the OrderEdit. + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/StorePostOrderEditsOrderEditDecline' + x-codegen: + method: decline + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + medusa.orderEdits.decline(order_edit_id) + .then(({ order_edit }) => { + console.log(order_edit.id); + }) + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/store/order-edits/{id}/decline' + tags: + - OrderEdit + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/StoreOrderEditsRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '500': + $ref: '#/components/responses/500_error' + '/order-edits/{id}': + get: + operationId: GetOrderEditsOrderEdit + summary: Retrieve an OrderEdit + description: Retrieves a OrderEdit. + parameters: + - in: path + name: id + required: true + description: The ID of the OrderEdit. + schema: + type: string + x-codegen: + method: retrieve + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + medusa.orderEdits.retrieve(order_edit_id) + + .then(({ order_edit }) => { + console.log(order_edit.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/order-edits/{id}' + tags: + - OrderEdit + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/StoreOrderEditsRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + /orders/customer/confirm: + post: + operationId: PostOrdersCustomerOrderClaimsCustomerOrderClaimAccept + summary: Verify an Order Claim + description: >- + Verifies the claim order token provided to the customer upon request of + order ownership + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/StorePostCustomersCustomerAcceptClaimReq' + x-codegen: + method: confirmRequest + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.orders.confirmRequest( + token, + ) + + .then(() => { + // successful + }) + + .catch(() => { + // an error occurred + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/store/orders/customer/confirm' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "token": "{token}", + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Order + responses: + '200': + description: OK + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + '/orders/cart/{cart_id}': + get: + operationId: GetOrdersOrderCartId + summary: Get 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 + x-codegen: + method: retrieveByCartId + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + medusa.orders.retrieveByCartId(cart_id) + + .then(({ order }) => { + console.log(order.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/orders/cart/{id}' + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/StoreOrdersRes' + '400': + $ref: '#/components/responses/400_error' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + '/orders/{id}': + get: + operationId: GetOrdersOrder + summary: Get an Order + description: Retrieves an Order + parameters: + - in: path + name: id + required: true + description: The id of the Order. + schema: + type: string + - in: query + name: fields + description: (Comma separated) Which fields should be included in the result. + schema: + type: string + - in: query + name: expand + description: (Comma separated) Which fields should be expanded in the result. + schema: + type: string + x-codegen: + method: retrieve + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + medusa.orders.retrieve(order_id) + + .then(({ order }) => { + console.log(order.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/orders/{id}' + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/StoreOrdersRes' + '400': + $ref: '#/components/responses/400_error' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + /orders: + 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: fields + description: (Comma separated) Which fields should be included in the result. + schema: + type: string + - in: query + name: expand + description: (Comma separated) Which fields should be expanded in the result. + schema: + type: string + - 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 + x-codegen: + method: lookupOrder + queryParams: StoreGetOrdersParams + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + medusa.orders.lookupOrder({ + display_id: 1, + email: 'user@example.com' + }) + + .then(({ order }) => { + console.log(order.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/orders?display_id=1&email=user@example.com' + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/StoreOrdersRes' + '400': + $ref: '#/components/responses/400_error' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + /orders/batch/customer/token: + post: + operationId: PostOrdersCustomerOrderClaim + summary: Claim an Order + description: >- + Sends an email to emails registered to orders provided with link to + transfer order ownership + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/StorePostCustomersCustomerOrderClaimReq' + x-codegen: + method: requestCustomerOrders + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.orders.claimOrders({ + display_ids, + }) + + .then(() => { + // successful + }) + + .catch(() => { + // an error occurred + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/store/batch/customer/token' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "display_ids": ["id"], + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Invite + responses: + '200': + description: OK + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' '/payment-collections/{id}/sessions/batch/authorize': post: operationId: PostPaymentCollectionsSessionsBatchAuthorize @@ -3131,6 +3131,307 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' + '/product-categories/{id}': + get: + operationId: GetProductCategoriesCategory + summary: Get a Product Category + description: Retrieves a Product Category. + x-authenticated: false + parameters: + - in: path + name: id + required: true + description: The ID of the Product Category + schema: + type: string + - in: query + name: expand + description: >- + (Comma separated) Which fields should be expanded in each product + category. + schema: + type: string + - in: query + name: fields + description: >- + (Comma separated) Which fields should be retrieved in each product + category. + schema: + type: string + x-codegen: + method: retrieve + queryParams: StoreGetProductCategoryParams + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.productCategories.retrieve(product_category_id) + .then(({ product_category }) => { + console.log(product_category.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/product-categories/{id}' \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Product Category + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/StoreGetProductCategoriesCategoryRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + /product-categories: + get: + operationId: GetProductCategories + summary: List Product Categories + description: Retrieve a list of product categories. + x-authenticated: false + parameters: + - in: query + name: q + description: Query used for searching product category names orhandles. + schema: + type: string + - in: query + name: parent_category_id + description: Returns categories scoped by parent + schema: + type: string + - in: query + name: offset + description: How many product categories to skip in the result. + schema: + type: integer + default: 0 + - in: query + name: limit + description: Limit the number of product categories returned. + schema: + type: integer + default: 100 + x-codegen: + method: list + queryParams: StoreGetProductCategoriesParams + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + medusa.productCategories.list() + + .then(({ product_categories, limit, offset, count }) => { + console.log(product_categories.length); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/product-categories' \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Product Category + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/StoreProductCategoriesListRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + /product-tags: + get: + operationId: GetProductTags + summary: List Product Tags + description: Retrieve a list of Product Tags. + x-authenticated: true + parameters: + - in: query + name: limit + description: The number of types to return. + schema: + type: integer + default: 20 + - in: query + name: offset + description: The number of items to skip before the results. + schema: + type: integer + default: 0 + - in: query + name: order + description: The field to sort items by. + schema: + type: string + - in: query + name: discount_condition_id + description: The discount condition id on which to filter the product tags. + schema: + type: string + - in: query + name: value + style: form + explode: false + description: The tag values to search for + schema: + type: array + items: + type: string + - in: query + name: id + style: form + explode: false + description: The tag IDs to search for + schema: + type: array + items: + type: string + - in: query + name: q + description: A query string to search values for + schema: + type: string + - in: query + name: created_at + description: Date comparison for when resulting product tags 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 product tags 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 + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + medusa.productTags.list() + + .then(({ product_tags }) => { + console.log(product_tags.length); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/product-tags' + tags: + - Product Tag + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + product_tags: + $ref: '#/components/schemas/ProductTag' + 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 + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' /product-types: get: operationId: GetProductTypes @@ -3914,307 +4215,6 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - '/product-categories/{id}': - get: - operationId: GetProductCategoriesCategory - summary: Get a Product Category - description: Retrieves a Product Category. - x-authenticated: false - parameters: - - in: path - name: id - required: true - description: The ID of the Product Category - schema: - type: string - - in: query - name: expand - description: >- - (Comma separated) Which fields should be expanded in each product - category. - schema: - type: string - - in: query - name: fields - description: >- - (Comma separated) Which fields should be retrieved in each product - category. - schema: - type: string - x-codegen: - method: retrieve - queryParams: StoreGetProductCategoryParams - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.productCategories.retrieve(product_category_id) - .then(({ product_category }) => { - console.log(product_category.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request GET - 'https://medusa-url.com/store/product-categories/{id}' \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Product Category - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/StoreGetProductCategoriesCategoryRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - /product-categories: - get: - operationId: GetProductCategories - summary: List Product Categories - description: Retrieve a list of product categories. - x-authenticated: false - parameters: - - in: query - name: q - description: Query used for searching product category names orhandles. - schema: - type: string - - in: query - name: parent_category_id - description: Returns categories scoped by parent - schema: - type: string - - in: query - name: offset - description: How many product categories to skip in the result. - schema: - type: integer - default: 0 - - in: query - name: limit - description: Limit the number of product categories returned. - schema: - type: integer - default: 100 - x-codegen: - method: list - queryParams: StoreGetProductCategoriesParams - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - medusa.productCategories.list() - - .then(({ product_categories, limit, offset, count }) => { - console.log(product_categories.length); - }); - - lang: Shell - label: cURL - source: > - curl --location --request GET - 'https://medusa-url.com/store/product-categories' \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Product Category - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/StoreProductCategoriesListRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - /product-tags: - get: - operationId: GetProductTags - summary: List Product Tags - description: Retrieve a list of Product Tags. - x-authenticated: true - parameters: - - in: query - name: limit - description: The number of types to return. - schema: - type: integer - default: 20 - - in: query - name: offset - description: The number of items to skip before the results. - schema: - type: integer - default: 0 - - in: query - name: order - description: The field to sort items by. - schema: - type: string - - in: query - name: discount_condition_id - description: The discount condition id on which to filter the product tags. - schema: - type: string - - in: query - name: value - style: form - explode: false - description: The tag values to search for - schema: - type: array - items: - type: string - - in: query - name: id - style: form - explode: false - description: The tag IDs to search for - schema: - type: array - items: - type: string - - in: query - name: q - description: A query string to search values for - schema: - type: string - - in: query - name: created_at - description: Date comparison for when resulting product tags 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 product tags 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 - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - medusa.productTags.list() - - .then(({ product_tags }) => { - console.log(product_tags.length); - }); - - lang: Shell - label: cURL - source: > - curl --location --request GET - 'https://medusa-url.com/store/product-tags' - tags: - - Product Tag - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - product_tags: - $ref: '#/components/schemas/ProductTag' - 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 - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' /returns: post: operationId: PostReturns @@ -8468,6 +8468,13 @@ components: description: The total of gift cards with taxes type: integer example: 0 + returnable_items: + description: >- + The items that are returnable as part of the order, order swaps or + order claims + type: array + items: + $ref: '#/components/schemas/LineItem' created_at: description: The date with timezone at which the resource was created. type: string @@ -12148,45 +12155,6 @@ components: data: type: object description: The data to update the payment session with. - StoreGiftCardsRes: - type: object - properties: - gift_card: - $ref: '#/components/schemas/GiftCard' - StorePostOrderEditsOrderEditDecline: - type: object - properties: - declined_reason: - type: string - description: The reason for declining the OrderEdit. - StoreOrderEditsRes: - type: object - properties: - order_edit: - $ref: '#/components/schemas/OrderEdit' - StorePostCustomersCustomerAcceptClaimReq: - type: object - required: - - token - properties: - token: - description: The invite token provided by the admin. - type: string - StoreOrdersRes: - type: object - properties: - order: - $ref: '#/components/schemas/Order' - StorePostCustomersCustomerOrderClaimReq: - type: object - required: - - order_ids - properties: - order_ids: - description: The ids of the orders to claim - type: array - items: - type: string StoreCollectionsListRes: type: object properties: @@ -12347,6 +12315,45 @@ components: metadata: description: Metadata about the customer. type: object + StoreGiftCardsRes: + type: object + properties: + gift_card: + $ref: '#/components/schemas/GiftCard' + StorePostOrderEditsOrderEditDecline: + type: object + properties: + declined_reason: + type: string + description: The reason for declining the OrderEdit. + StoreOrderEditsRes: + type: object + properties: + order_edit: + $ref: '#/components/schemas/OrderEdit' + StorePostCustomersCustomerAcceptClaimReq: + type: object + required: + - token + properties: + token: + description: The invite token provided by the admin. + type: string + StoreOrdersRes: + type: object + properties: + order: + $ref: '#/components/schemas/Order' + StorePostCustomersCustomerOrderClaimReq: + type: object + required: + - order_ids + properties: + order_ids: + description: The ids of the orders to claim + type: array + items: + type: string StorePostPaymentCollectionsBatchSessionsAuthorizeReq: type: object required: @@ -12401,6 +12408,27 @@ components: provider_id: type: string description: The ID of the Payment Provider. + StoreGetProductCategoriesCategoryRes: + type: object + properties: + product_category: + $ref: '#/components/schemas/ProductCategory' + StoreProductCategoriesListRes: + type: object + properties: + product_categories: + type: array + items: + $ref: '#/components/schemas/ProductCategory' + 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 StoreProductTypesListRes: type: object properties: @@ -12470,27 +12498,6 @@ components: properties: return_reason: $ref: '#/components/schemas/ReturnReason' - StoreGetProductCategoriesCategoryRes: - type: object - properties: - product_category: - $ref: '#/components/schemas/ProductCategory' - StoreProductCategoriesListRes: - type: object - properties: - product_categories: - type: array - items: - $ref: '#/components/schemas/ProductCategory' - 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 StorePostReturnsReq: type: object required: diff --git a/docs/api/store-spec3.yaml b/docs/api/store-spec3.yaml index 1b5126c08a..1a3df1f561 100644 --- a/docs/api/store-spec3.yaml +++ b/docs/api/store-spec3.yaml @@ -262,151 +262,6 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - /collections/{id}: - get: - operationId: GetCollectionsCollection - summary: Get a Collection - description: Retrieves a Product Collection. - parameters: - - in: path - name: id - required: true - description: The id of the Product Collection - schema: - type: string - x-codegen: - method: retrieve - x-codeSamples: - - lang: JavaScript - label: JS Client - source: | - import Medusa from "@medusajs/medusa-js" - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) - medusa.collections.retrieve(collection_id) - .then(({ collection }) => { - console.log(collection.id); - }); - - lang: Shell - label: cURL - source: | - curl --location --request GET 'https://medusa-url.com/store/collections/{id}' - tags: - - Collection - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/StoreCollectionsRes' - '400': - $ref: '#/components/responses/400_error' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - /collections: - get: - operationId: GetCollections - summary: List 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 - x-codegen: - method: list - queryParams: StoreGetCollectionsParams - x-codeSamples: - - lang: JavaScript - label: JS Client - source: | - import Medusa from "@medusajs/medusa-js" - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) - medusa.collections.list() - .then(({ collections, limit, offset, count }) => { - console.log(collections.length); - }); - - lang: Shell - label: cURL - source: | - curl --location --request GET 'https://medusa-url.com/store/collections' - tags: - - Collection - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/StoreCollectionsListRes' - '400': - $ref: '#/components/responses/400_error' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' /carts/{id}/shipping-methods: post: operationId: PostCartsCartShippingMethod @@ -1143,16 +998,16 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - /gift-cards/{code}: + /collections/{id}: get: - operationId: GetGiftCardsCode - summary: Get Gift Card by Code - description: Retrieves a Gift Card by its associated unique code. + operationId: GetCollectionsCollection + summary: Get a Collection + description: Retrieves a Product Collection. parameters: - in: path - name: code + name: id required: true - description: The unique Gift Card code. + description: The id of the Product Collection schema: type: string x-codegen: @@ -1163,23 +1018,121 @@ paths: source: | import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) - medusa.giftCards.retrieve(code) - .then(({ gift_card }) => { - console.log(gift_card.id); + medusa.collections.retrieve(collection_id) + .then(({ collection }) => { + console.log(collection.id); }); - lang: Shell label: cURL source: | - curl --location --request GET 'https://medusa-url.com/store/gift-cards/{code}' + curl --location --request GET 'https://medusa-url.com/store/collections/{id}' tags: - - Gift Card + - Collection responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/StoreGiftCardsRes' + $ref: '#/components/schemas/StoreCollectionsRes' + '400': + $ref: '#/components/responses/400_error' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + /collections: + get: + operationId: GetCollections + summary: List 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 + x-codegen: + method: list + queryParams: StoreGetCollectionsParams + x-codeSamples: + - lang: JavaScript + label: JS Client + source: | + import Medusa from "@medusajs/medusa-js" + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) + medusa.collections.list() + .then(({ collections, limit, offset, count }) => { + console.log(collections.length); + }); + - lang: Shell + label: cURL + source: | + curl --location --request GET 'https://medusa-url.com/store/collections' + tags: + - Collection + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/StoreCollectionsListRes' '400': $ref: '#/components/responses/400_error' '404': @@ -1929,6 +1882,53 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' + /gift-cards/{code}: + get: + operationId: GetGiftCardsCode + summary: Get Gift Card by Code + description: Retrieves a Gift Card by its associated unique code. + parameters: + - in: path + name: code + required: true + description: The unique Gift Card code. + schema: + type: string + x-codegen: + method: retrieve + x-codeSamples: + - lang: JavaScript + label: JS Client + source: | + import Medusa from "@medusajs/medusa-js" + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) + medusa.giftCards.retrieve(code) + .then(({ gift_card }) => { + console.log(gift_card.id); + }); + - lang: Shell + label: cURL + source: | + curl --location --request GET 'https://medusa-url.com/store/gift-cards/{code}' + tags: + - Gift Card + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/StoreGiftCardsRes' + '400': + $ref: '#/components/responses/400_error' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' /order-edits/{id}/complete: post: operationId: PostOrderEditsOrderEditComplete @@ -7685,6 +7685,11 @@ components: description: The total of gift cards with taxes type: integer example: 0 + returnable_items: + description: The items that are returnable as part of the order, order swaps or order claims + type: array + items: + $ref: '#/components/schemas/LineItem' created_at: description: The date with timezone at which the resource was created. type: string @@ -10798,27 +10803,6 @@ components: exists: type: boolean description: Whether email exists or not. - StoreCollectionsListRes: - type: object - properties: - collections: - type: array - items: - $ref: '#/components/schemas/ProductCollection' - 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 - StoreCollectionsRes: - type: object - properties: - collection: - $ref: '#/components/schemas/ProductCollection' StorePostCartsCartShippingMethodReq: type: object required: @@ -10985,11 +10969,27 @@ components: data: type: object description: The data to update the payment session with. - StoreGiftCardsRes: + StoreCollectionsListRes: type: object properties: - gift_card: - $ref: '#/components/schemas/GiftCard' + collections: + type: array + items: + $ref: '#/components/schemas/ProductCollection' + 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 + StoreCollectionsRes: + type: object + properties: + collection: + $ref: '#/components/schemas/ProductCollection' StorePostCustomersCustomerAddressesReq: type: object required: @@ -11125,6 +11125,11 @@ components: metadata: description: Metadata about the customer. type: object + StoreGiftCardsRes: + type: object + properties: + gift_card: + $ref: '#/components/schemas/GiftCard' StorePostOrderEditsOrderEditDecline: type: object properties: diff --git a/docs/api/store/components/schemas/Order.yaml b/docs/api/store/components/schemas/Order.yaml index 5247e989ad..26d73485be 100644 --- a/docs/api/store/components/schemas/Order.yaml +++ b/docs/api/store/components/schemas/Order.yaml @@ -303,6 +303,13 @@ properties: description: The total of gift cards with taxes type: integer example: 0 + returnable_items: + description: >- + The items that are returnable as part of the order, order swaps or order + claims + type: array + items: + $ref: ./LineItem.yaml created_at: description: The date with timezone at which the resource was created. type: string diff --git a/docs/api/store/openapi.yaml b/docs/api/store/openapi.yaml index e6aeacdd02..4a0067f12f 100644 --- a/docs/api/store/openapi.yaml +++ b/docs/api/store/openapi.yaml @@ -137,10 +137,6 @@ paths: $ref: paths/auth.yaml /auth/{email}: $ref: paths/auth_{email}.yaml - /collections/{id}: - $ref: paths/collections_{id}.yaml - /collections: - $ref: paths/collections.yaml /carts/{id}/shipping-methods: $ref: paths/carts_{id}_shipping-methods.yaml /carts/{id}/taxes: @@ -163,8 +159,10 @@ paths: $ref: paths/carts_{id}_payment-sessions_{provider_id}_refresh.yaml /carts/{id}/payment-session: $ref: paths/carts_{id}_payment-session.yaml - /gift-cards/{code}: - $ref: paths/gift-cards_{code}.yaml + /collections/{id}: + $ref: paths/collections_{id}.yaml + /collections: + $ref: paths/collections.yaml /customers/me/addresses: $ref: paths/customers_me_addresses.yaml /customers: @@ -181,6 +179,8 @@ paths: $ref: paths/customers_password-token.yaml /customers/password-reset: $ref: paths/customers_password-reset.yaml + /gift-cards/{code}: + $ref: paths/gift-cards_{code}.yaml /order-edits/{id}/complete: $ref: paths/order-edits_{id}_complete.yaml /order-edits/{id}/decline: