docs: update endpoints to use file-routing approach (#5397)

- Move the original guides for creating endpoints and middlewares to sub-sections in the Endpoints category.
- Replace existing guides for endpoints and middlewares with the new approach.
- Update all endpoints-related snippets across docs to use this new approach.
This commit is contained in:
Shahed Nasser
2023-10-19 15:56:26 +00:00
committed by GitHub
parent b38f73726d
commit c28935b4e8
170 changed files with 3658 additions and 3344 deletions
@@ -48,7 +48,7 @@ You can learn more about [authenticating as an admin user in the API reference](
## Create Customer Groups
You can create a customer group by sending a request to the Create Customer Group endpoint:
You can create a customer group by sending a request to the Create Customer Group API Route:
<Tabs groupId="request-type" isCodeTabs={true}>
<TabItem value="client" label="Medusa JS Client" default>
@@ -131,7 +131,7 @@ This request requires the `name` parameter and optionally accepts the `metadata`
## List Customer Groups
You can get a list of all customer groups by sending a request to the List Customer Groups endpoint:
You can get a list of all customer groups by sending a request to the List Customer Groups API Route:
<Tabs groupId="request-type" isCodeTabs={true}>
<TabItem value="client" label="Medusa JS Client" default>
@@ -212,7 +212,7 @@ You can also pass filters and other selection query parameters to the request. C
## Retrieve a Customer Group
You can retrieve a single customer group by sending a request to the Get a Customer Group endpoint:
You can retrieve a single customer group by sending a request to the Get a Customer Group API Route:
<Tabs groupId="request-type" isCodeTabs={true}>
<TabItem value="client" label="Medusa JS Client" default>
@@ -279,7 +279,7 @@ This request accepts the ID of the customer group to retrieve as a path paramete
## Update a Customer Group
You can update a customer groups data by sending a request to the Update Customer Group endpoint:
You can update a customer groups data by sending a request to the Update Customer Group API Route:
<Tabs groupId="request-type" isCodeTabs={true}>
<TabItem value="client" label="Medusa JS Client" default>
@@ -373,7 +373,7 @@ This request accepts the ID of the customer group as a path parameter, and optio
## Delete Customer Group
You can delete a customer group by sending a request to the Delete a Customer Group endpoint:
You can delete a customer group by sending a request to the Delete a Customer Group API Route:
<Tabs groupId="request-type" isCodeTabs={true}>
<TabItem value="client" label="Medusa JS Client" default>
@@ -443,7 +443,7 @@ This request accepts the ID of the customer group to delete as a path parameter.
### Add Customer to Group
You can add a customer to a group by sending a request to the Customer Groups Add Customer endpoint:
You can add a customer to a group by sending a request to the Customer Groups Add Customer API Route:
<Tabs groupId="request-type" isCodeTabs={true}>
<TabItem value="client" label="Medusa JS Client" default>
@@ -543,7 +543,7 @@ This request accepts the ID of the customer group as a path parameter. In its bo
### List Customers
You can retrieve a list of all customers in a customer group using the List Customers endpoint:
You can retrieve a list of all customers in a customer group using the List Customers API Route:
<Tabs groupId="request-type" isCodeTabs={true}>
<TabItem value="client" label="Medusa JS Client" default>
@@ -626,7 +626,7 @@ Removing customers from a group does not remove them entirely. Theyll still b
:::
You can remove customers from a customer group by sending a request to the Remove Customers endpoint:
You can remove customers from a customer group by sending a request to the Remove Customers API Route:
<Tabs groupId="request-type" isCodeTabs={true}>
<TabItem value="client" label="Medusa JS Client" default>
@@ -52,7 +52,7 @@ You can learn more about [authenticating as an admin user in the API reference](
## List Customers
You can show a list of customers by sending a request to the [List Customers](https://docs.medusajs.com/api/admin#customers_getcustomers) endpoint:
You can show a list of customers by sending a request to the [List Customers API Route](https://docs.medusajs.com/api/admin#customers_getcustomers):
<Tabs groupId="request-type" isCodeTabs={true}>
<TabItem value="client" label="Medusa JS Client" default>
@@ -139,7 +139,7 @@ You can learn more about pagination in the [API reference](https://docs.medusajs
Admins can create customer accounts. They have to supply the customers credentials and basic info.
You can create a customer account by sending a request to the [Create a Customer](https://docs.medusajs.com/api/admin#customers_postcustomers) endpoint:
You can create a customer account by sending a request to the [Create a Customer API Route](https://docs.medusajs.com/api/admin#customers_postcustomers):
<Tabs groupId="request-type" isCodeTabs={true}>
<TabItem value="client" label="Medusa JS Client" default>
@@ -246,7 +246,7 @@ The request returns the created customer object in the response.
An admin can edit a customers basic information and credentials.
You can edit a customers information by sending a request to the [Update a Customer](https://docs.medusajs.com/api/admin#customers_postcustomerscustomer) endpoint:
You can edit a customers information by sending a request to the [Update a Customer API Route](https://docs.medusajs.com/api/admin#customers_postcustomerscustomer):
<Tabs groupId="request-type" isCodeTabs={true}>
<TabItem value="client" label="Medusa JS Client" default>
@@ -12,7 +12,7 @@ In this document, youll learn how to implement customer account functionaliti
## Overview
Medusa provides the necessary functionalities and endpoints to allow integrating essential customer features. Customers can create accounts to manage their information and keep track of their orders.
Medusa provides the necessary functionalities and API Routes to allow integrating essential customer features. Customers can create accounts to manage their information and keep track of their orders.
### Scenario
@@ -58,7 +58,7 @@ If you follow the Medusa React code blocks, it's assumed you already have [Medus
A customer can register with an email and a password to store and manage their data.
You can register a new customer by sending a request to the [Create a Customer](https://docs.medusajs.com/api/store#customers_postcustomers) endpoint:
You can register a new customer by sending a request to the [Create a Customer API Route](https://docs.medusajs.com/api/store#customers_postcustomers):
<Tabs groupId="request-type" isCodeTabs={true}>
<TabItem value="client" label="Medusa JS Client" default>
@@ -135,7 +135,7 @@ fetch(`<BACKEND_URL>/store/customers`, {
This request requires the following body parameters:
- `email`: An email used to log in after registration. This email must be unique. You can check if an email is unique using the “[Check if email exists](https://docs.medusajs.com/api/store#auth_getauthemail)” endpoint.
- `email`: An email used to log in after registration. This email must be unique. You can check if an email is unique using the “[Check if email exists](https://docs.medusajs.com/api/store#auth_getauthemail)” API Route.
- `password`: A password used to log in after registration.
- `first_name`: The customers first name.
- `last_name`: The customers last name.
@@ -150,7 +150,7 @@ It returns the created customer object in the response.
A customer can log in to your store to manage their data and make purchases using their account.
You can log in a customer into your store by sending a request to the [Customer Login](https://docs.medusajs.com/api/store#auth_postauth) endpoint:
You can log in a customer into your store by sending a request to the [Customer Login API Route](https://docs.medusajs.com/api/store#auth_postauth):
<Tabs groupId="request-type" isCodeTabs={true}>
<TabItem value="client" label="Medusa JS Client" default>
@@ -199,7 +199,7 @@ However, if youre using the Fetch API, you must include the option `credentia
## Log out a Customer
You can log out a customer by sending a request to the [Customer Logout](https://docs.medusajs.com/api/store#auth_deleteauth) endpoint:
You can log out a customer by sending a request to the [Customer Logout API Route](https://docs.medusajs.com/api/store#auth_deleteauth):
<Tabs groupId="request-type" isCodeTabs={true}>
<TabItem value="client" label="Medusa JS Client" default>
@@ -239,7 +239,7 @@ Customers might need to reset their password in case they forget it. To reset a
The customer must first enter their accounts email. Then, if an account with that email address exists, an email will be sent to that email address with a link that points the customer to step 2.
You can request to reset a customers password by sending a request to the [Request Password Reset](https://docs.medusajs.com/api/store#customers_postcustomerscustomerpasswordtoken) endpoint:
You can request to reset a customers password by sending a request to the [Request Password Reset API Route](https://docs.medusajs.com/api/store#customers_postcustomerscustomerpasswordtoken):
<Tabs groupId="request-type" isCodeTabs={true}>
<TabItem value="client" label="Medusa JS Client" default>
@@ -295,7 +295,7 @@ If the customer doesnt receive an email after this request, make sure that yo
After the first step, the customer should receive an email with a link to a page in the storefront. This page should accept a `token` query parameter. Then, the customer should be prompted to enter their email and password.
You can then reset the customers password to the new password they enter by sending a request to the [Reset Password](https://docs.medusajs.com/api/store#customers_postcustomersresetpassword) endpoint:
You can then reset the customers password to the new password they enter by sending a request to the [Reset Password API Route](https://docs.medusajs.com/api/store#customers_postcustomersresetpassword):
<Tabs groupId="request-type" isCodeTabs={true}>
<TabItem value="client" label="Medusa JS Client" default>
@@ -350,7 +350,7 @@ If successful, this request returns the customer object in the response.
A logged-in customer can edit their info, such as their first name or email address.
You can edit a customers info using the [Update Customer](https://docs.medusajs.com/api/store#customers_postcustomerscustomer) endpoint:
You can edit a customers info using the [Update Customer API Route](https://docs.medusajs.com/api/store#customers_postcustomerscustomer):
<Tabs groupId="request-type" isCodeTabs={true}>
<TabItem value="client" label="Medusa JS Client" default>
@@ -435,7 +435,7 @@ The customer object returned in the requests mentioned in this document include
### Add a Shipping Address
You can add a shipping address to a customers account by sending a request to the [Add a Shipping Address](https://docs.medusajs.com/api/store#customers_postcustomerscustomeraddresses) endpoint:
You can add a shipping address to a customers account by sending a request to the [Add a Shipping Address API Route](https://docs.medusajs.com/api/store#customers_postcustomerscustomeraddresses):
<Tabs groupId="request-type" isCodeTabs={true}>
<TabItem value="client" label="Medusa JS Client" default>
@@ -511,7 +511,7 @@ This request returns the updated customer object in the response.
### Edit a Shipping Address
You can edit a customers shipping address using the [Update a Shipping Address](https://docs.medusajs.com/api/store#customers_postcustomerscustomeraddressesaddress) endpoint:
You can edit a customers shipping address using the [Update a Shipping Address API Route](https://docs.medusajs.com/api/store#customers_postcustomerscustomeraddressesaddress):
<Tabs groupId="request-type" isCodeTabs={true}>
<TabItem value="client" label="Medusa JS Client" default>
@@ -556,7 +556,7 @@ This request returns the updated customer object in the response.
### Delete a Shipping Address
You can delete a shipping address by sending a request to the [Delete an Address](https://docs.medusajs.com/api/store#customers_deletecustomerscustomeraddressesaddress) endpoint:
You can delete a shipping address by sending a request to the [Delete an Address API Route](https://docs.medusajs.com/api/store#customers_deletecustomerscustomeraddressesaddress):
<Tabs groupId="request-type" isCodeTabs={true}>
<TabItem value="client" label="Medusa JS Client" default>
@@ -595,7 +595,7 @@ This request requires the addresss ID as a path parameter. It returns in the
Logged-in customers can see their orders along with the orders details.
You can retrieve a customers orders by sending a request to the [List Orders](https://docs.medusajs.com/api/store#customers_getcustomerscustomerorders) endpoint:
You can retrieve a customers orders by sending a request to the [List Orders API Route](https://docs.medusajs.com/api/store#customers_getcustomerscustomerorders):
<Tabs groupId="request-type" isCodeTabs={true}>
<TabItem value="client" label="Medusa JS Client" default>