customer - JS SDK Admin Reference
This documentation provides a reference to the sdk.admin.customer
set of methods used to send requests to Medusa's Admin API routes.
create#
This method creates a customer. It sends a request to the Create Customer API route.
Example#
Parameters#
The customer's details.
Configure the fields to retrieve in the customer.
Headers to pass in the request.
Returns#
Promise
Promise<AdminCustomerResponse>The customer's details.
Promise
Promise<AdminCustomerResponse>update#
This method updates a customer's details. It sends a request to the Update Customer API route.
Example#
Parameters#
id
stringThe details to update of the customer.
Configure the fields to retrieve in the customer.
Headers to pass in the request.
Returns#
Promise
Promise<AdminCustomerResponse>The customer's details.
Promise
Promise<AdminCustomerResponse>list#
This method retrieves a paginated list of customers. It sends a request to the List Customers API route.
Example#
To retrieve the list of customers:
To configure the pagination, pass the limit
and offset
query parameters.
For example, to retrieve only 10 items and skip 10 items:
Using the fields
query parameter, you can specify the fields and relations to retrieve
in each customer:
Learn more about the fields
property in the API reference.
Parameters#
Filters and pagination configurations.
Headers to pass in the request.
Returns#
Promise
Promise<AdminCustomerListResponse>The paginated list of customers.
Promise
Promise<AdminCustomerListResponse>retrieve#
This method retrieves a customer by its ID. It sends a request to the Get Customer API route.
Example#
To retrieve a customer by its ID:
To specify the fields and relations to retrieve:
Learn more about the fields
property in the API reference.
Parameters#
id
stringConfigure the fields to retrieve in the customer.
Headers to pass in the request.
Returns#
Promise
Promise<AdminCustomerResponse>The customer's details.
Promise
Promise<AdminCustomerResponse>delete#
This method deletes a customer by its ID. It sends a request to the Delete Customer API route.
Example#
Parameters#
id
stringHeaders to pass in the request.
Returns#
Promise
Promise<AdminCustomerDeleteResponse>The deletion's details.
Promise
Promise<AdminCustomerDeleteResponse>batchCustomerGroups#
This method manages customer groups for a customer. It sends a request to the Manage Customers API route.
Example#
Parameters#
id
stringbody
AdminBatchLinkThe groups to add customer to or remove customer from.
body
AdminBatchLinkHeaders to pass in the request
Returns#
Promise
Promise<AdminCustomerResponse>The customers details.
Promise
Promise<AdminCustomerResponse>createAddress#
This method creates a customer address. It sends a request to the Create Customer Address API route.
Example#
Parameters#
id
stringThe customer address's details.
Headers to pass in the request.
Returns#
Promise
Promise<AdminCustomerResponse>The customer address's details.
Promise
Promise<AdminCustomerResponse>updateAddress#
This method updates a customer address. It sends a request to the Update Customer Address API route.
Example#
Parameters#
id
stringaddressId
stringThe customer address's details.
Headers to pass in the request.
Returns#
Promise
Promise<AdminCustomerResponse>The customer address's details.
Promise
Promise<AdminCustomerResponse>deleteAddress#
This method deletes a customer address. It sends a request to the Delete Customer Address API route.
Example#
Parameters#
id
stringaddressId
stringHeaders to pass in the request.
Returns#
Promise
Promise<AdminCustomerResponse>The customer address's details.
Promise
Promise<AdminCustomerResponse>retrieveAddress#
This method retrieves a customer address by its ID. It sends a request to the Get Customer Address API route.
Example#
Parameters#
id
stringaddressId
stringHeaders to pass in the request.
Returns#
Promise
Promise<AdminCustomerResponse>The customer address's details.
Promise
Promise<AdminCustomerResponse>listAddresses#
This method retrieves a list of customer addresses. It sends a request to the List Customer Addresses API route.
Example#
Parameters#
id
stringHeaders to pass in the request.
Returns#
Promise
Promise<AdminCustomerResponse>The list of customer addresses.
Promise
Promise<AdminCustomerResponse>