AdminSwapsResource
This class is used to send requests to Admin Swap API Routes. All its method
are available in the JS Client under the medusa.admin.swaps
property.
All methods in this class require authentication.
A swap is created by a customer or an admin to exchange an item with a new one. Creating a swap implicitely includes creating a return for the item being exchanged.
Related Guide: How to manage swaps
Methods
retrieve
Retrieve a swap's details.
Example
Parameters
id
stringRequiredThe swap's ID.
customHeaders
Record<string, any>RequiredCustom headers to attach to the request.
Default: {}
Returns
ResponsePromise
ResponsePromise<AdminSwapsRes>RequiredResolves to the swap's details.
ResponsePromise
ResponsePromise<AdminSwapsRes>Requiredlist
Retrieve a list of swaps. The swaps can be paginated.
Example
To list swaps:
By default, only the first 50
records are retrieved. You can control pagination by specifying the limit
and offset
properties:
Parameters
customHeaders
Record<string, any>RequiredCustom headers to attach to the request.
Default: {}
query
AdminGetSwapsParamsPagination configurations to apply on the retrieved swaps.
query
AdminGetSwapsParamsReturns
ResponsePromise
ResponsePromise<AdminSwapsListRes>RequiredResolves to the list of swaps with pagination fields.
ResponsePromise
ResponsePromise<AdminSwapsListRes>RequiredWas this section helpful?