From e2b7f77ba979275ed47678424f8fdd4ceb7417ad Mon Sep 17 00:00:00 2001 From: Shahed Nasser Date: Wed, 14 Dec 2022 11:54:31 +0200 Subject: [PATCH] docs: fix id used in endpoint path in OAS (#2795) * docs: fix id used in endpoint path in OAS * docs: small fixes to OAS comments * revert changes in core package * undo changes in core files --- docs/api/admin-spec3.json | 3351 +++++----- docs/api/admin-spec3.yaml | 5571 +++++++++-------- .../getundefined | 0 .../getundefined | 0 docs/api/admin/openapi.yaml | 100 +- .../api/admin/paths/publishable-api-keys.yaml | 2 +- ...ishable-api-keys_{id}_sales-channels.yaml} | 13 +- ...le-api-keys_{id}_sales-channels_batch.yaml | 4 +- docs/api/store-spec3.json | 2438 ++++---- docs/api/store-spec3.yaml | 1526 ++--- docs/api/store/openapi.yaml | 48 +- 11 files changed, 6537 insertions(+), 6516 deletions(-) rename docs/api/admin/code_samples/JavaScript/{publishable-api-keys_:id_sales-channels => publishable-api-keys_{id}_sales-channels}/getundefined (100%) rename docs/api/admin/code_samples/Shell/{publishable-api-keys_:id_sales-channels => publishable-api-keys_{id}_sales-channels}/getundefined (100%) rename docs/api/admin/paths/{publishable-api-keys_:id_sales-channels.yaml => publishable-api-keys_{id}_sales-channels.yaml} (75%) diff --git a/docs/api/admin-spec3.json b/docs/api/admin-spec3.json index cd29c8bbce..891a86a516 100644 --- a/docs/api/admin-spec3.json +++ b/docs/api/admin-spec3.json @@ -202,115 +202,6 @@ tags: servers: - url: 'https://api.medusa-commerce.com/admin' paths: - /apps/authorizations: - post: - operationId: PostApps - summary: Generate Token for App - description: Generates a token for an application. - x-authenticated: true - requestBody: - content: - application/json: - schema: - type: object - required: - - application_name - - state - - code - properties: - application_name: - type: string - description: Name of the application for the token to be generated for. - state: - type: string - description: State of the application. - code: - type: string - description: The code for the generated token. - x-codeSamples: - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/apps/authorizations' \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "application_name": "example", - "state": "ready", - "code": "token" - }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - App - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - apps: - $ref: '#/components/schemas/OAuth' - '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' - /apps: - get: - operationId: GetApps - summary: List Applications - description: Retrieve a list of applications. - x-authenticated: true - x-codeSamples: - - lang: Shell - label: cURL - source: | - curl --location --request GET 'https://medusa-url.com/admin/apps' \ - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - App - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - apps: - type: array - items: - $ref: '#/components/schemas/OAuth' - '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' /auth: post: operationId: PostAuth @@ -478,6 +369,602 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' + '/batch-jobs/{id}/cancel': + post: + operationId: PostBatchJobsBatchJobCancel + summary: Cancel a Batch Job + description: Marks a batch job as canceled + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the batch job. + 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.batchJobs.cancel(batch_job_id) + + .then(({ batch_job }) => { + console.log(batch_job.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/batch-jobs/{id}/cancel' \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Batch Job + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + batch_job: + $ref: '#/components/schemas/batch_job' + '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' + '/batch-jobs/{id}/confirm': + post: + operationId: PostBatchJobsBatchJobConfirmProcessing + summary: Confirm a Batch Job + description: Confirms that a previously requested batch job should be executed. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the batch job. + 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.batchJobs.confirm(batch_job_id) + + .then(({ batch_job }) => { + console.log(batch_job.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/batch-jobs/{id}/confirm' \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Batch Job + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + batch_job: + $ref: '#/components/schemas/batch_job' + '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' + /batch-jobs: + post: + operationId: PostBatchJobs + summary: Create a Batch Job + description: Creates a Batch Job. + x-authenticated: true + requestBody: + content: + application/json: + schema: + type: object + required: + - type + - context + properties: + type: + type: string + description: The type of batch job to start. + example: product-export + context: + type: object + description: >- + Additional infomration regarding the batch to be used for + processing. + example: + shape: + prices: + - region: null + currency_code: eur + dynamicImageColumnCount: 4 + dynamicOptionColumnCount: 2 + list_config: + skip: 0 + take: 50 + order: + created_at: DESC + relations: + - variants + - variant.prices + - images + dry_run: + type: boolean + description: >- + Set a batch job in dry_run mode to get some information on + what will be done without applying any modifications. + default: false + 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.batchJobs.create({ + type: 'product-export', + context: {}, + dry_run: false + }).then((({ batch_job }) => { + console.log(batch_job.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/batch-jobs' \ + + --header 'Content-Type: application/json' \ + + --header 'Authorization: Bearer {api_token}' \ + + --data-raw '{ + "type": "product-export", + "context": { } + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Batch Job + responses: + '201': + description: OK + content: + application/json: + schema: + type: object + properties: + batch_job: + $ref: '#/components/schemas/batch_job' + '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: GetBatchJobs + summary: List Batch Jobs + description: Retrieve a list of Batch Jobs. + x-authenticated: true + parameters: + - in: query + name: limit + description: The number of batch jobs to return. + schema: + type: integer + default: 10 + - in: query + name: offset + description: The number of batch jobs to skip before results. + schema: + type: integer + default: 0 + - in: query + name: id + style: form + explode: false + description: Filter by the batch ID + schema: + oneOf: + - type: string + description: batch job ID + - type: array + description: multiple batch job IDs + items: + type: string + - in: query + name: type + style: form + explode: false + description: Filter by the batch type + schema: + type: array + items: + type: string + - in: query + name: confirmed_at + style: form + explode: false + description: >- + Date comparison for when resulting collections was confirmed, i.e. + less than, greater than etc. + 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: pre_processed_at + style: form + explode: false + description: >- + Date comparison for when resulting collections was pre processed, + i.e. less than, greater than etc. + 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: completed_at + style: form + explode: false + description: >- + Date comparison for when resulting collections was completed, i.e. + less than, greater than etc. + 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: failed_at + style: form + explode: false + description: >- + Date comparison for when resulting collections was failed, i.e. less + than, greater than etc. + 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 + style: form + explode: false + description: >- + Date comparison for when resulting collections was canceled, i.e. + less than, greater than etc. + 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: order + description: Field used to order retrieved batch jobs + schema: + type: string + - 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 + - in: query + name: created_at + style: form + explode: false + description: >- + Date comparison for when resulting collections was created, i.e. + less than, greater than etc. + 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 + style: form + explode: false + description: >- + Date comparison for when resulting collections was updated, i.e. + less than, greater than etc. + 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 }) + + // must be previously logged in or use api token + + medusa.admin.batchJobs.list() + + .then(({ batch_jobs, limit, offset, count }) => { + console.log(batch_jobs.length); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/admin/batch-jobs' \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Batch Job + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + batch_jobs: + type: array + items: + $ref: '#/components/schemas/batch_job' + 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' + '/batch-jobs/{id}': + get: + operationId: GetBatchJobsBatchJob + summary: Get a Batch Job + description: Retrieves a Batch Job. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Batch Job + 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.batchJobs.retrieve(batch_job_id) + + .then(({ batch_job }) => { + console.log(batch_job.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/admin/batch-jobs/{id}' \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Batch Job + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + batch_job: + $ref: '#/components/schemas/batch_job' + '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}/products/batch': post: operationId: PostProductsToCollection @@ -2013,137 +2500,11 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - '/batch-jobs/{id}/cancel': + /apps/authorizations: post: - operationId: PostBatchJobsBatchJobCancel - summary: Cancel a Batch Job - description: Marks a batch job as canceled - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the batch job. - 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.batchJobs.cancel(batch_job_id) - - .then(({ batch_job }) => { - console.log(batch_job.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/batch-jobs/{id}/cancel' \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Batch Job - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - batch_job: - $ref: '#/components/schemas/batch_job' - '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' - '/batch-jobs/{id}/confirm': - post: - operationId: PostBatchJobsBatchJobConfirmProcessing - summary: Confirm a Batch Job - description: Confirms that a previously requested batch job should be executed. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the batch job. - 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.batchJobs.confirm(batch_job_id) - - .then(({ batch_job }) => { - console.log(batch_job.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/batch-jobs/{id}/confirm' \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Batch Job - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - batch_job: - $ref: '#/components/schemas/batch_job' - '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' - /batch-jobs: - post: - operationId: PostBatchJobs - summary: Create a Batch Job - description: Creates a Batch Job. + operationId: PostApps + summary: Generate Token for App + description: Generates a token for an application. x-authenticated: true requestBody: content: @@ -2151,87 +2512,50 @@ paths: schema: type: object required: - - type - - context + - application_name + - state + - code properties: - type: + application_name: type: string - description: The type of batch job to start. - example: product-export - context: - type: object - description: >- - Additional infomration regarding the batch to be used for - processing. - example: - shape: - prices: - - region: null - currency_code: eur - dynamicImageColumnCount: 4 - dynamicOptionColumnCount: 2 - list_config: - skip: 0 - take: 50 - order: - created_at: DESC - relations: - - variants - - variant.prices - - images - dry_run: - type: boolean - description: >- - Set a batch job in dry_run mode to get some information on - what will be done without applying any modifications. - default: false + description: Name of the application for the token to be generated for. + state: + type: string + description: State of the application. + code: + type: string + description: The code for the generated token. 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.batchJobs.create({ - type: 'product-export', - context: {}, - dry_run: false - }).then((({ batch_job }) => { - console.log(batch_job.id); - }); - lang: Shell label: cURL source: > curl --location --request POST - 'https://medusa-url.com/admin/batch-jobs' \ - - --header 'Content-Type: application/json' \ + 'https://medusa-url.com/admin/apps/authorizations' \ --header 'Authorization: Bearer {api_token}' \ + --header 'Content-Type: application/json' \ + --data-raw '{ - "type": "product-export", - "context": { } + "application_name": "example", + "state": "ready", + "code": "token" }' security: - api_token: [] - cookie_auth: [] tags: - - Batch Job + - App responses: - '201': + '200': description: OK content: application/json: schema: type: object properties: - batch_job: - $ref: '#/components/schemas/batch_job' + apps: + $ref: '#/components/schemas/OAuth' '400': $ref: '#/components/responses/400_error' '401': @@ -2244,275 +2568,23 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' + /apps: get: - operationId: GetBatchJobs - summary: List Batch Jobs - description: Retrieve a list of Batch Jobs. + operationId: GetApps + summary: List Applications + description: Retrieve a list of applications. x-authenticated: true - parameters: - - in: query - name: limit - description: The number of batch jobs to return. - schema: - type: integer - default: 10 - - in: query - name: offset - description: The number of batch jobs to skip before results. - schema: - type: integer - default: 0 - - in: query - name: id - style: form - explode: false - description: Filter by the batch ID - schema: - oneOf: - - type: string - description: batch job ID - - type: array - description: multiple batch job IDs - items: - type: string - - in: query - name: type - style: form - explode: false - description: Filter by the batch type - schema: - type: array - items: - type: string - - in: query - name: confirmed_at - style: form - explode: false - description: >- - Date comparison for when resulting collections was confirmed, i.e. - less than, greater than etc. - 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: pre_processed_at - style: form - explode: false - description: >- - Date comparison for when resulting collections was pre processed, - i.e. less than, greater than etc. - 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: completed_at - style: form - explode: false - description: >- - Date comparison for when resulting collections was completed, i.e. - less than, greater than etc. - 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: failed_at - style: form - explode: false - description: >- - Date comparison for when resulting collections was failed, i.e. less - than, greater than etc. - 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 - style: form - explode: false - description: >- - Date comparison for when resulting collections was canceled, i.e. - less than, greater than etc. - 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: order - description: Field used to order retrieved batch jobs - schema: - type: string - - 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 - - in: query - name: created_at - style: form - explode: false - description: >- - Date comparison for when resulting collections was created, i.e. - less than, greater than etc. - 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 - style: form - explode: false - description: >- - Date comparison for when resulting collections was updated, i.e. - less than, greater than etc. - 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 }) - - // must be previously logged in or use api token - - medusa.admin.batchJobs.list() - - .then(({ batch_jobs, limit, offset, count }) => { - console.log(batch_jobs.length); - }); - lang: Shell label: cURL - source: > - curl --location --request GET - 'https://medusa-url.com/admin/batch-jobs' \ - + source: | + curl --location --request GET 'https://medusa-url.com/admin/apps' \ --header 'Authorization: Bearer {api_token}' security: - api_token: [] - cookie_auth: [] tags: - - Batch Job + - App responses: '200': description: OK @@ -2521,82 +2593,10 @@ paths: schema: type: object properties: - batch_jobs: + apps: type: array items: - $ref: '#/components/schemas/batch_job' - 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' - '/batch-jobs/{id}': - get: - operationId: GetBatchJobsBatchJob - summary: Get a Batch Job - description: Retrieves a Batch Job. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Batch Job - 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.batchJobs.retrieve(batch_job_id) - - .then(({ batch_job }) => { - console.log(batch_job.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request GET - 'https://medusa-url.com/admin/batch-jobs/{id}' \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Batch Job - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - batch_job: - $ref: '#/components/schemas/batch_job' + $ref: '#/components/schemas/OAuth' '400': $ref: '#/components/responses/400_error' '401': @@ -14704,7 +14704,7 @@ paths: - api_token: [] - cookie_auth: [] tags: - - Publishable Api Key + - PublishableApiKey responses: '200': description: OK @@ -14802,7 +14802,7 @@ paths: - api_token: [] - cookie_auth: [] tags: - - Publishable Api Key + - PublishableApiKey responses: '200': description: OK @@ -14951,7 +14951,7 @@ paths: - api_token: [] - cookie_auth: [] tags: - - PublishableApiKeys + - PublishableApiKey responses: '200': description: OK @@ -15099,12 +15099,19 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - '/publishable-api-keys/:id/sales-channels': + '/publishable-api-keys/{id}/sales-channels': get: operationId: GetPublishableApiKeySalesChannels summary: List PublishableApiKey's SalesChannels description: List PublishableApiKey's SalesChannels x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Publishable Api Key. + schema: + type: string x-codeSamples: - lang: JavaScript label: JS Client @@ -15132,7 +15139,7 @@ paths: - api_token: [] - cookie_auth: [] tags: - - PublishableApiKeySalesChannels + - PublishableApiKey responses: '200': description: OK @@ -16347,11 +16354,11 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - /shipping-options: + /return-reasons: post: - operationId: PostShippingOptions - summary: Create Shipping Option - description: Creates a Shipping Option + operationId: PostReturnReasons + summary: Create a Return Reason + description: Creates a Return Reason x-authenticated: true requestBody: content: @@ -16359,79 +16366,28 @@ paths: schema: type: object required: - - name - - region_id - - provider_id - - data - - price_type + - label + - value properties: - name: - description: The name of the Shipping Option + label: + description: The label to display to the Customer. type: string - region_id: + value: description: >- - The ID of the Region in which the Shipping Option will be - available. + The value that the Return Reason will be identified by. Must + be unique. type: string - provider_id: - description: >- - The ID of the Fulfillment Provider that handles the Shipping - Option. + parent_return_reason_id: + description: The ID of the parent return reason. type: string - profile_id: - description: >- - The ID of the Shipping Profile to add the Shipping Option - to. - type: number - data: - description: >- - The data needed for the Fulfillment Provider to handle - shipping with this Shipping Option. - type: object - price_type: - description: The type of the Shipping Option price. + description: + description: An optional description to for the Reason. type: string - enum: - - flat_rate - - calculated - amount: - description: The amount to charge for the Shipping Option. - type: integer - requirements: - description: >- - The requirements that must be satisfied for the Shipping - Option to be available. - type: array - items: - required: - - type - - amount - properties: - type: - description: The type of the requirement - type: string - enum: - - max_subtotal - - min_subtotal - amount: - description: The amount to compare with. - type: integer - is_return: - description: Whether the Shipping Option defines a return shipment. - type: boolean - default: false - admin_only: - description: 'If true, the option can be used for draft orders' - type: boolean - default: false metadata: description: >- An optional set of key-value pairs with additional information. type: object - includes_tax: - description: '[EXPERIMENTAL] Tax included in prices of shipping option' - type: boolean x-codeSamples: - lang: JavaScript label: JS Client @@ -16443,40 +16399,33 @@ paths: // must be previously logged in or use api token - medusa.admin.shippingOptions.create({ - name: 'PostFake', - region_id: "saasf", - provider_id: "manual", - data: { - }, - price_type: 'flat_rate' + medusa.admin.returnReasons.create({ + label: 'Damaged', + value: 'damaged' }) - .then(({ shipping_option }) => { - console.log(shipping_option.id); + .then(({ return_reason }) => { + console.log(return_reason.id); }); - lang: Shell label: cURL source: > curl --location --request POST - 'https://medusa-url.com/admin/shipping-options' \ + 'https://medusa-url.com/admin/return-reasons' \ --header 'Authorization: Bearer {api_token}' \ --header 'Content-Type: application/json' \ --data-raw '{ - "name": "PostFake", - "region_id": "afasf", - "provider_id": "manual", - "data": {}, - "price_type": "flat_rate" + "label": "Damaged", + "value": "damaged" }' security: - api_token: [] - cookie_auth: [] tags: - - Shipping Option + - Return Reason responses: '200': description: OK @@ -16485,8 +16434,8 @@ paths: schema: type: object properties: - shipping_option: - $ref: '#/components/schemas/shipping_option' + return_reason: + $ref: '#/components/schemas/return_reason' '400': $ref: '#/components/responses/400_error' '401': @@ -16500,26 +16449,10 @@ paths: '500': $ref: '#/components/responses/500_error' get: - operationId: GetShippingOptions - summary: List Shipping Options - description: Retrieves a list of Shipping Options. + operationId: GetReturnReasons + summary: List Return Reasons + description: Retrieves a list of Return Reasons. x-authenticated: true - parameters: - - in: query - name: region_id - schema: - type: string - description: Region ID to fetch options from - - in: query - name: is_return - schema: - type: boolean - description: Flag for fetching return options only - - in: query - name: admin_only - schema: - type: boolean - description: Flag for fetching admin specific options x-codeSamples: - lang: JavaScript label: JS Client @@ -16531,23 +16464,23 @@ paths: // must be previously logged in or use api token - medusa.admin.shippingOptions.list() + medusa.admin.returnReasons.list() - .then(({ shipping_options, count }) => { - console.log(shipping_options.length); + .then(({ return_reasons }) => { + console.log(return_reasons.length); }); - lang: Shell label: cURL source: > curl --location --request GET - 'https://medusa-url.com/admin/shipping-options' \ + 'https://medusa-url.com/admin/return-reasons' \ --header 'Authorization: Bearer {api_token}' security: - api_token: [] - cookie_auth: [] tags: - - Shipping Option + - Return Reason responses: '200': description: OK @@ -16556,13 +16489,10 @@ paths: schema: type: object properties: - shipping_options: + return_reasons: type: array items: - $ref: '#/components/schemas/shipping_option' - count: - type: integer - description: The total number of items available + $ref: '#/components/schemas/return_reason' '400': $ref: '#/components/responses/400_error' '401': @@ -16575,17 +16505,17 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - '/shipping-options/{id}': + '/return-reasons/{id}': delete: - operationId: DeleteShippingOptionsOption - summary: Delete a Shipping Option - description: Deletes a Shipping Option. + operationId: DeleteReturnReason + summary: Delete a Return Reason + description: Deletes a return reason. x-authenticated: true parameters: - in: path name: id required: true - description: The ID of the Shipping Option. + description: The ID of the return reason schema: type: string x-codeSamples: @@ -16599,7 +16529,7 @@ paths: // must be previously logged in or use api token - medusa.admin.shippingOptions.delete(option_id) + medusa.admin.returnReasons.delete(return_reason_id) .then(({ id, object, deleted }) => { console.log(id); @@ -16608,14 +16538,14 @@ paths: label: cURL source: > curl --location --request DELETE - 'https://medusa-url.com/admin/shipping-options/{option_id}' \ + 'https://medusa-url.com/admin/return-reasons/{id}' \ --header 'Authorization: Bearer {api_token}' security: - api_token: [] - cookie_auth: [] tags: - - Shipping Option + - Return Reason responses: '200': description: OK @@ -16626,11 +16556,11 @@ paths: properties: id: type: string - description: The ID of the deleted Shipping Option. + description: The ID of the deleted return reason object: type: string description: The type of the object that was deleted. - default: shipping-option + default: return_reason deleted: type: boolean description: Whether or not the items were deleted. @@ -16648,15 +16578,15 @@ paths: '500': $ref: '#/components/responses/500_error' get: - operationId: GetShippingOptionsOption - summary: Get a Shipping Option - description: Retrieves a Shipping Option. + operationId: GetReturnReasonsReason + summary: Get a Return Reason + description: Retrieves a Return Reason. x-authenticated: true parameters: - in: path name: id required: true - description: The ID of the Shipping Option. + description: The ID of the Return Reason. schema: type: string x-codeSamples: @@ -16670,23 +16600,23 @@ paths: // must be previously logged in or use api token - medusa.admin.shippingOptions.retrieve(option_id) + medusa.admin.returnReasons.retrieve(return_reason_id) - .then(({ shipping_option }) => { - console.log(shipping_option.id); + .then(({ return_reason }) => { + console.log(return_reason.id); }); - lang: Shell label: cURL source: > curl --location --request GET - 'https://medusa-url.com/admin/shipping-options/{id}' \ + 'https://medusa-url.com/admin/return-reasons/{id}' \ --header 'Authorization: Bearer {api_token}' security: - api_token: [] - cookie_auth: [] tags: - - Shipping Option + - Return Reason responses: '200': description: OK @@ -16695,8 +16625,8 @@ paths: schema: type: object properties: - shipping_option: - $ref: '#/components/schemas/shipping_option' + return_reason: + $ref: '#/components/schemas/return_reason' '400': $ref: '#/components/responses/400_error' '401': @@ -16710,15 +16640,15 @@ paths: '500': $ref: '#/components/responses/500_error' post: - operationId: PostShippingOptionsOption - summary: Update Shipping Option - description: Updates a Shipping Option + operationId: PostReturnReasonsReason + summary: Update a Return Reason + description: Updates a Return Reason x-authenticated: true parameters: - in: path name: id required: true - description: The ID of the Shipping Option. + description: The ID of the Return Reason. schema: type: string requestBody: @@ -16726,48 +16656,23 @@ paths: application/json: schema: type: object - required: - - requirements properties: - name: - description: The name of the Shipping Option + label: + description: The label to display to the Customer. + type: string + value: + description: >- + The value that the Return Reason will be identified by. Must + be unique. + type: string + description: + description: An optional description to for the Reason. type: string - amount: - description: The amount to charge for the Shipping Option. - type: integer - admin_only: - description: 'If true, the option can be used for draft orders' - type: boolean metadata: description: >- An optional set of key-value pairs with additional information. type: object - requirements: - description: >- - The requirements that must be satisfied for the Shipping - Option to be available. - type: array - items: - required: - - type - - amount - properties: - id: - description: The ID of the requirement - type: string - type: - description: The type of the requirement - type: string - enum: - - max_subtotal - - min_subtotal - amount: - description: The amount to compare with. - type: integer - includes_tax: - description: '[EXPERIMENTAL] Tax included in prices of shipping option' - type: boolean x-codeSamples: - lang: JavaScript label: JS Client @@ -16779,35 +16684,271 @@ paths: // must be previously logged in or use api token - medusa.admin.shippingOptions.update(option_id, { - name: 'PostFake', - requirements: [ - { - id, - type: 'max_subtotal', - amount: 1000 - } - ] + medusa.admin.returnReasons.update(return_reason_id, { + label: 'Damaged' }) - .then(({ shipping_option }) => { - console.log(shipping_option.id); + .then(({ return_reason }) => { + console.log(return_reason.id); }); - lang: Shell label: cURL source: > curl --location --request POST - 'https://medusa-url.com/admin/shipping-options/{id}' \ + 'https://medusa-url.com/admin/return-reasons/{id}' \ --header 'Authorization: Bearer {api_token}' \ --header 'Content-Type: application/json' \ --data-raw '{ - "requirements": [ + "label": "Damaged" + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Return Reason + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + return_reason: + $ref: '#/components/schemas/return_reason' + '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}/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-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: + type: object + properties: + order: + $ref: '#/components/schemas/order' + '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-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: + 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 + '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: + type: object + required: + - items + properties: + items: + description: The Line Items that have been received. + type: array + items: + 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 + 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": [ { - "type": "max_subtotal", - "amount": 1000 + "item_id": "asafg", + "quantity": 1 } ] }' @@ -16815,7 +16956,7 @@ paths: - api_token: [] - cookie_auth: [] tags: - - Shipping Option + - Return responses: '200': description: OK @@ -16824,352 +16965,8 @@ paths: schema: type: object properties: - shipping_option: - $ref: '#/components/schemas/shipping_option' - '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-profiles: - post: - operationId: PostShippingProfiles - summary: Create a Shipping Profile - description: Creates a Shipping Profile - x-authenticated: true - requestBody: - content: - application/json: - schema: - type: object - required: - - name - properties: - name: - description: The name of the Shipping Profile - 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.shippingProfiles.create({ - name: 'Large Products' - }) - - .then(({ shipping_profile }) => { - console.log(shipping_profile.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/shipping-profiles' \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "name": "Large Products" - }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Shipping Profile - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - shipping_profile: - $ref: '#/components/schemas/shipping_profile' - '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: GetShippingProfiles - summary: List Shipping Profiles - description: Retrieves a list of Shipping Profile. - x-authenticated: true - 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.shippingProfiles.list() - - .then(({ shipping_profiles }) => { - console.log(shipping_profiles.length); - }); - - lang: Shell - label: cURL - source: > - curl --location --request GET - 'https://medusa-url.com/admin/shipping-profiles' \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Shipping Profile - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - shipping_profiles: - type: array - items: - $ref: '#/components/schemas/shipping_profile' - '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-profiles/{id}': - delete: - operationId: DeleteShippingProfilesProfile - summary: Delete a Shipping Profile - description: Deletes a Shipping Profile. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Shipping Profile. - 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.shippingProfiles.delete(profile_id) - - .then(({ id, object, deleted }) => { - console.log(id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request DELETE - 'https://medusa-url.com/admin/shipping-profiles/{id}' \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Shipping Profile - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - id: - type: string - description: The ID of the deleted Shipping Profile. - object: - type: string - description: The type of the object that was deleted. - default: shipping_profile - deleted: - type: boolean - description: Whether or not the items were 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: GetShippingProfilesProfile - summary: Get a Shipping Profile - description: Retrieves a Shipping Profile. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Shipping Profile. - 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.shippingProfiles.retrieve(profile_id) - - .then(({ shipping_profile }) => { - console.log(shipping_profile.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request GET - 'https://medusa-url.com/admin/shipping-profiles/{id}' \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Shipping Profile - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - shipping_profile: - $ref: '#/components/schemas/shipping_profile' - '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: PostShippingProfilesProfile - summary: Update a Shipping Profile - description: Updates a Shipping Profile - parameters: - - in: path - name: id - required: true - description: The ID of the Shipping Profile. - schema: - type: string - requestBody: - content: - application/json: - schema: - type: object - properties: - name: - description: The name of the Shipping Profile - 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.shippingProfiles.update(shipping_profile_id, { - name: 'Large Products' - }) - - .then(({ shipping_profile }) => { - console.log(shipping_profile.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/shipping-profiles/{id} \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "name": "Large Products" - }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Shipping Profile - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - shipping_profile: - $ref: '#/components/schemas/shipping_profile' + return: + $ref: '#/components/schemas/return' '400': $ref: '#/components/responses/400_error' '401': @@ -17862,259 +17659,11 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - '/returns/{id}/cancel': + /shipping-profiles: 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-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: - type: object - properties: - order: - $ref: '#/components/schemas/order' - '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-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: - 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 - '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: - type: object - required: - - items - properties: - items: - description: The Line Items that have been received. - type: array - items: - 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 - 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: - type: object - properties: - return: - $ref: '#/components/schemas/return' - '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 - summary: Create a Return Reason - description: Creates a Return Reason + operationId: PostShippingProfiles + summary: Create a Shipping Profile + description: Creates a Shipping Profile x-authenticated: true requestBody: content: @@ -18122,28 +17671,11 @@ paths: schema: type: object required: - - label - - value + - name properties: - label: - description: The label to display to the Customer. + name: + description: The name of the Shipping Profile type: string - value: - description: >- - The value that the Return Reason will be identified by. Must - be unique. - type: string - parent_return_reason_id: - description: The ID of the parent return reason. - type: string - description: - description: An optional description to for the Reason. - type: string - metadata: - description: >- - An optional set of key-value pairs with additional - information. - type: object x-codeSamples: - lang: JavaScript label: JS Client @@ -18155,33 +17687,31 @@ paths: // must be previously logged in or use api token - medusa.admin.returnReasons.create({ - label: 'Damaged', - value: 'damaged' + medusa.admin.shippingProfiles.create({ + name: 'Large Products' }) - .then(({ return_reason }) => { - console.log(return_reason.id); + .then(({ shipping_profile }) => { + console.log(shipping_profile.id); }); - lang: Shell label: cURL source: > curl --location --request POST - 'https://medusa-url.com/admin/return-reasons' \ + 'https://medusa-url.com/admin/shipping-profiles' \ --header 'Authorization: Bearer {api_token}' \ --header 'Content-Type: application/json' \ --data-raw '{ - "label": "Damaged", - "value": "damaged" + "name": "Large Products" }' security: - api_token: [] - cookie_auth: [] tags: - - Return Reason + - Shipping Profile responses: '200': description: OK @@ -18190,8 +17720,8 @@ paths: schema: type: object properties: - return_reason: - $ref: '#/components/schemas/return_reason' + shipping_profile: + $ref: '#/components/schemas/shipping_profile' '400': $ref: '#/components/responses/400_error' '401': @@ -18205,9 +17735,9 @@ paths: '500': $ref: '#/components/responses/500_error' get: - operationId: GetReturnReasons - summary: List Return Reasons - description: Retrieves a list of Return Reasons. + operationId: GetShippingProfiles + summary: List Shipping Profiles + description: Retrieves a list of Shipping Profile. x-authenticated: true x-codeSamples: - lang: JavaScript @@ -18220,23 +17750,23 @@ paths: // must be previously logged in or use api token - medusa.admin.returnReasons.list() + medusa.admin.shippingProfiles.list() - .then(({ return_reasons }) => { - console.log(return_reasons.length); + .then(({ shipping_profiles }) => { + console.log(shipping_profiles.length); }); - lang: Shell label: cURL source: > curl --location --request GET - 'https://medusa-url.com/admin/return-reasons' \ + 'https://medusa-url.com/admin/shipping-profiles' \ --header 'Authorization: Bearer {api_token}' security: - api_token: [] - cookie_auth: [] tags: - - Return Reason + - Shipping Profile responses: '200': description: OK @@ -18245,10 +17775,10 @@ paths: schema: type: object properties: - return_reasons: + shipping_profiles: type: array items: - $ref: '#/components/schemas/return_reason' + $ref: '#/components/schemas/shipping_profile' '400': $ref: '#/components/responses/400_error' '401': @@ -18261,17 +17791,17 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - '/return-reasons/{id}': + '/shipping-profiles/{id}': delete: - operationId: DeleteReturnReason - summary: Delete a Return Reason - description: Deletes a return reason. + operationId: DeleteShippingProfilesProfile + summary: Delete a Shipping Profile + description: Deletes a Shipping Profile. x-authenticated: true parameters: - in: path name: id required: true - description: The ID of the return reason + description: The ID of the Shipping Profile. schema: type: string x-codeSamples: @@ -18285,7 +17815,7 @@ paths: // must be previously logged in or use api token - medusa.admin.returnReasons.delete(return_reason_id) + medusa.admin.shippingProfiles.delete(profile_id) .then(({ id, object, deleted }) => { console.log(id); @@ -18294,14 +17824,14 @@ paths: label: cURL source: > curl --location --request DELETE - 'https://medusa-url.com/admin/return-reasons/{id}' \ + 'https://medusa-url.com/admin/shipping-profiles/{id}' \ --header 'Authorization: Bearer {api_token}' security: - api_token: [] - cookie_auth: [] tags: - - Return Reason + - Shipping Profile responses: '200': description: OK @@ -18312,11 +17842,11 @@ paths: properties: id: type: string - description: The ID of the deleted return reason + description: The ID of the deleted Shipping Profile. object: type: string description: The type of the object that was deleted. - default: return_reason + default: shipping_profile deleted: type: boolean description: Whether or not the items were deleted. @@ -18334,15 +17864,15 @@ paths: '500': $ref: '#/components/responses/500_error' get: - operationId: GetReturnReasonsReason - summary: Get a Return Reason - description: Retrieves a Return Reason. + operationId: GetShippingProfilesProfile + summary: Get a Shipping Profile + description: Retrieves a Shipping Profile. x-authenticated: true parameters: - in: path name: id required: true - description: The ID of the Return Reason. + description: The ID of the Shipping Profile. schema: type: string x-codeSamples: @@ -18356,23 +17886,23 @@ paths: // must be previously logged in or use api token - medusa.admin.returnReasons.retrieve(return_reason_id) + medusa.admin.shippingProfiles.retrieve(profile_id) - .then(({ return_reason }) => { - console.log(return_reason.id); + .then(({ shipping_profile }) => { + console.log(shipping_profile.id); }); - lang: Shell label: cURL source: > curl --location --request GET - 'https://medusa-url.com/admin/return-reasons/{id}' \ + 'https://medusa-url.com/admin/shipping-profiles/{id}' \ --header 'Authorization: Bearer {api_token}' security: - api_token: [] - cookie_auth: [] tags: - - Return Reason + - Shipping Profile responses: '200': description: OK @@ -18381,8 +17911,8 @@ paths: schema: type: object properties: - return_reason: - $ref: '#/components/schemas/return_reason' + shipping_profile: + $ref: '#/components/schemas/shipping_profile' '400': $ref: '#/components/responses/400_error' '401': @@ -18396,15 +17926,14 @@ paths: '500': $ref: '#/components/responses/500_error' post: - operationId: PostReturnReasonsReason - summary: Update a Return Reason - description: Updates a Return Reason - x-authenticated: true + operationId: PostShippingProfilesProfile + summary: Update a Shipping Profile + description: Updates a Shipping Profile parameters: - in: path name: id required: true - description: The ID of the Return Reason. + description: The ID of the Shipping Profile. schema: type: string requestBody: @@ -18413,22 +17942,9 @@ paths: schema: type: object properties: - label: - description: The label to display to the Customer. + name: + description: The name of the Shipping Profile type: string - value: - description: >- - The value that the Return Reason will be identified by. Must - be unique. - type: string - description: - description: An optional description to for the Reason. - type: string - metadata: - description: >- - An optional set of key-value pairs with additional - information. - type: object x-codeSamples: - lang: JavaScript label: JS Client @@ -18440,31 +17956,31 @@ paths: // must be previously logged in or use api token - medusa.admin.returnReasons.update(return_reason_id, { - label: 'Damaged' + medusa.admin.shippingProfiles.update(shipping_profile_id, { + name: 'Large Products' }) - .then(({ return_reason }) => { - console.log(return_reason.id); + .then(({ shipping_profile }) => { + console.log(shipping_profile.id); }); - lang: Shell label: cURL source: > curl --location --request POST - 'https://medusa-url.com/admin/return-reasons/{id}' \ + 'https://medusa-url.com/admin/shipping-profiles/{id} \ --header 'Authorization: Bearer {api_token}' \ --header 'Content-Type: application/json' \ --data-raw '{ - "label": "Damaged" + "name": "Large Products" }' security: - api_token: [] - cookie_auth: [] tags: - - Return Reason + - Shipping Profile responses: '200': description: OK @@ -18473,8 +17989,8 @@ paths: schema: type: object properties: - return_reason: - $ref: '#/components/schemas/return_reason' + shipping_profile: + $ref: '#/components/schemas/shipping_profile' '400': $ref: '#/components/responses/400_error' '401': @@ -18891,6 +18407,497 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' + /shipping-options: + post: + operationId: PostShippingOptions + summary: Create Shipping Option + description: Creates a Shipping Option + x-authenticated: true + requestBody: + content: + application/json: + schema: + type: object + required: + - name + - region_id + - provider_id + - data + - price_type + properties: + name: + description: The name of the Shipping Option + type: string + region_id: + description: >- + The ID of the Region in which the Shipping Option will be + available. + type: string + provider_id: + description: >- + The ID of the Fulfillment Provider that handles the Shipping + Option. + type: string + profile_id: + description: >- + The ID of the Shipping Profile to add the Shipping Option + to. + type: number + data: + description: >- + The data needed for the Fulfillment Provider to handle + shipping with this Shipping Option. + type: object + price_type: + description: The type of the Shipping Option price. + type: string + enum: + - flat_rate + - calculated + amount: + description: The amount to charge for the Shipping Option. + type: integer + requirements: + description: >- + The requirements that must be satisfied for the Shipping + Option to be available. + type: array + items: + required: + - type + - amount + properties: + type: + description: The type of the requirement + type: string + enum: + - max_subtotal + - min_subtotal + amount: + description: The amount to compare with. + type: integer + is_return: + description: Whether the Shipping Option defines a return shipment. + type: boolean + default: false + admin_only: + description: 'If true, the option can be used for draft orders' + type: boolean + default: false + metadata: + description: >- + An optional set of key-value pairs with additional + information. + type: object + includes_tax: + description: '[EXPERIMENTAL] Tax included in prices of shipping option' + type: boolean + 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.shippingOptions.create({ + name: 'PostFake', + region_id: "saasf", + provider_id: "manual", + data: { + }, + price_type: 'flat_rate' + }) + + .then(({ shipping_option }) => { + console.log(shipping_option.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/shipping-options' \ + + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "name": "PostFake", + "region_id": "afasf", + "provider_id": "manual", + "data": {}, + "price_type": "flat_rate" + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Shipping Option + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + shipping_option: + $ref: '#/components/schemas/shipping_option' + '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: GetShippingOptions + summary: List Shipping Options + description: Retrieves a list of Shipping Options. + x-authenticated: true + parameters: + - in: query + name: region_id + schema: + type: string + description: Region ID to fetch options from + - in: query + name: is_return + schema: + type: boolean + description: Flag for fetching return options only + - in: query + name: admin_only + schema: + type: boolean + description: Flag for fetching admin specific options + 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.shippingOptions.list() + + .then(({ shipping_options, count }) => { + console.log(shipping_options.length); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/admin/shipping-options' \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Shipping Option + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + shipping_options: + type: array + items: + $ref: '#/components/schemas/shipping_option' + count: + type: integer + description: The total number of items available + '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/{id}': + delete: + operationId: DeleteShippingOptionsOption + summary: Delete a Shipping Option + description: Deletes a Shipping Option. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Shipping Option. + 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.shippingOptions.delete(option_id) + + .then(({ id, object, deleted }) => { + console.log(id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request DELETE + 'https://medusa-url.com/admin/shipping-options/{option_id}' \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Shipping Option + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + id: + type: string + description: The ID of the deleted Shipping Option. + object: + type: string + description: The type of the object that was deleted. + default: shipping-option + deleted: + type: boolean + description: Whether or not the items were 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: GetShippingOptionsOption + summary: Get a Shipping Option + description: Retrieves a Shipping Option. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Shipping Option. + 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.shippingOptions.retrieve(option_id) + + .then(({ shipping_option }) => { + console.log(shipping_option.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/admin/shipping-options/{id}' \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Shipping Option + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + shipping_option: + $ref: '#/components/schemas/shipping_option' + '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: PostShippingOptionsOption + summary: Update Shipping Option + description: Updates a Shipping Option + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Shipping Option. + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + required: + - requirements + properties: + name: + description: The name of the Shipping Option + type: string + amount: + description: The amount to charge for the Shipping Option. + type: integer + admin_only: + description: 'If true, the option can be used for draft orders' + type: boolean + metadata: + description: >- + An optional set of key-value pairs with additional + information. + type: object + requirements: + description: >- + The requirements that must be satisfied for the Shipping + Option to be available. + type: array + items: + required: + - type + - amount + properties: + id: + description: The ID of the requirement + type: string + type: + description: The type of the requirement + type: string + enum: + - max_subtotal + - min_subtotal + amount: + description: The amount to compare with. + type: integer + includes_tax: + description: '[EXPERIMENTAL] Tax included in prices of shipping option' + type: boolean + 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.shippingOptions.update(option_id, { + name: 'PostFake', + requirements: [ + { + id, + type: 'max_subtotal', + amount: 1000 + } + ] + }) + + .then(({ shipping_option }) => { + console.log(shipping_option.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/shipping-options/{id}' \ + + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "requirements": [ + { + "type": "max_subtotal", + "amount": 1000 + } + ] + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Shipping Option + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + shipping_option: + $ref: '#/components/schemas/shipping_option' + '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 @@ -20222,165 +20229,6 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - /variants: - get: - operationId: GetVariants - summary: List Product Variants - description: Retrieves a list of Product Variants - x-authenticated: true - parameters: - - in: query - name: id - description: A Product Variant id to filter by. - schema: - type: string - - in: query - name: ids - description: A comma separated list of Product Variant ids to filter by. - schema: - type: string - - in: query - name: expand - description: A comma separated list of Product Variant relations to load. - schema: - type: string - - in: query - name: fields - description: A comma separated list of Product Variant fields to include. - schema: - type: string - - in: query - name: offset - description: How many product variants to skip in the result. - schema: - type: number - default: '0' - - in: query - name: limit - description: Maximum number of Product Variants to return. - schema: - type: number - default: '100' - - in: query - name: cart_id - description: The id of the cart to use for price selection. - schema: - type: string - - in: query - name: region_id - description: The id of the region to use for price selection. - schema: - type: string - - in: query - name: currency_code - description: The currency code to use for price selection. - schema: - type: string - - in: query - name: customer_id - description: The id of the customer to use for price selection. - schema: - type: string - - in: query - name: title - style: form - explode: false - description: product variant title to search for. - schema: - oneOf: - - type: string - description: a single title to search by - - type: array - description: multiple titles to search by - items: - type: string - - in: query - name: inventory_quantity - description: Filter by available inventory quantity - schema: - oneOf: - - type: number - description: a specific number to search by. - - type: object - description: search using less and greater than comparisons. - properties: - lt: - type: number - description: filter by inventory quantity less than this number - gt: - type: number - description: filter by inventory quantity greater than this number - lte: - type: number - description: >- - filter by inventory quantity less than or equal to this - number - gte: - type: number - description: >- - filter by inventory quantity greater than or equal to this - number - 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.variants.list() - - .then(({ variants, limit, offset, count }) => { - console.log(variants.length); - }); - - lang: Shell - label: cURL - source: > - curl --location --request GET - 'https://medusa-url.com/admin/variants' \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Product Variant - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - variants: - type: array - items: - $ref: '#/components/schemas/product_variant' - 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' /uploads/protected: post: operationId: PostUploadsProtected @@ -21082,6 +20930,165 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' + /variants: + get: + operationId: GetVariants + summary: List Product Variants + description: Retrieves a list of Product Variants + x-authenticated: true + parameters: + - in: query + name: id + description: A Product Variant id to filter by. + schema: + type: string + - in: query + name: ids + description: A comma separated list of Product Variant ids to filter by. + schema: + type: string + - in: query + name: expand + description: A comma separated list of Product Variant relations to load. + schema: + type: string + - in: query + name: fields + description: A comma separated list of Product Variant fields to include. + schema: + type: string + - in: query + name: offset + description: How many product variants to skip in the result. + schema: + type: number + default: '0' + - in: query + name: limit + description: Maximum number of Product Variants to return. + schema: + type: number + default: '100' + - in: query + name: cart_id + description: The id of the cart to use for price selection. + schema: + type: string + - in: query + name: region_id + description: The id of the region to use for price selection. + schema: + type: string + - in: query + name: currency_code + description: The currency code to use for price selection. + schema: + type: string + - in: query + name: customer_id + description: The id of the customer to use for price selection. + schema: + type: string + - in: query + name: title + style: form + explode: false + description: product variant title to search for. + schema: + oneOf: + - type: string + description: a single title to search by + - type: array + description: multiple titles to search by + items: + type: string + - in: query + name: inventory_quantity + description: Filter by available inventory quantity + schema: + oneOf: + - type: number + description: a specific number to search by. + - type: object + description: search using less and greater than comparisons. + properties: + lt: + type: number + description: filter by inventory quantity less than this number + gt: + type: number + description: filter by inventory quantity greater than this number + lte: + type: number + description: >- + filter by inventory quantity less than or equal to this + number + gte: + type: number + description: >- + filter by inventory quantity greater than or equal to this + number + 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.variants.list() + + .then(({ variants, limit, offset, count }) => { + console.log(variants.length); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/admin/variants' \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Product Variant + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + variants: + type: array + items: + $ref: '#/components/schemas/product_variant' + 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' components: responses: default_error: diff --git a/docs/api/admin-spec3.yaml b/docs/api/admin-spec3.yaml index 2f6475989b..f715e780af 100644 --- a/docs/api/admin-spec3.yaml +++ b/docs/api/admin-spec3.yaml @@ -202,115 +202,6 @@ tags: servers: - url: 'https://api.medusa-commerce.com/admin' paths: - /apps/authorizations: - post: - operationId: PostApps - summary: Generate Token for App - description: Generates a token for an application. - x-authenticated: true - requestBody: - content: - application/json: - schema: - type: object - required: - - application_name - - state - - code - properties: - application_name: - type: string - description: Name of the application for the token to be generated for. - state: - type: string - description: State of the application. - code: - type: string - description: The code for the generated token. - x-codeSamples: - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/apps/authorizations' \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "application_name": "example", - "state": "ready", - "code": "token" - }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - App - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - apps: - $ref: '#/components/schemas/OAuth' - '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' - /apps: - get: - operationId: GetApps - summary: List Applications - description: Retrieve a list of applications. - x-authenticated: true - x-codeSamples: - - lang: Shell - label: cURL - source: | - curl --location --request GET 'https://medusa-url.com/admin/apps' \ - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - App - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - apps: - type: array - items: - $ref: '#/components/schemas/OAuth' - '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' /auth: post: operationId: PostAuth @@ -1219,6 +1110,633 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' + '/collections/{id}/products/batch': + post: + operationId: PostProductsToCollection + summary: Update Products + description: Updates products associated with a Product Collection + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Collection. + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + required: + - product_ids + properties: + product_ids: + description: An array of Product IDs to add to the Product Collection. + type: array + items: + description: The ID of a Product to add to the Product Collection. + type: string + x-codeSamples: + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/collections/{id}/products/batch' \ + + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "product_ids": [ + "prod_01G1G5V2MBA328390B5AXJ610F" + ] + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Collection + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + collection: + $ref: '#/components/schemas/product_collection' + '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: DeleteProductsFromCollection + summary: Remove Product + description: Removes products associated with a Product Collection + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Collection. + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + required: + - product_ids + properties: + product_ids: + description: >- + An array of Product IDs to remove from the Product + Collection. + type: array + items: + description: The ID of a Product to add to the Product Collection. + type: string + x-codeSamples: + - lang: Shell + label: cURL + source: > + curl --location --request DELETE + 'https://medusa-url.com/admin/collections/{id}/products/batch' \ + + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "product_ids": [ + "prod_01G1G5V2MBA328390B5AXJ610F" + ] + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Collection + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + id: + type: string + description: The ID of the collection + object: + type: string + description: The type of object the removal was executed on + default: product-collection + removed_products: + description: The IDs of the products removed from the collection + type: array + items: + description: The ID of a Product to add to the Product Collection. + type: string + '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: + post: + operationId: PostCollections + summary: Create a Collection + description: Creates a Product Collection. + x-authenticated: true + requestBody: + content: + application/json: + schema: + type: object + required: + - title + properties: + title: + type: string + description: The title to identify the Collection by. + handle: + type: string + description: >- + An optional handle to be used in slugs, if none is provided + we will kebab-case the title. + metadata: + description: >- + An optional set of key-value pairs to hold additional + information. + type: object + 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.collections.create({ + title: 'New Collection' + }) + + .then(({ collection }) => { + console.log(collection.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/collections' \ + + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "title": "New Collection" + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Collection + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + collection: + $ref: '#/components/schemas/product_collection' + '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: GetCollections + summary: List Collections + description: Retrieve a list of Product Collection. + x-authenticated: true + parameters: + - in: query + name: limit + description: The number of collections to return. + schema: + type: integer + default: 10 + - in: query + name: offset + description: The number of collections to skip before the results. + schema: + type: integer + default: 0 + - in: query + name: title + description: The title of collections to return. + schema: + type: string + - in: query + name: handle + description: The handle of collections to return. + schema: + type: string + - in: query + name: q + description: a search term to search titles and handles. + schema: + type: string + - in: query + name: discount_condition_id + description: >- + The discount condition id on which to filter the product + collections. + schema: + type: string + - 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 + - in: query + name: deleted_at + description: Date comparison for when resulting collections were deleted. + 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 }) + + // must be previously logged in or use api token + + medusa.admin.collections.list() + + .then(({ collections, limit, offset, count }) => { + console.log(collections.length); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/admin/collections' \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Collection + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + collections: + type: array + items: + $ref: '#/components/schemas/product_collection' + 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' + '/collections/{id}': + delete: + operationId: DeleteCollectionsCollection + summary: Delete a Collection + description: Deletes a Product Collection. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Collection. + 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.collections.delete(collection_id) + + .then(({ id, object, deleted }) => { + console.log(id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request DELETE + 'https://medusa-url.com/admin/collections/{id}' \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Collection + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + id: + type: string + description: The ID of the deleted Collection + object: + type: string + description: The type of the object that was deleted. + default: product-collection + deleted: + type: boolean + description: Whether the collection was deleted successfully or not. + 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: GetCollectionsCollection + summary: Get a Collection + description: Retrieves a Product Collection. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Product Collection + 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.collections.retrieve(collection_id) + + .then(({ collection }) => { + console.log(collection.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/admin/collections/{id}' \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Collection + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + collection: + $ref: '#/components/schemas/product_collection' + '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: PostCollectionsCollection + summary: Update a Collection + description: Updates a Product Collection. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Collection. + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + title: + type: string + description: The title to identify the Collection by. + handle: + type: string + description: >- + An optional handle to be used in slugs, if none is provided + we will kebab-case the title. + metadata: + description: >- + An optional set of key-value pairs to hold additional + information. + type: object + 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.collections.update(collection_id, { + title: 'New Collection' + }) + + .then(({ collection }) => { + console.log(collection.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/collections/{id}' \ + + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "title": "New Collection" + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Collection + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + collection: + $ref: '#/components/schemas/product_collection' + '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 @@ -1982,54 +2500,52 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - '/collections/{id}/products/batch': + /apps/authorizations: post: - operationId: PostProductsToCollection - summary: Update Products - description: Updates products associated with a Product Collection + operationId: PostApps + summary: Generate Token for App + description: Generates a token for an application. x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Collection. - schema: - type: string requestBody: content: application/json: schema: type: object required: - - product_ids + - application_name + - state + - code properties: - product_ids: - description: An array of Product IDs to add to the Product Collection. - type: array - items: - description: The ID of a Product to add to the Product Collection. - type: string + application_name: + type: string + description: Name of the application for the token to be generated for. + state: + type: string + description: State of the application. + code: + type: string + description: The code for the generated token. x-codeSamples: - lang: Shell label: cURL source: > curl --location --request POST - 'https://medusa-url.com/admin/collections/{id}/products/batch' \ + 'https://medusa-url.com/admin/apps/authorizations' \ --header 'Authorization: Bearer {api_token}' \ --header 'Content-Type: application/json' \ --data-raw '{ - "product_ids": [ - "prod_01G1G5V2MBA328390B5AXJ610F" - ] + "application_name": "example", + "state": "ready", + "code": "token" }' security: - api_token: [] - cookie_auth: [] tags: - - Collection + - App responses: '200': description: OK @@ -2038,8 +2554,8 @@ paths: schema: type: object properties: - collection: - $ref: '#/components/schemas/product_collection' + apps: + $ref: '#/components/schemas/OAuth' '400': $ref: '#/components/responses/400_error' '401': @@ -2052,55 +2568,23 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - delete: - operationId: DeleteProductsFromCollection - summary: Remove Product - description: Removes products associated with a Product Collection + /apps: + get: + operationId: GetApps + summary: List Applications + description: Retrieve a list of applications. x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Collection. - schema: - type: string - requestBody: - content: - application/json: - schema: - type: object - required: - - product_ids - properties: - product_ids: - description: >- - An array of Product IDs to remove from the Product - Collection. - type: array - items: - description: The ID of a Product to add to the Product Collection. - type: string x-codeSamples: - lang: Shell label: cURL - source: > - curl --location --request DELETE - 'https://medusa-url.com/admin/collections/{id}/products/batch' \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "product_ids": [ - "prod_01G1G5V2MBA328390B5AXJ610F" - ] - }' + source: | + curl --location --request GET 'https://medusa-url.com/admin/apps' \ + --header 'Authorization: Bearer {api_token}' security: - api_token: [] - cookie_auth: [] tags: - - Collection + - App responses: '200': description: OK @@ -2109,494 +2593,10 @@ paths: schema: type: object properties: - id: - type: string - description: The ID of the collection - object: - type: string - description: The type of object the removal was executed on - default: product-collection - removed_products: - description: The IDs of the products removed from the collection + apps: type: array items: - description: The ID of a Product to add to the Product Collection. - type: string - '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: - post: - operationId: PostCollections - summary: Create a Collection - description: Creates a Product Collection. - x-authenticated: true - requestBody: - content: - application/json: - schema: - type: object - required: - - title - properties: - title: - type: string - description: The title to identify the Collection by. - handle: - type: string - description: >- - An optional handle to be used in slugs, if none is provided - we will kebab-case the title. - metadata: - description: >- - An optional set of key-value pairs to hold additional - information. - type: object - 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.collections.create({ - title: 'New Collection' - }) - - .then(({ collection }) => { - console.log(collection.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/collections' \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "title": "New Collection" - }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Collection - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - collection: - $ref: '#/components/schemas/product_collection' - '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: GetCollections - summary: List Collections - description: Retrieve a list of Product Collection. - x-authenticated: true - parameters: - - in: query - name: limit - description: The number of collections to return. - schema: - type: integer - default: 10 - - in: query - name: offset - description: The number of collections to skip before the results. - schema: - type: integer - default: 0 - - in: query - name: title - description: The title of collections to return. - schema: - type: string - - in: query - name: handle - description: The handle of collections to return. - schema: - type: string - - in: query - name: q - description: a search term to search titles and handles. - schema: - type: string - - in: query - name: discount_condition_id - description: >- - The discount condition id on which to filter the product - collections. - schema: - type: string - - 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 - - in: query - name: deleted_at - description: Date comparison for when resulting collections were deleted. - 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 }) - - // must be previously logged in or use api token - - medusa.admin.collections.list() - - .then(({ collections, limit, offset, count }) => { - console.log(collections.length); - }); - - lang: Shell - label: cURL - source: > - curl --location --request GET - 'https://medusa-url.com/admin/collections' \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Collection - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - collections: - type: array - items: - $ref: '#/components/schemas/product_collection' - 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' - '/collections/{id}': - delete: - operationId: DeleteCollectionsCollection - summary: Delete a Collection - description: Deletes a Product Collection. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Collection. - 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.collections.delete(collection_id) - - .then(({ id, object, deleted }) => { - console.log(id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request DELETE - 'https://medusa-url.com/admin/collections/{id}' \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Collection - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - id: - type: string - description: The ID of the deleted Collection - object: - type: string - description: The type of the object that was deleted. - default: product-collection - deleted: - type: boolean - description: Whether the collection was deleted successfully or not. - 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: GetCollectionsCollection - summary: Get a Collection - description: Retrieves a Product Collection. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Product Collection - 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.collections.retrieve(collection_id) - - .then(({ collection }) => { - console.log(collection.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request GET - 'https://medusa-url.com/admin/collections/{id}' \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Collection - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - collection: - $ref: '#/components/schemas/product_collection' - '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: PostCollectionsCollection - summary: Update a Collection - description: Updates a Product Collection. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Collection. - schema: - type: string - requestBody: - content: - application/json: - schema: - type: object - properties: - title: - type: string - description: The title to identify the Collection by. - handle: - type: string - description: >- - An optional handle to be used in slugs, if none is provided - we will kebab-case the title. - metadata: - description: >- - An optional set of key-value pairs to hold additional - information. - type: object - 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.collections.update(collection_id, { - title: 'New Collection' - }) - - .then(({ collection }) => { - console.log(collection.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/collections/{id}' \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "title": "New Collection" - }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Collection - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - collection: - $ref: '#/components/schemas/product_collection' + $ref: '#/components/schemas/OAuth' '400': $ref: '#/components/responses/400_error' '401': @@ -2992,6 +2992,865 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' + /draft-orders: + post: + operationId: PostDraftOrders + summary: Create a Draft Order + description: Creates a Draft Order + x-authenticated: true + requestBody: + content: + application/json: + schema: + type: object + required: + - email + - items + - region_id + - shipping_methods + properties: + status: + description: The status of the draft order + type: string + enum: + - open + - completed + email: + description: The email of the customer of the draft order + type: string + format: email + billing_address: + description: The Address to be used for billing purposes. + anyOf: + - $ref: '#/components/schemas/address_fields' + - type: string + shipping_address: + description: The Address to be used for shipping. + anyOf: + - $ref: '#/components/schemas/address_fields' + - type: string + items: + description: The Line Items that have been received. + type: array + items: + type: object + required: + - quantity + properties: + variant_id: + description: >- + The ID of the Product Variant to generate the Line + Item from. + type: string + unit_price: + description: The potential custom price of the item. + type: integer + title: + description: The potential custom title of the item. + type: string + quantity: + description: The quantity of the Line Item. + type: integer + metadata: + description: >- + The optional key-value map with additional details + about the Line Item. + type: object + region_id: + description: The ID of the region for the draft order + type: string + discounts: + description: The discounts to add on the draft order + type: array + items: + type: object + required: + - code + properties: + code: + description: The code of the discount to apply + type: string + customer_id: + description: The ID of the customer to add on the draft order + type: string + no_notification_order: + description: >- + An optional flag passed to the resulting order to determine + use of notifications. + type: boolean + shipping_methods: + description: The shipping methods for the draft order + type: array + items: + type: object + required: + - option_id + properties: + option_id: + description: The ID of the shipping option in use + type: string + data: + description: >- + The optional additional data needed for the shipping + method + type: object + price: + description: The potential custom price of the shipping + type: integer + metadata: + description: >- + The optional key-value map with additional details about the + Draft Order. + type: object + 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.draftOrders.create({ + email: 'user@example.com', + region_id, + items: [ + { + quantity: 1 + } + ], + shipping_methods: [ + { + option_id + } + ], + }) + + .then(({ draft_order }) => { + console.log(draft_order.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/draft-orders' \ + + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "email": "user@example.com", + "region_id": "{region_id}" + "items": [ + { + "quantity": 1 + } + ], + "shipping_methods": [ + { + "option_id": "{option_id}" + } + ] + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Draft Order + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + draft_order: + $ref: '#/components/schemas/draft-order' + '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: GetDraftOrders + summary: List Draft Orders + description: Retrieves an list of Draft Orders + 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 emails in carts associated with draft orders + and display IDs of draft orders + 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.draftOrders.list() + + .then(({ draft_orders, limit, offset, count }) => { + console.log(draft_orders.length); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/admin/draft-orders' \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Draft Order + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + draft_orders: + type: array + items: + $ref: '#/components/schemas/draft-order' + 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' + '/draft-orders/{id}/line-items': + post: + operationId: PostDraftOrdersDraftOrderLineItems + summary: Create a Line Item + description: Creates a Line Item for the Draft Order + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Draft Order. + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + required: + - quantity + properties: + variant_id: + description: >- + The ID of the Product Variant to generate the Line Item + from. + type: string + unit_price: + description: The potential custom price of the item. + type: integer + title: + description: The potential custom title of the item. + type: string + default: Custom item + quantity: + description: The quantity of the Line Item. + type: integer + metadata: + description: >- + The optional key-value map with additional details about the + Line Item. + type: object + 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.draftOrders.addLineItem(draft_order_id, { + quantity: 1 + }) + + .then(({ draft_order }) => { + console.log(draft_order.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/draft-orders/{id}/line-items' \ + + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "quantity": 1 + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Draft Order + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + draft_order: + $ref: '#/components/schemas/draft-order' + '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/{id}': + delete: + operationId: DeleteDraftOrdersDraftOrder + summary: Delete a Draft Order + description: Deletes a Draft Order + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Draft Order. + 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.draftOrders.delete(draft_order_id) + + .then(({ id, object, deleted }) => { + console.log(id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request DELETE + 'https://medusa-url.com/admin/draft-orders/{id}' \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Draft Order + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + id: + type: string + description: The ID of the deleted Draft Order. + object: + type: string + description: The type of the object that was deleted. + default: draft-order + deleted: + type: boolean + description: Whether the draft order was deleted successfully or not. + 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: GetDraftOrdersDraftOrder + summary: Get a Draft Order + description: Retrieves a Draft Order. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Draft Order. + 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.draftOrders.retrieve(draft_order_id) + + .then(({ draft_order }) => { + console.log(draft_order.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/admin/draft-orders/{id}' \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Draft Order + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + draft_order: + $ref: '#/components/schemas/draft-order' + '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/{id}/line-items/{line_id}': + delete: + operationId: DeleteDraftOrdersDraftOrderLineItemsItem + summary: Delete a Line Item + description: Removes a Line Item from a Draft Order. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Draft Order. + schema: + type: string + - in: path + name: line_id + required: true + description: The ID of the Draft Order. + 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.draftOrders.removeLineItem(draft_order_id, item_id) + + .then(({ draft_order }) => { + console.log(draft_order.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request DELETE + 'https://medusa-url.com/admin/draft-orders/{id}/line-items/{line_id}' + \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Draft Order + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + draft_order: + $ref: '#/components/schemas/draft-order' + '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: PostDraftOrdersDraftOrderLineItemsItem + summary: Update a Line Item + description: Updates a Line Item for a Draft Order + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Draft Order. + schema: + type: string + - in: path + name: line_id + required: true + description: The ID of the Line Item. + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + unit_price: + description: The potential custom price of the item. + type: integer + title: + description: The potential custom title of the item. + type: string + quantity: + description: The quantity of the Line Item. + type: integer + metadata: + description: >- + The optional key-value map with additional details about the + Line Item. + type: object + 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.draftOrders.updateLineItem(draft_order_id, line_id, { + quantity: 1 + }) + + .then(({ draft_order }) => { + console.log(draft_order.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/draft-orders/{id}/line-items/{line_id}' + \ + + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "quantity": 1 + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Draft Order + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + draft_order: + $ref: '#/components/schemas/draft-order' + '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/{id}/pay': + post: + summary: Registers a Payment + operationId: PostDraftOrdersDraftOrderRegisterPayment + description: Registers a payment for a Draft Order. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The Draft Order id. + 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.draftOrders.markPaid(draft_order_id) + + .then(({ order }) => { + console.log(order.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/draft-orders/{id}/pay' \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Draft Order + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + order: + $ref: '#/components/schemas/draft-order' + '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' + '/admin/draft-orders/{id}': + post: + operationId: PostDraftOrdersDraftOrder + summary: Update a Draft Order + description: Updates a Draft Order. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Draft Order. + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + region_id: + type: string + description: The ID of the Region to create the Draft Order in. + country_code: + type: string + description: The 2 character ISO code for the Country. + externalDocs: + url: >- + https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements + description: See a list of codes. + email: + type: string + description: An email to be used on the Draft Order. + format: email + billing_address: + description: The Address to be used for billing purposes. + anyOf: + - $ref: '#/components/schemas/address_fields' + - type: string + shipping_address: + description: The Address to be used for shipping. + anyOf: + - $ref: '#/components/schemas/address_fields' + - type: string + discounts: + description: An array of Discount codes to add to the Draft Order. + type: array + items: + type: object + required: + - code + properties: + code: + description: The code that a Discount is identifed by. + type: string + no_notification_order: + description: >- + An optional flag passed to the resulting order to determine + use of notifications. + type: boolean + customer_id: + description: The ID of the Customer to associate the Draft Order with. + 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.draftOrders.update(draft_order_id, { + email: "user@example.com" + }) + + .then(({ draft_order }) => { + console.log(draft_order.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/draft-orders/{id}' \ + + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "email": "user@example.com" + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Draft Order + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + draft_order: + $ref: '#/components/schemas/draft-order' + '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 @@ -4745,865 +5604,6 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - /draft-orders: - post: - operationId: PostDraftOrders - summary: Create a Draft Order - description: Creates a Draft Order - x-authenticated: true - requestBody: - content: - application/json: - schema: - type: object - required: - - email - - items - - region_id - - shipping_methods - properties: - status: - description: The status of the draft order - type: string - enum: - - open - - completed - email: - description: The email of the customer of the draft order - type: string - format: email - billing_address: - description: The Address to be used for billing purposes. - anyOf: - - $ref: '#/components/schemas/address_fields' - - type: string - shipping_address: - description: The Address to be used for shipping. - anyOf: - - $ref: '#/components/schemas/address_fields' - - type: string - items: - description: The Line Items that have been received. - type: array - items: - type: object - required: - - quantity - properties: - variant_id: - description: >- - The ID of the Product Variant to generate the Line - Item from. - type: string - unit_price: - description: The potential custom price of the item. - type: integer - title: - description: The potential custom title of the item. - type: string - quantity: - description: The quantity of the Line Item. - type: integer - metadata: - description: >- - The optional key-value map with additional details - about the Line Item. - type: object - region_id: - description: The ID of the region for the draft order - type: string - discounts: - description: The discounts to add on the draft order - type: array - items: - type: object - required: - - code - properties: - code: - description: The code of the discount to apply - type: string - customer_id: - description: The ID of the customer to add on the draft order - type: string - no_notification_order: - description: >- - An optional flag passed to the resulting order to determine - use of notifications. - type: boolean - shipping_methods: - description: The shipping methods for the draft order - type: array - items: - type: object - required: - - option_id - properties: - option_id: - description: The ID of the shipping option in use - type: string - data: - description: >- - The optional additional data needed for the shipping - method - type: object - price: - description: The potential custom price of the shipping - type: integer - metadata: - description: >- - The optional key-value map with additional details about the - Draft Order. - type: object - 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.draftOrders.create({ - email: 'user@example.com', - region_id, - items: [ - { - quantity: 1 - } - ], - shipping_methods: [ - { - option_id - } - ], - }) - - .then(({ draft_order }) => { - console.log(draft_order.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/draft-orders' \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "email": "user@example.com", - "region_id": "{region_id}" - "items": [ - { - "quantity": 1 - } - ], - "shipping_methods": [ - { - "option_id": "{option_id}" - } - ] - }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Draft Order - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - draft_order: - $ref: '#/components/schemas/draft-order' - '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: GetDraftOrders - summary: List Draft Orders - description: Retrieves an list of Draft Orders - 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 emails in carts associated with draft orders - and display IDs of draft orders - 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.draftOrders.list() - - .then(({ draft_orders, limit, offset, count }) => { - console.log(draft_orders.length); - }); - - lang: Shell - label: cURL - source: > - curl --location --request GET - 'https://medusa-url.com/admin/draft-orders' \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Draft Order - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - draft_orders: - type: array - items: - $ref: '#/components/schemas/draft-order' - 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' - '/draft-orders/{id}/line-items': - post: - operationId: PostDraftOrdersDraftOrderLineItems - summary: Create a Line Item - description: Creates a Line Item for the Draft Order - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Draft Order. - schema: - type: string - requestBody: - content: - application/json: - schema: - type: object - required: - - quantity - properties: - variant_id: - description: >- - The ID of the Product Variant to generate the Line Item - from. - type: string - unit_price: - description: The potential custom price of the item. - type: integer - title: - description: The potential custom title of the item. - type: string - default: Custom item - quantity: - description: The quantity of the Line Item. - type: integer - metadata: - description: >- - The optional key-value map with additional details about the - Line Item. - type: object - 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.draftOrders.addLineItem(draft_order_id, { - quantity: 1 - }) - - .then(({ draft_order }) => { - console.log(draft_order.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/draft-orders/{id}/line-items' \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "quantity": 1 - }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Draft Order - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - draft_order: - $ref: '#/components/schemas/draft-order' - '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/{id}': - delete: - operationId: DeleteDraftOrdersDraftOrder - summary: Delete a Draft Order - description: Deletes a Draft Order - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Draft Order. - 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.draftOrders.delete(draft_order_id) - - .then(({ id, object, deleted }) => { - console.log(id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request DELETE - 'https://medusa-url.com/admin/draft-orders/{id}' \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Draft Order - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - id: - type: string - description: The ID of the deleted Draft Order. - object: - type: string - description: The type of the object that was deleted. - default: draft-order - deleted: - type: boolean - description: Whether the draft order was deleted successfully or not. - 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: GetDraftOrdersDraftOrder - summary: Get a Draft Order - description: Retrieves a Draft Order. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Draft Order. - 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.draftOrders.retrieve(draft_order_id) - - .then(({ draft_order }) => { - console.log(draft_order.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request GET - 'https://medusa-url.com/admin/draft-orders/{id}' \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Draft Order - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - draft_order: - $ref: '#/components/schemas/draft-order' - '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/{id}/line-items/{line_id}': - delete: - operationId: DeleteDraftOrdersDraftOrderLineItemsItem - summary: Delete a Line Item - description: Removes a Line Item from a Draft Order. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Draft Order. - schema: - type: string - - in: path - name: line_id - required: true - description: The ID of the Draft Order. - 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.draftOrders.removeLineItem(draft_order_id, item_id) - - .then(({ draft_order }) => { - console.log(draft_order.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request DELETE - 'https://medusa-url.com/admin/draft-orders/{id}/line-items/{line_id}' - \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Draft Order - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - draft_order: - $ref: '#/components/schemas/draft-order' - '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: PostDraftOrdersDraftOrderLineItemsItem - summary: Update a Line Item - description: Updates a Line Item for a Draft Order - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Draft Order. - schema: - type: string - - in: path - name: line_id - required: true - description: The ID of the Line Item. - schema: - type: string - requestBody: - content: - application/json: - schema: - type: object - properties: - unit_price: - description: The potential custom price of the item. - type: integer - title: - description: The potential custom title of the item. - type: string - quantity: - description: The quantity of the Line Item. - type: integer - metadata: - description: >- - The optional key-value map with additional details about the - Line Item. - type: object - 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.draftOrders.updateLineItem(draft_order_id, line_id, { - quantity: 1 - }) - - .then(({ draft_order }) => { - console.log(draft_order.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/draft-orders/{id}/line-items/{line_id}' - \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "quantity": 1 - }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Draft Order - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - draft_order: - $ref: '#/components/schemas/draft-order' - '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/{id}/pay': - post: - summary: Registers a Payment - operationId: PostDraftOrdersDraftOrderRegisterPayment - description: Registers a payment for a Draft Order. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The Draft Order id. - 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.draftOrders.markPaid(draft_order_id) - - .then(({ order }) => { - console.log(order.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/draft-orders/{id}/pay' \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Draft Order - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - order: - $ref: '#/components/schemas/draft-order' - '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' - '/admin/draft-orders/{id}': - post: - operationId: PostDraftOrdersDraftOrder - summary: Update a Draft Order - description: Updates a Draft Order. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Draft Order. - schema: - type: string - requestBody: - content: - application/json: - schema: - type: object - properties: - region_id: - type: string - description: The ID of the Region to create the Draft Order in. - country_code: - type: string - description: The 2 character ISO code for the Country. - externalDocs: - url: >- - https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements - description: See a list of codes. - email: - type: string - description: An email to be used on the Draft Order. - format: email - billing_address: - description: The Address to be used for billing purposes. - anyOf: - - $ref: '#/components/schemas/address_fields' - - type: string - shipping_address: - description: The Address to be used for shipping. - anyOf: - - $ref: '#/components/schemas/address_fields' - - type: string - discounts: - description: An array of Discount codes to add to the Draft Order. - type: array - items: - type: object - required: - - code - properties: - code: - description: The code that a Discount is identifed by. - type: string - no_notification_order: - description: >- - An optional flag passed to the resulting order to determine - use of notifications. - type: boolean - customer_id: - description: The ID of the Customer to associate the Draft Order with. - 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.draftOrders.update(draft_order_id, { - email: "user@example.com" - }) - - .then(({ draft_order }) => { - console.log(draft_order.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/draft-orders/{id}' \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "email": "user@example.com" - }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Draft Order - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - draft_order: - $ref: '#/components/schemas/draft-order' - '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: post: operationId: PostGiftCards @@ -6967,874 +6967,6 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - '/order-edits/{id}/items': - post: - operationId: PostOrderEditsEditLineItems - summary: Add an line item to an order (edit) - description: Create an OrderEdit LineItem. - parameters: - - in: path - name: id - required: true - description: The ID of the Order Edit. - schema: - type: string - requestBody: - content: - application/json: - schema: - type: object - required: - - variant_id - - quantity - properties: - variant_id: - description: The ID of the variant ID to add - type: string - quantity: - description: The quantity to add - type: number - metadata: - description: >- - An optional set of key-value pairs to hold additional - information. - type: object - x-authenticated: true - 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.orderEdits.addLineItem(order_edit_id, { - variant_id, - quantity - }) - - .then(({ order_edit }) => { - console.log(order_edit.id) - }) - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/order-edits/{id}/items' \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ "variant_id": "variant_01G1G5V2MRX2V3PVSR2WXYPFB6", - "quantity": 3 }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - OrderEdit - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - order_edit: - $ref: '#/components/schemas/order_edit' - '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}/cancel': - post: - operationId: PostOrderEditsOrderEditCancel - summary: Cancel an OrderEdit - description: Cancels an OrderEdit. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the OrderEdit. - 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.orderEdits.cancel(order_edit_id) - .then(({ order_edit }) => { - console.log(order_edit.id) - }) - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/order-edits/{id}/cancel' \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - OrderEdit - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - order_edit: - $ref: '#/components/schemas/order_edit' - '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}/confirm': - post: - operationId: PostOrderEditsOrderEditConfirm - summary: Confirms an OrderEdit - description: Confirms an OrderEdit. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the order edit. - 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.orderEdits.confirm(order_edit_id) - .then(({ order_edit }) => { - console.log(order_edit.id) - }) - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/order-edits/{id}/confirm' \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - OrderEdit - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - order_edit: - $ref: '#/components/schemas/order_edit' - '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: - post: - operationId: PostOrderEdits - summary: Create an OrderEdit - description: Creates an OrderEdit. - requestBody: - content: - application/json: - schema: - type: object - required: - - order_id - properties: - order_id: - description: The ID of the order to create the edit for. - type: string - internal_note: - description: An optional note to create for the order edit. - type: string - x-authenticated: true - 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.orderEdits.create({ order_id }) - .then(({ order_edit }) => { - console.log(order_edit.id) - }) - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/order-edits' \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ "order_id": "my_order_id", "internal_note": - "my_optional_note" }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - OrderEdit - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - order_edit: - $ref: '#/components/schemas/order_edit' - '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: GetOrderEdits - summary: List OrderEdits - description: List OrderEdits. - x-authenticated: true - parameters: - - in: query - name: q - description: Query used for searching order edit internal note. - schema: - type: string - - in: query - name: order_id - description: List order edits by order id. - schema: - type: string - - in: query - name: limit - description: The number of items in the response - schema: - type: number - default: '20' - - in: query - name: offset - description: The offset of items in response - schema: - type: number - default: '0' - - 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-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.orderEdits.list() - .then(({ order_edits, count, limit, offset }) => { - console.log(order_edits.length) - }) - - lang: Shell - label: cURL - source: > - curl --location --request GET - 'https://medusa-url.com/admin/order-edits' \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - OrderEdit - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - order_edits: - type: array - $ref: '#/components/schemas/order_edit' - 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' - '/order-edits/{id}/items/{item_id}': - delete: - operationId: DeleteOrderEditsOrderEditLineItemsLineItem - summary: Delete line items from an order edit and create change item - description: Delete line items from an order edit and create change item - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Order Edit to delete from. - schema: - type: string - - in: path - name: item_id - required: true - description: The ID of the order edit item to delete from order. - 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.orderEdits.removeLineItem(order_edit_id, line_item_id) - .then(({ order_edit }) => { - console.log(order_edit.id) - }) - - lang: Shell - label: cURL - source: > - curl --location --request DELETE - 'https://medusa-url.com/admin/order-edits/{id}/items/{item_id}' \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - OrderEdit - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - order_edit: - $ref: '#/components/schemas/order_edit' - '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: PostOrderEditsEditLineItemsLineItem - summary: Create or update the order edit change holding the line item changes - description: Create or update the order edit change holding the line item changes - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Order Edit to update. - schema: - type: string - - in: path - name: item_id - required: true - description: The ID of the order edit item to update. - schema: - type: string - requestBody: - content: - application/json: - schema: - type: object - required: - - quantity - properties: - quantity: - description: The quantity to update - type: number - 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.orderEdits.updateLineItem(order_edit_id, line_item_id, - { - quantity: 5 - }) - .then(({ order_edit }) => { - console.log(order_edit.id) - }) - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/order-edits/{id}/items/{item_id}' \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ "quantity": 5 }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - OrderEdit - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - order_edit: - $ref: '#/components/schemas/order_edit' - '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}/changes/{change_id}': - delete: - operationId: DeleteOrderEditsOrderEditItemChange - summary: Delete an Order Edit Item Change - description: Deletes an Order Edit Item Change - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Order Edit to delete. - schema: - type: string - - in: path - name: change_id - required: true - description: The ID of the Order Edit Item Change 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.orderEdits.deleteItemChange(order_edit_id, - item_change_id) - .then(({ id, object, deleted }) => { - console.log(id) - }) - - lang: Shell - label: cURL - source: > - curl --location --request DELETE - 'https://medusa-url.com/admin/order-edits/{id}/changes/{change_id}' - \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - OrderEdit - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - id: - type: string - description: The ID of the deleted Order Edit Item Change. - object: - type: string - description: The type of the object that was deleted. - format: item_change - deleted: - type: boolean - description: Whether or not the Order Edit Item Change was deleted. - default: true - '400': - $ref: '#/components/responses/400_error' - '/order-edits/{id}': - delete: - operationId: DeleteOrderEditsOrderEdit - summary: Delete an Order Edit - description: Deletes an Order Edit - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Order Edit 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.orderEdits.delete(order_edit_id) - .then(({ id, object, deleted }) => { - console.log(id) - }) - - lang: Shell - label: cURL - source: > - curl --location --request DELETE - 'https://medusa-url.com/admin/order-edits/{id}' \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - OrderEdit - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - id: - type: string - description: The ID of the deleted Order Edit. - object: - type: string - description: The type of the object that was deleted. - format: order_edit - deleted: - type: boolean - description: Whether or not the Order Edit was deleted. - default: true - '400': - $ref: '#/components/responses/400_error' - get: - operationId: GetOrderEditsOrderEdit - summary: Retrieve an OrderEdit - description: Retrieves a OrderEdit. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the OrderEdit. - 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-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.orderEdits.retrieve(orderEditId) - .then(({ order_edit }) => { - console.log(order_edit.id) - }) - - lang: Shell - label: cURL - source: > - curl --location --request GET - 'https://medusa-url.com/admin/order-edits/{id}' \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - OrderEdit - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - order_edit: - $ref: '#/components/schemas/order_edit' - '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: PostOrderEditsOrderEdit - summary: Updates an OrderEdit - description: Updates a OrderEdit. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the OrderEdit. - schema: - type: string - requestBody: - content: - application/json: - schema: - type: object - properties: - internal_note: - description: An optional note to create or update for the order edit. - 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.orderEdits.update(order_edit_id, { - internal_note: "internal reason XY" - }) - .then(({ order_edit }) => { - console.log(order_edit.id) - }) - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/order-edits/{id}' \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "internal_note": "internal reason XY" - }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - OrderEdit - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - order_edit: - $ref: '#/components/schemas/order_edit' - '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}/request': - post: - operationId: PostOrderEditsOrderEditRequest - summary: Request order edit confirmation - description: Request customer confirmation of an Order Edit - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Order Edit to request confirmation from. - 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.orderEdits.requestConfirmation(order_edit_id) - .then({ order_edit }) => { - console.log(order_edit.id) - }) - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/order-edits/{id}/request' \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - OrderEdit - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - order_edit: - $ref: '#/components/schemas/order_edit' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '500': - $ref: '#/components/responses/500_error' '/orders/{id}/shipping-methods': post: operationId: PostOrdersOrderShippingMethods @@ -10466,6 +9598,874 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' + '/order-edits/{id}/items': + post: + operationId: PostOrderEditsEditLineItems + summary: Add an line item to an order (edit) + description: Create an OrderEdit LineItem. + parameters: + - in: path + name: id + required: true + description: The ID of the Order Edit. + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + required: + - variant_id + - quantity + properties: + variant_id: + description: The ID of the variant ID to add + type: string + quantity: + description: The quantity to add + type: number + metadata: + description: >- + An optional set of key-value pairs to hold additional + information. + type: object + x-authenticated: true + 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.orderEdits.addLineItem(order_edit_id, { + variant_id, + quantity + }) + + .then(({ order_edit }) => { + console.log(order_edit.id) + }) + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/order-edits/{id}/items' \ + + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ "variant_id": "variant_01G1G5V2MRX2V3PVSR2WXYPFB6", + "quantity": 3 }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - OrderEdit + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + order_edit: + $ref: '#/components/schemas/order_edit' + '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}/cancel': + post: + operationId: PostOrderEditsOrderEditCancel + summary: Cancel an OrderEdit + description: Cancels an OrderEdit. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the OrderEdit. + 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.orderEdits.cancel(order_edit_id) + .then(({ order_edit }) => { + console.log(order_edit.id) + }) + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/order-edits/{id}/cancel' \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - OrderEdit + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + order_edit: + $ref: '#/components/schemas/order_edit' + '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}/confirm': + post: + operationId: PostOrderEditsOrderEditConfirm + summary: Confirms an OrderEdit + description: Confirms an OrderEdit. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the order edit. + 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.orderEdits.confirm(order_edit_id) + .then(({ order_edit }) => { + console.log(order_edit.id) + }) + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/order-edits/{id}/confirm' \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - OrderEdit + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + order_edit: + $ref: '#/components/schemas/order_edit' + '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: + post: + operationId: PostOrderEdits + summary: Create an OrderEdit + description: Creates an OrderEdit. + requestBody: + content: + application/json: + schema: + type: object + required: + - order_id + properties: + order_id: + description: The ID of the order to create the edit for. + type: string + internal_note: + description: An optional note to create for the order edit. + type: string + x-authenticated: true + 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.orderEdits.create({ order_id }) + .then(({ order_edit }) => { + console.log(order_edit.id) + }) + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/order-edits' \ + + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ "order_id": "my_order_id", "internal_note": + "my_optional_note" }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - OrderEdit + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + order_edit: + $ref: '#/components/schemas/order_edit' + '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: GetOrderEdits + summary: List OrderEdits + description: List OrderEdits. + x-authenticated: true + parameters: + - in: query + name: q + description: Query used for searching order edit internal note. + schema: + type: string + - in: query + name: order_id + description: List order edits by order id. + schema: + type: string + - in: query + name: limit + description: The number of items in the response + schema: + type: number + default: '20' + - in: query + name: offset + description: The offset of items in response + schema: + type: number + default: '0' + - 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-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.orderEdits.list() + .then(({ order_edits, count, limit, offset }) => { + console.log(order_edits.length) + }) + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/admin/order-edits' \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - OrderEdit + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + order_edits: + type: array + $ref: '#/components/schemas/order_edit' + 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' + '/order-edits/{id}/items/{item_id}': + delete: + operationId: DeleteOrderEditsOrderEditLineItemsLineItem + summary: Delete line items from an order edit and create change item + description: Delete line items from an order edit and create change item + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order Edit to delete from. + schema: + type: string + - in: path + name: item_id + required: true + description: The ID of the order edit item to delete from order. + 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.orderEdits.removeLineItem(order_edit_id, line_item_id) + .then(({ order_edit }) => { + console.log(order_edit.id) + }) + - lang: Shell + label: cURL + source: > + curl --location --request DELETE + 'https://medusa-url.com/admin/order-edits/{id}/items/{item_id}' \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - OrderEdit + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + order_edit: + $ref: '#/components/schemas/order_edit' + '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: PostOrderEditsEditLineItemsLineItem + summary: Create or update the order edit change holding the line item changes + description: Create or update the order edit change holding the line item changes + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order Edit to update. + schema: + type: string + - in: path + name: item_id + required: true + description: The ID of the order edit item to update. + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + required: + - quantity + properties: + quantity: + description: The quantity to update + type: number + 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.orderEdits.updateLineItem(order_edit_id, line_item_id, + { + quantity: 5 + }) + .then(({ order_edit }) => { + console.log(order_edit.id) + }) + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/order-edits/{id}/items/{item_id}' \ + + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ "quantity": 5 }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - OrderEdit + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + order_edit: + $ref: '#/components/schemas/order_edit' + '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}/changes/{change_id}': + delete: + operationId: DeleteOrderEditsOrderEditItemChange + summary: Delete an Order Edit Item Change + description: Deletes an Order Edit Item Change + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order Edit to delete. + schema: + type: string + - in: path + name: change_id + required: true + description: The ID of the Order Edit Item Change 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.orderEdits.deleteItemChange(order_edit_id, + item_change_id) + .then(({ id, object, deleted }) => { + console.log(id) + }) + - lang: Shell + label: cURL + source: > + curl --location --request DELETE + 'https://medusa-url.com/admin/order-edits/{id}/changes/{change_id}' + \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - OrderEdit + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + id: + type: string + description: The ID of the deleted Order Edit Item Change. + object: + type: string + description: The type of the object that was deleted. + format: item_change + deleted: + type: boolean + description: Whether or not the Order Edit Item Change was deleted. + default: true + '400': + $ref: '#/components/responses/400_error' + '/order-edits/{id}': + delete: + operationId: DeleteOrderEditsOrderEdit + summary: Delete an Order Edit + description: Deletes an Order Edit + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order Edit 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.orderEdits.delete(order_edit_id) + .then(({ id, object, deleted }) => { + console.log(id) + }) + - lang: Shell + label: cURL + source: > + curl --location --request DELETE + 'https://medusa-url.com/admin/order-edits/{id}' \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - OrderEdit + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + id: + type: string + description: The ID of the deleted Order Edit. + object: + type: string + description: The type of the object that was deleted. + format: order_edit + deleted: + type: boolean + description: Whether or not the Order Edit was deleted. + default: true + '400': + $ref: '#/components/responses/400_error' + get: + operationId: GetOrderEditsOrderEdit + summary: Retrieve an OrderEdit + description: Retrieves a OrderEdit. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the OrderEdit. + 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-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.orderEdits.retrieve(orderEditId) + .then(({ order_edit }) => { + console.log(order_edit.id) + }) + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/admin/order-edits/{id}' \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - OrderEdit + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + order_edit: + $ref: '#/components/schemas/order_edit' + '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: PostOrderEditsOrderEdit + summary: Updates an OrderEdit + description: Updates a OrderEdit. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the OrderEdit. + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + internal_note: + description: An optional note to create or update for the order edit. + 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.orderEdits.update(order_edit_id, { + internal_note: "internal reason XY" + }) + .then(({ order_edit }) => { + console.log(order_edit.id) + }) + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/order-edits/{id}' \ + + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "internal_note": "internal reason XY" + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - OrderEdit + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + order_edit: + $ref: '#/components/schemas/order_edit' + '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}/request': + post: + operationId: PostOrderEditsOrderEditRequest + summary: Request order edit confirmation + description: Request customer confirmation of an Order Edit + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order Edit to request confirmation from. + 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.orderEdits.requestConfirmation(order_edit_id) + .then({ order_edit }) => { + console.log(order_edit.id) + }) + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/order-edits/{id}/request' \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - OrderEdit + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + order_edit: + $ref: '#/components/schemas/order_edit' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '500': + $ref: '#/components/responses/500_error' '/payment-collections/{id}': delete: operationId: DeletePaymentCollectionsPaymentCollection @@ -14704,7 +14704,7 @@ paths: - api_token: [] - cookie_auth: [] tags: - - Publishable Api Key + - PublishableApiKey responses: '200': description: OK @@ -14802,7 +14802,7 @@ paths: - api_token: [] - cookie_auth: [] tags: - - Publishable Api Key + - PublishableApiKey responses: '200': description: OK @@ -14951,7 +14951,7 @@ paths: - api_token: [] - cookie_auth: [] tags: - - PublishableApiKeys + - PublishableApiKey responses: '200': description: OK @@ -15099,12 +15099,19 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - '/publishable-api-keys/:id/sales-channels': + '/publishable-api-keys/{id}/sales-channels': get: operationId: GetPublishableApiKeySalesChannels summary: List PublishableApiKey's SalesChannels description: List PublishableApiKey's SalesChannels x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Publishable Api Key. + schema: + type: string x-codeSamples: - lang: JavaScript label: JS Client @@ -15132,7 +15139,7 @@ paths: - api_token: [] - cookie_auth: [] tags: - - PublishableApiKeySalesChannels + - PublishableApiKey responses: '200': description: OK @@ -16724,254 +16731,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-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: - type: object - properties: - order: - $ref: '#/components/schemas/order' - '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-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: - 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 - '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: - type: object - required: - - items - properties: - items: - description: The Line Items that have been received. - type: array - items: - 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 - 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: - type: object - properties: - return: - $ref: '#/components/schemas/return' - '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 @@ -17652,6 +17411,254 @@ 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-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: + type: object + properties: + order: + $ref: '#/components/schemas/order' + '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-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: + 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 + '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: + type: object + required: + - items + properties: + items: + description: The Line Items that have been received. + type: array + items: + 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 + 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: + type: object + properties: + return: + $ref: '#/components/schemas/return' + '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 @@ -18891,6 +18898,147 @@ 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-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: + type: object + properties: + swap: + $ref: '#/components/schemas/swap' + '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-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: + 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 + '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 @@ -20081,147 +20229,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-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: - type: object - properties: - swap: - $ref: '#/components/schemas/swap' - '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-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: - 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 - '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 diff --git a/docs/api/admin/code_samples/JavaScript/publishable-api-keys_:id_sales-channels/getundefined b/docs/api/admin/code_samples/JavaScript/publishable-api-keys_{id}_sales-channels/getundefined similarity index 100% rename from docs/api/admin/code_samples/JavaScript/publishable-api-keys_:id_sales-channels/getundefined rename to docs/api/admin/code_samples/JavaScript/publishable-api-keys_{id}_sales-channels/getundefined diff --git a/docs/api/admin/code_samples/Shell/publishable-api-keys_:id_sales-channels/getundefined b/docs/api/admin/code_samples/Shell/publishable-api-keys_{id}_sales-channels/getundefined similarity index 100% rename from docs/api/admin/code_samples/Shell/publishable-api-keys_:id_sales-channels/getundefined rename to docs/api/admin/code_samples/Shell/publishable-api-keys_{id}_sales-channels/getundefined diff --git a/docs/api/admin/openapi.yaml b/docs/api/admin/openapi.yaml index bbafc38b93..b762f21692 100644 --- a/docs/api/admin/openapi.yaml +++ b/docs/api/admin/openapi.yaml @@ -202,10 +202,6 @@ tags: servers: - url: https://api.medusa-commerce.com/admin paths: - /apps/authorizations: - $ref: paths/apps_authorizations.yaml - /apps: - $ref: paths/apps.yaml /auth: $ref: paths/auth.yaml /currencies: @@ -220,6 +216,12 @@ paths: $ref: paths/batch-jobs.yaml /batch-jobs/{id}: $ref: paths/batch-jobs_{id}.yaml + /collections/{id}/products/batch: + $ref: paths/collections_{id}_products_batch.yaml + /collections: + $ref: paths/collections.yaml + /collections/{id}: + $ref: paths/collections_{id}.yaml /customer-groups/{id}/customers/batch: $ref: paths/customer-groups_{id}_customers_batch.yaml /customer-groups: @@ -228,16 +230,26 @@ paths: $ref: paths/customer-groups_{id}.yaml /customer-groups/{id}/customers: $ref: paths/customer-groups_{id}_customers.yaml - /collections/{id}/products/batch: - $ref: paths/collections_{id}_products_batch.yaml - /collections: - $ref: paths/collections.yaml - /collections/{id}: - $ref: paths/collections_{id}.yaml + /apps/authorizations: + $ref: paths/apps_authorizations.yaml + /apps: + $ref: paths/apps.yaml /customers: $ref: paths/customers.yaml /customers/{id}: $ref: paths/customers_{id}.yaml + /draft-orders: + $ref: paths/draft-orders.yaml + /draft-orders/{id}/line-items: + $ref: paths/draft-orders_{id}_line-items.yaml + /draft-orders/{id}: + $ref: paths/draft-orders_{id}.yaml + /draft-orders/{id}/line-items/{line_id}: + $ref: paths/draft-orders_{id}_line-items_{line_id}.yaml + /draft-orders/{id}/pay: + $ref: paths/draft-orders_{id}_pay.yaml + /admin/draft-orders/{id}: + $ref: paths/admin_draft-orders_{id}.yaml /discounts/{id}/regions/{region_id}: $ref: paths/discounts_{id}_regions_{region_id}.yaml /discounts/{discount_id}/conditions/{condition_id}/batch: @@ -256,18 +268,6 @@ paths: $ref: paths/discounts_{id}_dynamic-codes_{code}.yaml /discounts/code/{code}: $ref: paths/discounts_code_{code}.yaml - /draft-orders: - $ref: paths/draft-orders.yaml - /draft-orders/{id}/line-items: - $ref: paths/draft-orders_{id}_line-items.yaml - /draft-orders/{id}: - $ref: paths/draft-orders_{id}.yaml - /draft-orders/{id}/line-items/{line_id}: - $ref: paths/draft-orders_{id}_line-items_{line_id}.yaml - /draft-orders/{id}/pay: - $ref: paths/draft-orders_{id}_pay.yaml - /admin/draft-orders/{id}: - $ref: paths/admin_draft-orders_{id}.yaml /gift-cards: $ref: paths/gift-cards.yaml /gift-cards/{id}: @@ -288,22 +288,6 @@ paths: $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: - $ref: paths/order-edits_{id}_cancel.yaml - /order-edits/{id}/confirm: - $ref: paths/order-edits_{id}_confirm.yaml - /order-edits: - $ref: paths/order-edits.yaml - /order-edits/{id}/items/{item_id}: - $ref: paths/order-edits_{id}_items_{item_id}.yaml - /order-edits/{id}/changes/{change_id}: - $ref: paths/order-edits_{id}_changes_{change_id}.yaml - /order-edits/{id}: - $ref: paths/order-edits_{id}.yaml - /order-edits/{id}/request: - $ref: paths/order-edits_{id}_request.yaml /orders/{id}/shipping-methods: $ref: paths/orders_{id}_shipping-methods.yaml /orders/{id}/archive: @@ -354,6 +338,22 @@ paths: $ref: paths/orders_{id}_return.yaml /order/{id}/claims/{claim_id}: $ref: paths/order_{id}_claims_{claim_id}.yaml + /order-edits/{id}/items: + $ref: paths/order-edits_{id}_items.yaml + /order-edits/{id}/cancel: + $ref: paths/order-edits_{id}_cancel.yaml + /order-edits/{id}/confirm: + $ref: paths/order-edits_{id}_confirm.yaml + /order-edits: + $ref: paths/order-edits.yaml + /order-edits/{id}/items/{item_id}: + $ref: paths/order-edits_{id}_items_{item_id}.yaml + /order-edits/{id}/changes/{change_id}: + $ref: paths/order-edits_{id}_changes_{change_id}.yaml + /order-edits/{id}: + $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: @@ -404,8 +404,8 @@ paths: $ref: paths/publishable-api-keys.yaml /publishable-api-keys/{id}: $ref: paths/publishable-api-keys_{id}.yaml - /publishable-api-keys/:id/sales-channels: - $ref: paths/publishable-api-keys_:id_sales-channels.yaml + /publishable-api-keys/{id}/sales-channels: + $ref: paths/publishable-api-keys_{id}_sales-channels.yaml /publishable-api-keys/{id}/revoke: $ref: paths/publishable-api-keys_{id}_revoke.yaml /publishable-api-key/{id}: @@ -432,18 +432,18 @@ 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: $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}: @@ -460,6 +460,10 @@ paths: $ref: paths/store_payment-providers.yaml /store/tax-providers: $ref: paths/store_tax-providers.yaml + /swaps/{id}: + $ref: paths/swaps_{id}.yaml + /swaps: + $ref: paths/swaps.yaml /tax-rates/{id}/product-types/batch: $ref: paths/tax-rates_{id}_product-types_batch.yaml /tax-rates/{id}/products/batch: @@ -470,10 +474,6 @@ paths: $ref: paths/tax-rates.yaml /tax-rates/{id}: $ref: paths/tax-rates_{id}.yaml - /swaps/{id}: - $ref: paths/swaps_{id}.yaml - /swaps: - $ref: paths/swaps.yaml /uploads/protected: $ref: paths/uploads_protected.yaml /uploads: diff --git a/docs/api/admin/paths/publishable-api-keys.yaml b/docs/api/admin/paths/publishable-api-keys.yaml index c99c88912c..3b0fec67e5 100644 --- a/docs/api/admin/paths/publishable-api-keys.yaml +++ b/docs/api/admin/paths/publishable-api-keys.yaml @@ -96,7 +96,7 @@ get: - api_token: [] - cookie_auth: [] tags: - - PublishableApiKeys + - PublishableApiKey responses: '200': description: OK diff --git a/docs/api/admin/paths/publishable-api-keys_:id_sales-channels.yaml b/docs/api/admin/paths/publishable-api-keys_{id}_sales-channels.yaml similarity index 75% rename from docs/api/admin/paths/publishable-api-keys_:id_sales-channels.yaml rename to docs/api/admin/paths/publishable-api-keys_{id}_sales-channels.yaml index 669ea97dc5..e3b2336dd7 100644 --- a/docs/api/admin/paths/publishable-api-keys_:id_sales-channels.yaml +++ b/docs/api/admin/paths/publishable-api-keys_{id}_sales-channels.yaml @@ -3,22 +3,29 @@ get: summary: List PublishableApiKey's SalesChannels description: List PublishableApiKey's SalesChannels x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Publishable Api Key. + schema: + type: string x-codeSamples: - lang: JavaScript label: JS Client source: $ref: >- - ../code_samples/JavaScript/publishable-api-keys_:id_sales-channels/getundefined + ../code_samples/JavaScript/publishable-api-keys_{id}_sales-channels/getundefined - lang: Shell label: cURL source: $ref: >- - ../code_samples/Shell/publishable-api-keys_:id_sales-channels/getundefined + ../code_samples/Shell/publishable-api-keys_{id}_sales-channels/getundefined security: - api_token: [] - cookie_auth: [] tags: - - PublishableApiKeySalesChannels + - PublishableApiKey responses: '200': description: OK diff --git a/docs/api/admin/paths/publishable-api-keys_{id}_sales-channels_batch.yaml b/docs/api/admin/paths/publishable-api-keys_{id}_sales-channels_batch.yaml index 15a34f324d..6ee16f2114 100644 --- a/docs/api/admin/paths/publishable-api-keys_{id}_sales-channels_batch.yaml +++ b/docs/api/admin/paths/publishable-api-keys_{id}_sales-channels_batch.yaml @@ -43,7 +43,7 @@ post: - api_token: [] - cookie_auth: [] tags: - - Publishable Api Key + - PublishableApiKey responses: '200': description: OK @@ -112,7 +112,7 @@ delete: - api_token: [] - cookie_auth: [] tags: - - Publishable Api Key + - PublishableApiKey responses: '200': description: OK diff --git a/docs/api/store-spec3.json b/docs/api/store-spec3.json index 3e72e4310e..be32e3a13b 100644 --- a/docs/api/store-spec3.json +++ b/docs/api/store-spec3.json @@ -355,6 +355,1124 @@ 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-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: + type: object + properties: + collection: + $ref: '#/components/schemas/product_collection' + '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-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: + type: object + properties: + collections: + type: array + items: + $ref: '#/components/schemas/product_collection' + 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' + '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/me/addresses: + post: + operationId: PostCustomersCustomerAddresses + summary: Add a Shipping Address + description: Adds a Shipping Address to a Customer's saved addresses. + x-authenticated: true + requestBody: + content: + application/json: + schema: + type: object + required: + - address + properties: + address: + description: The Address to add to the Customer. + allOf: + - $ref: '#/components/schemas/address_fields' + - type: object + required: + - first_name + - last_name + - address_1 + - city + - country_code + - postal_code + 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 + + medusa.customers.addresses.addAddress({ + address: { + first_name: 'Celia', + last_name: 'Schumm', + address_1: '225 Bednar Curve', + city: 'Danielville', + country_code: 'US', + postal_code: '85137', + phone: '981-596-6748 x90188', + company: 'Wyman LLC', + address_2: '', + province: 'Georgia', + metadata: {} + } + }) + + .then(({ customer }) => { + console.log(customer.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/store/customers/me/addresses' \ + + --header 'Cookie: connect.sid={sid}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "address": { + "first_name": "Celia", + "last_name": "Schumm", + "address_1": "225 Bednar Curve", + "city": "Danielville", + "country_code": "US", + "postal_code": "85137" + } + }' + security: + - cookie_auth: [] + tags: + - Customer + responses: + '200': + description: A successful response + content: + application/json: + schema: + type: object + properties: + customer: + $ref: '#/components/schemas/customer' + '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: + post: + operationId: PostCustomers + summary: Create a Customer + description: Creates a Customer account. + requestBody: + content: + application/json: + schema: + type: object + required: + - first_name + - last_name + - email + - password + properties: + first_name: + description: The Customer's first name. + type: string + last_name: + description: The Customer's last name. + type: string + email: + description: The email of the customer. + type: string + format: email + password: + description: The Customer's password. + type: string + format: password + phone: + description: The Customer's phone number. + type: string + 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.customers.create({ + first_name: 'Alec', + last_name: 'Reynolds', + email: 'user@example.com', + password: 'supersecret' + }) + + .then(({ customer }) => { + console.log(customer.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/store/customers' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "first_name": "Alec", + "last_name": "Reynolds", + "email": "user@example.com", + "password": "supersecret" + }' + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + customer: + $ref: '#/components/schemas/customer' + '400': + $ref: '#/components/responses/400_error' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + description: A customer with the same email exists + content: + application/json: + schema: + type: object + properties: + code: + type: string + description: The error code + type: + type: string + description: The type of error + message: + type: string + description: Human-readable message with details about the error + example: + code: invalid_request_error + type: duplicate_error + message: >- + A customer with the given email already has an account. Log in + instead + '500': + $ref: '#/components/responses/500_error' + '/customers/me/addresses/{address_id}': + delete: + operationId: DeleteCustomersCustomerAddressesAddress + summary: Delete an Address + description: Removes an Address from the Customer's saved addresses. + x-authenticated: true + parameters: + - in: path + name: address_id + required: true + description: The id of the Address to remove. + schema: + type: string + 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 + + medusa.customers.addresses.deleteAddress(address_id) + + .then(({ customer }) => { + console.log(customer.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request DELETE + 'https://medusa-url.com/store/customers/me/addresses/{address_id}' \ + + --header 'Cookie: connect.sid={sid}' + security: + - cookie_auth: [] + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + customer: + $ref: '#/components/schemas/customer' + '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: PostCustomersCustomerAddressesAddress + summary: Update a Shipping Address + description: Updates a Customer's saved Shipping Address. + x-authenticated: true + parameters: + - in: path + name: address_id + required: true + description: The id of the Address to update. + schema: + type: string + requestBody: + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/address_fields' + 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 + + medusa.customers.addresses.updateAddress(address_id, { + first_name: 'Gina' + }) + + .then(({ customer }) => { + console.log(customer.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/store/customers/me/addresses/{address_id}' \ + + --header 'Cookie: connect.sid={sid}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "first_name": "Gina" + }' + security: + - cookie_auth: [] + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + customer: + $ref: '#/components/schemas/customer' + '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/me: + get: + operationId: GetCustomersCustomer + summary: Get a Customer + description: >- + Retrieves a Customer - the Customer must be logged in to retrieve their + details. + x-authenticated: true + 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 + + medusa.customers.retrieve() + + .then(({ customer }) => { + console.log(customer.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/customers/me' \ + + --header 'Cookie: connect.sid={sid}' + security: + - cookie_auth: [] + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + customer: + $ref: '#/components/schemas/customer' + '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 Customer + description: Updates a Customer's saved details. + x-authenticated: true + requestBody: + content: + application/json: + schema: + type: object + properties: + first_name: + description: The Customer's first name. + type: string + last_name: + description: The Customer's last name. + type: string + billing_address: + description: The Address to be used for billing purposes. + anyOf: + - $ref: '#/components/schemas/address_fields' + description: The full billing address object + - type: string + description: The ID of an existing billing address + password: + description: The Customer's password. + type: string + phone: + description: The Customer's phone number. + type: string + email: + description: The email of the customer. + type: string + metadata: + description: Metadata about the customer. + type: object + 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 + + medusa.customers.update({ + first_name: 'Laury' + }) + + .then(({ customer }) => { + console.log(customer.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/store/customers/me' \ + + --header 'Cookie: connect.sid={sid}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "first_name": "Laury" + }' + security: + - cookie_auth: [] + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + customer: + $ref: '#/components/schemas/customer' + '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/me/payment-methods: + get: + operationId: GetCustomersCustomerPaymentMethods + summary: Get Payment Methods + description: >- + Retrieves a list of a Customer's saved payment methods. Payment methods + are saved with Payment Providers and it is their responsibility to fetch + saved methods. + x-authenticated: true + 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 + + medusa.customers.paymentMethods.list() + + .then(({ payment_methods }) => { + console.log(payment_methods.length); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/customers/me/payment-methods' \ + + --header 'Cookie: connect.sid={sid}' + security: + - cookie_auth: [] + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + payment_methods: + type: array + items: + properties: + provider_id: + type: string + description: >- + The id of the Payment Provider where the payment + method is saved. + data: + type: object + description: >- + The data needed for the Payment Provider to use the + saved payment method. + '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/me/orders: + get: + operationId: GetCustomersCustomerOrders + summary: List Orders + description: Retrieves a list of a Customer's Orders. + x-authenticated: true + parameters: + - in: query + name: q + description: Query used for searching orders. + 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 + - in: query + name: fulfillment_status + style: form + explode: false + description: Fulfillment status to search for. + schema: + type: array + items: + type: string + - in: query + name: payment_status + style: form + explode: false + description: Payment status to search for. + schema: + type: array + items: + type: string + - 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: email + description: to search for. + schema: + type: string + - in: query + name: region_id + description: to search for. + schema: + type: string + - in: query + name: currency_code + style: form + explode: false + description: The 3 character ISO currency code to set prices based on. + schema: + type: string + externalDocs: + url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes' + description: See a list of codes. + - in: query + name: tax_rate + description: to search for. + schema: + type: string + - 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 + - in: query + name: canceled_at + description: Date comparison for when resulting collections 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: limit + description: How many orders to return. + schema: + type: integer + default: 10 + - in: query + name: offset + description: The offset in the resulting orders. + schema: + type: integer + default: 0 + - in: query + name: fields + description: >- + (Comma separated string) Which fields should be included in the + resulting orders. + schema: + type: string + - in: query + name: expand + description: >- + (Comma separated string) Which relations should be expanded in the + resulting orders. + schema: + type: string + 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 + + medusa.customers.listOrders() + + .then(({ orders, limit, offset, count }) => { + console.log(orders); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/customers/me/orders' \ + + --header 'Cookie: connect.sid={sid}' + security: + - cookie_auth: [] + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + orders: + type: array + items: + $ref: '#/components/schemas/order' + 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' + /customers/password-token: + post: + operationId: PostCustomersCustomerPasswordToken + summary: Request Password Reset + description: >- + Creates a reset password token to be used in a subsequent + /reset-password request. The password token should be sent out of band + e.g. via email and will not be returned. + requestBody: + content: + application/json: + schema: + type: object + required: + - email + properties: + email: + description: The email of the customer. + type: string + format: email + 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.customers.generatePasswordToken({ + email: 'user@example.com' + }) + + .then(() => { + // successful + }) + + .catch(() => { + // failed + }) + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/store/customers/password-token' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "email": "user@example.com" + }' + tags: + - Customer + responses: + '204': + 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' + /customers/password-reset: + post: + operationId: PostCustomersResetPassword + summary: Reset Password + description: >- + Resets a Customer's password using a password token created by a + previous /password-token request. + requestBody: + content: + application/json: + schema: + type: object + required: + - email + - password + - token + properties: + email: + description: The email of the customer. + type: string + format: email + password: + description: The Customer's password. + type: string + format: password + token: + description: The reset password token + type: string + 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.customers.resetPassword({ + email: 'user@example.com', + password: 'supersecret', + token: 'supersecrettoken' + }) + + .then(({ customer }) => { + console.log(customer.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/store/customers/password-reset' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "email": "user@example.com", + "password": "supersecret", + "token": "supersecrettoken" + }' + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + customer: + $ref: '#/components/schemas/customer' + '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' '/carts/{id}/shipping-methods': post: operationId: PostCartsCartShippingMethod @@ -1429,955 +2547,6 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - /customers/me/addresses: - post: - operationId: PostCustomersCustomerAddresses - summary: Add a Shipping Address - description: Adds a Shipping Address to a Customer's saved addresses. - x-authenticated: true - requestBody: - content: - application/json: - schema: - type: object - required: - - address - properties: - address: - description: The Address to add to the Customer. - allOf: - - $ref: '#/components/schemas/address_fields' - - type: object - required: - - first_name - - last_name - - address_1 - - city - - country_code - - postal_code - 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 - - medusa.customers.addresses.addAddress({ - address: { - first_name: 'Celia', - last_name: 'Schumm', - address_1: '225 Bednar Curve', - city: 'Danielville', - country_code: 'US', - postal_code: '85137', - phone: '981-596-6748 x90188', - company: 'Wyman LLC', - address_2: '', - province: 'Georgia', - metadata: {} - } - }) - - .then(({ customer }) => { - console.log(customer.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/store/customers/me/addresses' \ - - --header 'Cookie: connect.sid={sid}' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "address": { - "first_name": "Celia", - "last_name": "Schumm", - "address_1": "225 Bednar Curve", - "city": "Danielville", - "country_code": "US", - "postal_code": "85137" - } - }' - security: - - cookie_auth: [] - tags: - - Customer - responses: - '200': - description: A successful response - content: - application/json: - schema: - type: object - properties: - customer: - $ref: '#/components/schemas/customer' - '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: - post: - operationId: PostCustomers - summary: Create a Customer - description: Creates a Customer account. - requestBody: - content: - application/json: - schema: - type: object - required: - - first_name - - last_name - - email - - password - properties: - first_name: - description: The Customer's first name. - type: string - last_name: - description: The Customer's last name. - type: string - email: - description: The email of the customer. - type: string - format: email - password: - description: The Customer's password. - type: string - format: password - phone: - description: The Customer's phone number. - type: string - 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.customers.create({ - first_name: 'Alec', - last_name: 'Reynolds', - email: 'user@example.com', - password: 'supersecret' - }) - - .then(({ customer }) => { - console.log(customer.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/store/customers' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "first_name": "Alec", - "last_name": "Reynolds", - "email": "user@example.com", - "password": "supersecret" - }' - tags: - - Customer - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - customer: - $ref: '#/components/schemas/customer' - '400': - $ref: '#/components/responses/400_error' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - description: A customer with the same email exists - content: - application/json: - schema: - type: object - properties: - code: - type: string - description: The error code - type: - type: string - description: The type of error - message: - type: string - description: Human-readable message with details about the error - example: - code: invalid_request_error - type: duplicate_error - message: >- - A customer with the given email already has an account. Log in - instead - '500': - $ref: '#/components/responses/500_error' - '/customers/me/addresses/{address_id}': - delete: - operationId: DeleteCustomersCustomerAddressesAddress - summary: Delete an Address - description: Removes an Address from the Customer's saved addresses. - x-authenticated: true - parameters: - - in: path - name: address_id - required: true - description: The id of the Address to remove. - schema: - type: string - 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 - - medusa.customers.addresses.deleteAddress(address_id) - - .then(({ customer }) => { - console.log(customer.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request DELETE - 'https://medusa-url.com/store/customers/me/addresses/{address_id}' \ - - --header 'Cookie: connect.sid={sid}' - security: - - cookie_auth: [] - tags: - - Customer - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - customer: - $ref: '#/components/schemas/customer' - '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: PostCustomersCustomerAddressesAddress - summary: Update a Shipping Address - description: Updates a Customer's saved Shipping Address. - x-authenticated: true - parameters: - - in: path - name: address_id - required: true - description: The id of the Address to update. - schema: - type: string - requestBody: - content: - application/json: - schema: - anyOf: - - $ref: '#/components/schemas/address_fields' - 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 - - medusa.customers.addresses.updateAddress(address_id, { - first_name: 'Gina' - }) - - .then(({ customer }) => { - console.log(customer.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/store/customers/me/addresses/{address_id}' \ - - --header 'Cookie: connect.sid={sid}' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "first_name": "Gina" - }' - security: - - cookie_auth: [] - tags: - - Customer - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - customer: - $ref: '#/components/schemas/customer' - '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/me: - get: - operationId: GetCustomersCustomer - summary: Get a Customer - description: >- - Retrieves a Customer - the Customer must be logged in to retrieve their - details. - x-authenticated: true - 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 - - medusa.customers.retrieve() - - .then(({ customer }) => { - console.log(customer.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request GET - 'https://medusa-url.com/store/customers/me' \ - - --header 'Cookie: connect.sid={sid}' - security: - - cookie_auth: [] - tags: - - Customer - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - customer: - $ref: '#/components/schemas/customer' - '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 Customer - description: Updates a Customer's saved details. - x-authenticated: true - requestBody: - content: - application/json: - schema: - type: object - properties: - first_name: - description: The Customer's first name. - type: string - last_name: - description: The Customer's last name. - type: string - billing_address: - description: The Address to be used for billing purposes. - anyOf: - - $ref: '#/components/schemas/address_fields' - description: The full billing address object - - type: string - description: The ID of an existing billing address - password: - description: The Customer's password. - type: string - phone: - description: The Customer's phone number. - type: string - email: - description: The email of the customer. - type: string - metadata: - description: Metadata about the customer. - type: object - 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 - - medusa.customers.update({ - first_name: 'Laury' - }) - - .then(({ customer }) => { - console.log(customer.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/store/customers/me' \ - - --header 'Cookie: connect.sid={sid}' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "first_name": "Laury" - }' - security: - - cookie_auth: [] - tags: - - Customer - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - customer: - $ref: '#/components/schemas/customer' - '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/me/payment-methods: - get: - operationId: GetCustomersCustomerPaymentMethods - summary: Get Payment Methods - description: >- - Retrieves a list of a Customer's saved payment methods. Payment methods - are saved with Payment Providers and it is their responsibility to fetch - saved methods. - x-authenticated: true - 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 - - medusa.customers.paymentMethods.list() - - .then(({ payment_methods }) => { - console.log(payment_methods.length); - }); - - lang: Shell - label: cURL - source: > - curl --location --request GET - 'https://medusa-url.com/store/customers/me/payment-methods' \ - - --header 'Cookie: connect.sid={sid}' - security: - - cookie_auth: [] - tags: - - Customer - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - payment_methods: - type: array - items: - properties: - provider_id: - type: string - description: >- - The id of the Payment Provider where the payment - method is saved. - data: - type: object - description: >- - The data needed for the Payment Provider to use the - saved payment method. - '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/me/orders: - get: - operationId: GetCustomersCustomerOrders - summary: List Orders - description: Retrieves a list of a Customer's Orders. - x-authenticated: true - parameters: - - in: query - name: q - description: Query used for searching orders. - 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 - - in: query - name: fulfillment_status - style: form - explode: false - description: Fulfillment status to search for. - schema: - type: array - items: - type: string - - in: query - name: payment_status - style: form - explode: false - description: Payment status to search for. - schema: - type: array - items: - type: string - - 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: email - description: to search for. - schema: - type: string - - in: query - name: region_id - description: to search for. - schema: - type: string - - in: query - name: currency_code - style: form - explode: false - description: The 3 character ISO currency code to set prices based on. - schema: - type: string - externalDocs: - url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes' - description: See a list of codes. - - in: query - name: tax_rate - description: to search for. - schema: - type: string - - 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 - - in: query - name: canceled_at - description: Date comparison for when resulting collections 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: limit - description: How many orders to return. - schema: - type: integer - default: 10 - - in: query - name: offset - description: The offset in the resulting orders. - schema: - type: integer - default: 0 - - in: query - name: fields - description: >- - (Comma separated string) Which fields should be included in the - resulting orders. - schema: - type: string - - in: query - name: expand - description: >- - (Comma separated string) Which relations should be expanded in the - resulting orders. - schema: - type: string - 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 - - medusa.customers.listOrders() - - .then(({ orders, limit, offset, count }) => { - console.log(orders); - }); - - lang: Shell - label: cURL - source: > - curl --location --request GET - 'https://medusa-url.com/store/customers/me/orders' \ - - --header 'Cookie: connect.sid={sid}' - security: - - cookie_auth: [] - tags: - - Customer - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - orders: - type: array - items: - $ref: '#/components/schemas/order' - 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' - /customers/password-token: - post: - operationId: PostCustomersCustomerPasswordToken - summary: Request Password Reset - description: >- - Creates a reset password token to be used in a subsequent - /reset-password request. The password token should be sent out of band - e.g. via email and will not be returned. - requestBody: - content: - application/json: - schema: - type: object - required: - - email - properties: - email: - description: The email of the customer. - type: string - format: email - 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.customers.generatePasswordToken({ - email: 'user@example.com' - }) - - .then(() => { - // successful - }) - - .catch(() => { - // failed - }) - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/store/customers/password-token' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "email": "user@example.com" - }' - tags: - - Customer - responses: - '204': - 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' - /customers/password-reset: - post: - operationId: PostCustomersResetPassword - summary: Reset Password - description: >- - Resets a Customer's password using a password token created by a - previous /password-token request. - requestBody: - content: - application/json: - schema: - type: object - required: - - email - - password - - token - properties: - email: - description: The email of the customer. - type: string - format: email - password: - description: The Customer's password. - type: string - format: password - token: - description: The reset password token - type: string - 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.customers.resetPassword({ - email: 'user@example.com', - password: 'supersecret', - token: 'supersecrettoken' - }) - - .then(({ customer }) => { - console.log(customer.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/store/customers/password-reset' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "email": "user@example.com", - "password": "supersecret", - "token": "supersecrettoken" - }' - tags: - - Customer - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - customer: - $ref: '#/components/schemas/customer' - '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}/complete': post: operationId: PostOrderEditsOrderEditComplete @@ -2868,175 +3037,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-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: - type: object - properties: - collection: - $ref: '#/components/schemas/product_collection' - '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-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: - type: object - properties: - collections: - type: array - items: - $ref: '#/components/schemas/product_collection' - 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' - '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 @@ -4190,107 +4190,6 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - '/return-reasons/{id}': - get: - operationId: GetReturnReasonsReason - summary: Get a Return Reason - description: Retrieves a Return Reason. - parameters: - - in: path - name: id - required: true - description: The id of the Return Reason. - schema: - type: string - 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.returnReasons.retrieve(reason_id) - - .then(({ return_reason }) => { - console.log(return_reason.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request GET - 'https://medusa-url.com/store/return-reasons/{id}' - tags: - - Return Reason - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - return_reason: - $ref: '#/components/schemas/return_reason' - '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' - /return-reasons: - get: - operationId: GetReturnReasons - summary: List Return Reasons - description: Retrieves a list of Return Reasons. - 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.returnReasons.list() - - .then(({ return_reasons }) => { - console.log(return_reasons.length); - }); - - lang: Shell - label: cURL - source: > - curl --location --request GET - 'https://medusa-url.com/store/return-reasons' - tags: - - Return Reason - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - return_reasons: - type: array - items: - $ref: '#/components/schemas/return_reason' - '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' /returns: post: operationId: PostReturns @@ -4403,6 +4302,107 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' + '/return-reasons/{id}': + get: + operationId: GetReturnReasonsReason + summary: Get a Return Reason + description: Retrieves a Return Reason. + parameters: + - in: path + name: id + required: true + description: The id of the Return Reason. + schema: + type: string + 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.returnReasons.retrieve(reason_id) + + .then(({ return_reason }) => { + console.log(return_reason.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/return-reasons/{id}' + tags: + - Return Reason + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + return_reason: + $ref: '#/components/schemas/return_reason' + '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' + /return-reasons: + get: + operationId: GetReturnReasons + summary: List Return Reasons + description: Retrieves a list of Return Reasons. + 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.returnReasons.list() + + .then(({ return_reasons }) => { + console.log(return_reasons.length); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/return-reasons' + tags: + - Return Reason + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + return_reasons: + type: array + items: + $ref: '#/components/schemas/return_reason' + '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' /shipping-options: get: operationId: GetShippingOptions diff --git a/docs/api/store-spec3.yaml b/docs/api/store-spec3.yaml index 44c93cf522..5f35d6cf56 100644 --- a/docs/api/store-spec3.yaml +++ b/docs/api/store-spec3.yaml @@ -145,6 +145,385 @@ tags: servers: - url: 'https://api.medusa-commerce.com/store' paths: + /auth: + post: + operationId: PostAuth + summary: Customer Login + description: >- + Logs a Customer in and authorizes them to view their details. Successful + authentication will set a session cookie in the Customer's browser. + parameters: [] + 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.auth.authenticate({ + email: 'user@example.com', + password: 'user@example.com' + }) + + .then(({ customer }) => { + console.log(customer.id); + }); + - lang: Shell + label: cURL + source: | + curl --location --request POST 'https://medusa-url.com/store/auth' \ + --header 'Content-Type: application/json' \ + --data-raw '{ + "email": "user@example.com", + "password": "supersecret" + }' + tags: + - Auth + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + customer: + $ref: '#/components/schemas/customer' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/incorrect_credentials' + '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' + requestBody: + content: + application/json: + schema: + type: object + required: + - email + - password + properties: + email: + type: string + description: The Customer's email. + password: + type: string + description: The Customer's password. + delete: + operationId: DeleteAuth + summary: Customer Log out + description: Destroys a Customer's authenticated session. + x-authenticated: true + x-codeSamples: + - lang: Shell + label: cURL + source: > + curl --location --request DELETE 'https://medusa-url.com/store/auth' + \ + + --header 'Cookie: connect.sid={sid}' + security: + - cookie_auth: [] + tags: + - Auth + 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: GetAuth + summary: Get Current Customer + description: Gets the currently logged in Customer. + x-authenticated: true + 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 + + medusa.auth.getSession() + + .then(({ customer }) => { + console.log(customer.id); + }); + - lang: Shell + label: cURL + source: | + curl --location --request GET 'https://medusa-url.com/store/auth' \ + --header 'Cookie: connect.sid={sid}' + security: + - cookie_auth: [] + tags: + - Auth + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + customer: + $ref: '#/components/schemas/customer' + '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' + '/auth/{email}': + get: + operationId: GetAuthEmail + summary: Check if email exists + description: Checks if a Customer with the given email has signed up. + parameters: + - in: path + name: email + schema: + type: string + format: email + required: true + description: The email to check if exists. + 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.auth.exists('user@example.com') + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/auth/user@example.com' \ + + --header 'Cookie: connect.sid={sid}' + tags: + - Auth + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + exists: + type: boolean + description: Whether email exists or not. + '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/{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-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: + type: object + properties: + collection: + $ref: '#/components/schemas/product_collection' + '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-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: + type: object + properties: + collections: + type: array + items: + $ref: '#/components/schemas/product_collection' + 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' + '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 @@ -1219,175 +1598,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-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: - type: object - properties: - collection: - $ref: '#/components/schemas/product_collection' - '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-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: - type: object - properties: - collections: - type: array - items: - $ref: '#/components/schemas/product_collection' - 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' - '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/me/addresses: post: operationId: PostCustomersCustomerAddresses @@ -2337,496 +2547,6 @@ paths: $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-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: - type: object - properties: - order_edit: - $ref: '#/components/schemas/order_edit' - '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: - type: object - properties: - declined_reason: - type: string - description: The reason for declining the OrderEdit. - 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: - type: object - properties: - order_edit: - $ref: '#/components/schemas/order_edit' - '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-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: - type: object - properties: - order_edit: - $ref: '#/components/schemas/order_edit' - '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 a claim to orders - description: >- - Verifies the claim order token provided to the customer upon request of - order ownership - requestBody: - content: - application/json: - schema: - required: - - token - properties: - token: - description: The invite token provided by the admin. - 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.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: - - 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' - '/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-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: - type: object - properties: - order: - $ref: '#/components/schemas/order' - '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 - 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: - type: object - properties: - order: - $ref: '#/components/schemas/order' - '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: 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-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: - type: object - properties: - order: - $ref: '#/components/schemas/order' - '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 orders for signed in account - description: >- - Sends an email to emails registered to orders provided with link to - transfer order ownership - requestBody: - content: - application/json: - schema: - required: - - order_ids - properties: - order_ids: - description: The ids of the orders to claim - type: array - items: - 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.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 @@ -3299,14 +3019,23 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - /auth: + /orders/customer/confirm: post: - operationId: PostAuth - summary: Customer Login + operationId: PostOrdersCustomerOrderClaimsCustomerOrderClaimAccept + summary: Verify a claim to orders description: >- - Logs a Customer in and authorizes them to view their details. Successful - authentication will set a session cookie in the Customer's browser. - parameters: [] + Verifies the claim order token provided to the customer upon request of + order ownership + requestBody: + content: + application/json: + schema: + required: + - token + properties: + token: + description: The invite token provided by the admin. + type: string x-codeSamples: - lang: JavaScript label: JS Client @@ -3316,39 +3045,42 @@ paths: const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) - medusa.auth.authenticate({ - email: 'user@example.com', - password: 'user@example.com' + // must be previously logged in or use api token + + medusa.orders.confirmRequest( + token, + ) + + .then(() => { + // successful }) - .then(({ customer }) => { - console.log(customer.id); + .catch(() => { + // an error occurred }); - lang: Shell label: cURL - source: | - curl --location --request POST 'https://medusa-url.com/store/auth' \ + source: > + curl --location --request POST + 'https://medusa-url.com/store/orders/customer/confirm' \ + --header 'Content-Type: application/json' \ + --data-raw '{ - "email": "user@example.com", - "password": "supersecret" + "token": "{token}", }' + security: + - api_token: [] + - cookie_auth: [] tags: - - Auth + - Invite responses: '200': description: OK - content: - application/json: - schema: - type: object - properties: - customer: - $ref: '#/components/schemas/customer' '400': $ref: '#/components/responses/400_error' '401': - $ref: '#/components/responses/incorrect_credentials' + $ref: '#/components/responses/unauthorized' '404': $ref: '#/components/responses/not_found_error' '409': @@ -3357,58 +3089,333 @@ paths: $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-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: + type: object + properties: + order: + $ref: '#/components/schemas/order' + '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 + 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: + type: object + properties: + order: + $ref: '#/components/schemas/order' + '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: 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-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: + type: object + properties: + order: + $ref: '#/components/schemas/order' + '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 orders for signed in account + description: >- + Sends an email to emails registered to orders provided with link to + transfer order ownership + requestBody: + content: + application/json: + schema: + required: + - order_ids + properties: + order_ids: + description: The ids of the orders to claim + type: array + items: + 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.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' + '/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-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: + type: object + properties: + order_edit: + $ref: '#/components/schemas/order_edit' + '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: type: object - required: - - email - - password properties: - email: + declined_reason: type: string - description: The Customer's email. - password: - type: string - description: The Customer's password. - delete: - operationId: DeleteAuth - summary: Customer Log out - description: Destroys a Customer's authenticated session. - x-authenticated: true - x-codeSamples: - - lang: Shell - label: cURL - source: > - curl --location --request DELETE 'https://medusa-url.com/store/auth' - \ - - --header 'Cookie: connect.sid={sid}' - security: - - cookie_auth: [] - tags: - - Auth - 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: GetAuth - summary: Get Current Customer - description: Gets the currently logged in Customer. - x-authenticated: true + description: The reason for declining the OrderEdit. x-codeSamples: - lang: JavaScript label: JS Client @@ -3418,22 +3425,17 @@ paths: const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) - // must be previously logged - - medusa.auth.getSession() - - .then(({ customer }) => { - console.log(customer.id); - }); + medusa.orderEdits.decline(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/auth' \ - --header 'Cookie: connect.sid={sid}' - security: - - cookie_auth: [] + source: > + curl --location --request POST + 'https://medusa-url.com/store/order-edits/{id}/decline' tags: - - Auth + - OrderEdit responses: '200': description: OK @@ -3442,33 +3444,28 @@ paths: schema: type: object properties: - customer: - $ref: '#/components/schemas/customer' + order_edit: + $ref: '#/components/schemas/order_edit' '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' - '/auth/{email}': + '/order-edits/{id}': get: - operationId: GetAuthEmail - summary: Check if email exists - description: Checks if a Customer with the given email has signed up. + operationId: GetOrderEditsOrderEdit + summary: Retrieve an OrderEdit + description: Retrieves a OrderEdit. parameters: - in: path - name: email + name: id + required: true + description: The ID of the OrderEdit. schema: type: string - format: email - required: true - description: The email to check if exists. x-codeSamples: - lang: JavaScript label: JS Client @@ -3478,16 +3475,18 @@ paths: const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) - medusa.auth.exists('user@example.com') + 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/auth/user@example.com' \ - - --header 'Cookie: connect.sid={sid}' + 'https://medusa-url.com/store/order-edits/{id}' tags: - - Auth + - OrderEdit responses: '200': description: OK @@ -3496,11 +3495,12 @@ paths: schema: type: object properties: - exists: - type: boolean - description: Whether email exists or not. + order_edit: + $ref: '#/components/schemas/order_edit' '400': $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' '404': $ref: '#/components/responses/not_found_error' '409': diff --git a/docs/api/store/openapi.yaml b/docs/api/store/openapi.yaml index e379327bc3..791c72fb6a 100644 --- a/docs/api/store/openapi.yaml +++ b/docs/api/store/openapi.yaml @@ -145,6 +145,14 @@ tags: servers: - url: https://api.medusa-commerce.com/store paths: + /auth: + $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: @@ -169,10 +177,6 @@ paths: $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: @@ -189,22 +193,6 @@ paths: $ref: paths/customers_password-token.yaml /customers/password-reset: $ref: paths/customers_password-reset.yaml - /order-edits/{id}/complete: - $ref: paths/order-edits_{id}_complete.yaml - /order-edits/{id}/decline: - $ref: paths/order-edits_{id}_decline.yaml - /order-edits/{id}: - $ref: paths/order-edits_{id}.yaml - /orders/customer/confirm: - $ref: paths/orders_customer_confirm.yaml - /orders/cart/{cart_id}: - $ref: paths/orders_cart_{cart_id}.yaml - /orders/{id}: - $ref: paths/orders_{id}.yaml - /orders: - $ref: paths/orders.yaml - /orders/batch/customer/token: - $ref: paths/orders_batch_customer_token.yaml /payment-collections/{id}/sessions/batch/authorize: $ref: paths/payment-collections_{id}_sessions_batch_authorize.yaml /payment-collections/{id}/sessions/{session_id}/authorize: @@ -217,10 +205,22 @@ paths: $ref: paths/payment-collections_{id}_sessions.yaml /payment-collections/{id}/sessions/{session_id}: $ref: paths/payment-collections_{id}_sessions_{session_id}.yaml - /auth: - $ref: paths/auth.yaml - /auth/{email}: - $ref: paths/auth_{email}.yaml + /orders/customer/confirm: + $ref: paths/orders_customer_confirm.yaml + /orders/cart/{cart_id}: + $ref: paths/orders_cart_{cart_id}.yaml + /orders/{id}: + $ref: paths/orders_{id}.yaml + /orders: + $ref: paths/orders.yaml + /orders/batch/customer/token: + $ref: paths/orders_batch_customer_token.yaml + /order-edits/{id}/complete: + $ref: paths/order-edits_{id}_complete.yaml + /order-edits/{id}/decline: + $ref: paths/order-edits_{id}_decline.yaml + /order-edits/{id}: + $ref: paths/order-edits_{id}.yaml /product-types: $ref: paths/product-types.yaml /products/{id}: