Update all curl documentation examples and references with new x-medusa-access-token header (#6326)

## What

This is to update incorrect documentation in regards to authentication to the Admin API - raised in https://github.com/medusajs/medusa/issues/6264.

## Why

Because the current documentation has been incorrect since the September 2023 release of [v1.17.0](https://github.com/medusajs/medusa/releases/tag/v1.17.0), which had breaking changes to API token usage.

## How

Simple search and replace. I was asked to replace occurrences under `www/apps/docs/content/` but there were also additional places where I thought references should also be updated:

- `packages/medusa/src/api/`
- `www/apps/api-reference/`

Feel free to revert them as needed.

There is also some inconsistency between the format shown in examples e.g. `<API_TOKEN>` vs `{api_token}` vs `{access_token}`.

I have kept the format the same in all cases as the original, as surrounding documentation text would not have format updated as well. I suggest maybe reviewing the documentation and keeping to a consistent format e.g. `<API_TOKEN>`.

 
## Testing 

I have not tested these changes. I would assume the `packages/medusa/src/api/` changes may need more thorough testing?
This commit is contained in:
Ira
2024-02-07 21:41:38 +13:00
committed by GitHub
parent e2cb72efd8
commit 44470bf8c5
32 changed files with 217 additions and 217 deletions

View File

@@ -144,7 +144,7 @@ To do that, send a request to the [Create an OrderEdit API Route](https://docs.m
```bash
curl -L -X POST '<BACKEND_URL>/admin/order-edits' \
-H 'Authorization: Bearer <API_TOKEN>' \
-H 'x-medusa-access-token: <API_TOKEN>' \
-H 'Content-Type: application/json' \
--data-raw '{
"order_id": "<ORDER_ID>"
@@ -252,7 +252,7 @@ To add a new item to the original order, send a request to the [Add Line Item AP
```bash
curl -L -X POST '<BACKEND_URL>/admin/order-edits/<ORDER_EDIT_ID>/items' \
-H 'Authorization: Bearer <API_TOKEN>' \
-H 'x-medusa-access-token: <API_TOKEN>' \
-H 'Content-Type: application/json' \
--data-raw '{
"quantity": 1,
@@ -344,7 +344,7 @@ To update an item, send a request to the [Update Line Item API Route](https://do
```bash
curl -L -X POST '<BACKEND_URL>/admin/order-edits/<ORDER_EDIT_ID>/items/<ITEM_ID>' \
-H 'Authorization: Bearer <API_TOKEN>' \
-H 'x-medusa-access-token: <API_TOKEN>' \
-H 'Content-Type: application/json' \
--data-raw '{
"quantity": 2
@@ -429,7 +429,7 @@ You can remove an item from the original order by sending a request to the [Remo
```bash
curl -L -X DELETE '<BACKEND_URL>/admin/order-edits/<ORDER_EDIT_ID>/items/<ITEM_ID>' \
-H 'Authorization: Bearer <API_TOKEN>'
-H 'x-medusa-access-token: <API_TOKEN>'
```
</TabItem>
@@ -510,7 +510,7 @@ To revert an item change, send a request to the [Delete Item Change API Route](h
```bash
curl -L -X DELETE '<BACKEND_URL>/admin/order-edits/<ORDER_EDIT_ID>/changes/<CHANGE_ID>' \
-H 'Authorization: Bearer <API_TOKEN>'
-H 'x-medusa-access-token: <API_TOKEN>'
```
</TabItem>
@@ -601,7 +601,7 @@ To move an Order Edit into the request state, send a request to the [Request Con
```bash
curl -L -X POST '<BACKEND_URL>/admin/order-edits/<ORDER_EDIT_ID>/request' \
-H 'Authorization: Bearer <API_TOKEN>'
-H 'x-medusa-access-token: <API_TOKEN>'
```
</TabItem>
@@ -702,7 +702,7 @@ To confirm an Order Edit, send a request to the [Confirm Order Edit API Route](h
```bash
curl -L -X POST '<BACKEND_URL>/admin/order-edits/<ORDER_EDIT_ID>/confirm' \
-H 'Authorization: Bearer <API_TOKEN>'
-H 'x-medusa-access-token: <API_TOKEN>'
```
</TabItem>
@@ -794,7 +794,7 @@ If the payment is authorized by the customer, it can be captured by sending a re
```bash
curl -L -X POST '<BACKEND_URL>/admin/payments/<PAYMENT_ID>/capture' \
-H 'Authorization: Bearer <API_TOKEN>'
-H 'x-medusa-access-token: <API_TOKEN>'
```
</TabItem>
@@ -891,7 +891,7 @@ To refund the difference to the customer, send a request to the [Refund Payment
```bash
curl -L -X POST '<BACKEND_URL>/admin/payments/<PAYMENT_ID>/refund' \
-H 'Authorization: Bearer <API_TOKEN>' \
-H 'x-medusa-access-token: <API_TOKEN>' \
-H 'Content-Type: application/json' \
--data-raw '{
"amount": 1000,

View File

@@ -123,7 +123,7 @@ To view an orders claims, you can retrieve the order using the [Get Order API
```bash
curl -L -X GET '<BACKEND_URL>/admin/orders/<ORDER_ID>' \
-H 'Authorization: Bearer <API_TOKEN>'
-H 'x-medusa-access-token: <API_TOKEN>'
```
</TabItem>
@@ -224,7 +224,7 @@ You can create a claim by sending a request to the [Create Claim API Route](http
```bash
curl -L -X POST '<BACKEND_URL>/admin/orders/<ORDER_ID>/claims' \
-H 'Authorization: Bearer <API_TOKEN>' \
-H 'x-medusa-access-token: <API_TOKEN>' \
-H 'Content-Type: application/json' \
--data-raw '{
"type": "refund",
@@ -337,7 +337,7 @@ You can update a claim by sending a request to the [Update Claim API Route](http
```bash
curl -L -X POST '<BACKEND_URL>/admin/orders/<ORDER_ID>/claims/<CLAIM_ID>' \
-H 'Authorization: Bearer <API_TOKEN>' \
-H 'x-medusa-access-token: <API_TOKEN>' \
-H 'Content-Type: application/json' \
--data-raw '{
"no_notification": true
@@ -428,7 +428,7 @@ You can create a fulfillment for a claim by sending a request to the [Create Cla
```bash
curl -L -X POST '<BACKEND_URL>/admin/orders/<ORDER_ID>/claims/<CLAIM_ID>/fulfillments' \
-H 'Authorization: Bearer <API_TOKEN>'
-H 'x-medusa-access-token: <API_TOKEN>'
```
</TabItem>
@@ -515,7 +515,7 @@ You can create a shipment for a claim by sending a request to the [Create Claim
```bash
curl -L -X POST '<BACKEND_URL>/admin/orders/<ORDER_ID>/claims/<CLAIM_ID>/shipments' \
-H 'Authorization: Bearer <API_TOKEN>' \
-H 'x-medusa-access-token: <API_TOKEN>' \
-H 'Content-Type: application/json' \
--data-raw '{
"fulfillment_id": "<FUL_ID>"
@@ -614,7 +614,7 @@ You can cancel a fulfillment by sending a request to the [Cancel Fulfillment API
```bash
curl -L -X POST '<BACKEND_URL>/admin/orders/<ORDER_ID>/claims/<CLAIM_ID>/fulfillments/<FUL_ID>/cancel' \
-H 'Authorization: Bearer <API_TOKEN>'
-H 'x-medusa-access-token: <API_TOKEN>'
```
</TabItem>
@@ -694,7 +694,7 @@ You can cancel a claim by sending a request to the [Cancel Claim API Route](http
```bash
curl -L -X POST '<BACKEND_URL>/admin/orders/<ORDER_ID>/claims/<CLAIM_ID>/cancel' \
-H 'Authorization: Bearer <API_TOKEN>'
-H 'x-medusa-access-token: <API_TOKEN>'
```
</TabItem>

View File

@@ -111,7 +111,7 @@ You can list draft orders by sending a request to the [List Draft Orders API Rou
```bash
curl -L -X GET '<BACKEND_URL>/admin/draft-orders' \
-H 'Authorization: Bearer <API_TOKEN>'
-H 'x-medusa-access-token: <API_TOKEN>'
```
</TabItem>
@@ -243,7 +243,7 @@ You can create a draft order by sending a request to the [Create Draft Order API
```bash
curl -L -X POST '<BACKEND_URL>/admin/draft-orders' \
-H 'Authorization: Bearer <API_TOKEN>' \
-H 'x-medusa-access-token: <API_TOKEN>' \
-H 'Content-Type: application/json' \
--data-raw '{
"email": "<EMAIL>",
@@ -350,7 +350,7 @@ You can retrieve a draft order by sending a request to the [Get Draft Order API
```bash
curl -L -X GET '<BACKEND_URL>/admin/draft-orders/<DRAFT_ORDER_ID>' \
-H 'Authorization: Bearer <API_TOKEN>'
-H 'x-medusa-access-token: <API_TOKEN>'
```
</TabItem>
@@ -435,7 +435,7 @@ You can update a draft order by sending a request to the [Update Draft Order API
```bash
curl -L -X POST '<BACKEND_URL>/admin/draft-orders/<DRAFT_ORDER_ID>' \
-H 'Authorization: Bearer <API_TOKEN>' \
-H 'x-medusa-access-token: <API_TOKEN>' \
-H 'Content-Type: application/json' \
--data-raw '{
"email": "user@example.com"
@@ -530,7 +530,7 @@ You can add line items to a draft order by sending a request to the [Create Line
```bash
curl -L -X POST '<BACKEND_URL>/admin/draft-orders/<DRAFT_ORDER_ID>/line-items' \
-H 'Authorization: Bearer <API_TOKEN>' \
-H 'x-medusa-access-token: <API_TOKEN>' \
-H 'Content-Type: application/json' \
--data-raw '{
"quantity": 1
@@ -628,7 +628,7 @@ You can update a line item by sending a request to the [Update Line Item API Rou
```bash
curl -L -X POST '<BACKEND_URL>/admin/draft-orders/<DRAFT_ORDER_ID>/line-items/<ITEM_ID>' \
-H 'Authorization: Bearer <API_TOKEN>' \
-H 'x-medusa-access-token: <API_TOKEN>' \
-H 'Content-Type: application/json' \
--data-raw '{
"quantity": 1
@@ -705,7 +705,7 @@ You can delete a line item by sending a request to the [Delete Line Item API Rou
```bash
curl -L -X DELETE '<BACKEND_URL>/admin/draft-orders/<DRAFT_ORDER_ID>/line-items/<ITEM_ID>' \
-H 'Authorization: Bearer <API_TOKEN>'
-H 'x-medusa-access-token: <API_TOKEN>'
```
</TabItem>
@@ -782,7 +782,7 @@ You can register the draft order payment by sending a request to the [Register D
```bash
curl -L -X POST '<BACKEND_URL>/admin/draft-orders/<DRAFT_ORDER_ID>/pay' \
-H 'Authorization: Bearer <API_TOKEN>'
-H 'x-medusa-access-token: <API_TOKEN>'
```
</TabItem>
@@ -857,7 +857,7 @@ You can delete a draft order by sending a request to the [Delete Draft Order API
```bash
curl -L -X DELETE '<BACKEND_URL>/admin/draft-orders/<DRAFT_ORDER_ID>' \
-H 'Authorization: Bearer <API_TOKEN>'
-H 'x-medusa-access-token: <API_TOKEN>'
```
</TabItem>

View File

@@ -117,7 +117,7 @@ You can list orders by sending a request to the [List Orders API Route](https://
```bash
curl -L -X GET '<BACKEND_URL>/admin/orders' \
-H 'Authorization: Bearer <API_TOKEN>'
-H 'x-medusa-access-token: <API_TOKEN>'
```
</TabItem>
@@ -200,7 +200,7 @@ For example, you can filter the orders by one or more status:
```bash
curl -L -X GET '<BACKEND_URL>/admin/orders?status[]=completed' \
-H 'Authorization: Bearer <API_TOKEN>'
-H 'x-medusa-access-token: <API_TOKEN>'
```
</TabItem>
@@ -287,7 +287,7 @@ Another example is filtering the orders by a sales channel:
```bash
curl -L -X GET '<BACKEND_URL>/admin/orders?sales_channel_id[]=<CHANNEL_ID>' \
-H 'Authorization: Bearer <API_TOKEN>'
-H 'x-medusa-access-token: <API_TOKEN>'
```
</TabItem>
@@ -370,7 +370,7 @@ You can also combine filters together:
```bash
curl -L -X GET '<BACKEND_URL>/admin/orders?status[]=completed&sales_channel_id[]=<CHANNEL_ID>' \
-H 'Authorization: Bearer <API_TOKEN>'
-H 'x-medusa-access-token: <API_TOKEN>'
```
</TabItem>
@@ -438,7 +438,7 @@ You can retrieve an order by sending a request to the [Get an Order API Route](h
```bash
curl -L -X GET '<BACKEND_URL>/admin/orders/<ORDER_ID>' \
-H 'Authorization: Bearer <API_TOKEN>'
-H 'x-medusa-access-token: <API_TOKEN>'
```
</TabItem>
@@ -537,7 +537,7 @@ You can update any of the above details of an order by sending a request to the
```bash
curl -L -X POST '<BACKEND_URL>/admin/orders/<ORDER_ID>' \
-H 'Authorization: Bearer <API_TOKEN>' \
-H 'x-medusa-access-token: <API_TOKEN>' \
-H 'Content-Type: application/json' \
--data-raw '{
"email": "user@example.com"
@@ -620,7 +620,7 @@ You can capture an orders payment by sending a request to the [Capture Order
```bash
curl -L -X POST '<BACKEND_URL>/admin/orders/<ORDER_ID>/capture' \
-H 'Authorization: Bearer <API_TOKEN>'
-H 'x-medusa-access-token: <API_TOKEN>'
```
</TabItem>
@@ -711,7 +711,7 @@ To refund payment, send a request to the [Refund Payment API Route](https://docs
```bash
curl -L -X POST '<BACKEND_URL>/admin/orders/<ORDER_ID>/refund' \
-H 'Authorization: Bearer <API_TOKEN>' \
-H 'x-medusa-access-token: <API_TOKEN>' \
-H 'Content-Type: application/json' \
--data-raw '{
"amount": 1000,
@@ -828,7 +828,7 @@ You can create a fulfillment by sending a request to the [Create a Fulfillment A
```bash
curl -L -X POST '<BACKEND_URL>/admin/orders/<ORDER_ID>/fulfillment' \
-H 'Authorization: Bearer <API_TOKEN>' \
-H 'x-medusa-access-token: <API_TOKEN>' \
-H 'Content-Type: application/json' \
--data-raw '{
"items": [
@@ -931,7 +931,7 @@ You can create a shipment for a fulfillment by sending a request to the [Create
```bash
curl -L -X POST '<BACKEND_URL>/admin/orders/<ORDER_ID>/shipment' \
-H 'Authorization: Bearer <API_TOKEN>' \
-H 'x-medusa-access-token: <API_TOKEN>' \
-H 'Content-Type: application/json' \
--data-raw '{
"fulfillment_id": "<FUL_ID>"
@@ -1014,7 +1014,7 @@ You can cancel a fulfillment by sending a request to the [Cancel Fulfillment API
```bash
curl -L -X POST '<BACKEND_URL>/admin/orders/<ORDER_ID>/fulfillments/<FUL_ID>/cancel' \
-H 'Authorization: Bearer <API_TOKEN>'
-H 'x-medusa-access-token: <API_TOKEN>'
```
</TabItem>
@@ -1089,7 +1089,7 @@ You can mark an order completed, changing its status, by sending a request to th
```bash
curl -L -X POST '<BACKEND_URL>/admin/orders/<ORDER_ID>/complete' \
-H 'Authorization: Bearer <API_TOKEN>'
-H 'x-medusa-access-token: <API_TOKEN>'
```
</TabItem>
@@ -1164,7 +1164,7 @@ You can cancel an order by sending a request to the [Cancel Order API Route](htt
```bash
curl -L -X POST '<BACKEND_URL>/admin/orders/<ORDER_ID>/cancel' \
-H 'Authorization: Bearer <API_TOKEN>'
-H 'x-medusa-access-token: <API_TOKEN>'
```
</TabItem>
@@ -1239,7 +1239,7 @@ You can archive an order by sending a request to the [Archive Order API Route](h
```bash
curl -L -X POST '<BACKEND_URL>/admin/orders/<ORDER_ID>/archive' \
-H 'Authorization: Bearer <API_TOKEN>'
-H 'x-medusa-access-token: <API_TOKEN>'
```
</TabItem>

View File

@@ -118,7 +118,7 @@ You can list available return reasons using the [List Return Reasons API Route](
```bash
curl -L -X GET '<BACKEND_URL>/admin/return-reasons' \
-H 'Authorization: Bearer <API_TOKEN>'
-H 'x-medusa-access-token: <API_TOKEN>'
```
</TabItem>
@@ -201,7 +201,7 @@ You can create a return reason using the [Create Return Reason API Route](https:
```bash
curl -L -X POST '<BACKEND_URL>/admin/return-reasons' \
-H 'Authorization: Bearer <API_TOKEN>' \
-H 'x-medusa-access-token: <API_TOKEN>' \
-H 'Content-Type: application/json' \
--data-raw '{
"label": "Damaged",
@@ -296,7 +296,7 @@ You can update a return reason by sending a request to the [Update Return Reason
```bash
curl -L -X POST '<BACKEND_URL>/admin/return-reasons/<REASON_ID>' \
-H 'Authorization: Bearer <API_TOKEN>' \
-H 'x-medusa-access-token: <API_TOKEN>' \
-H 'Content-Type: application/json' \
--data-raw '{
"label": "Damaged"
@@ -375,7 +375,7 @@ You can delete a return reason by sending a request to the [Delete Return Reason
```bash
curl -L -X DELETE '<BACKEND_URL>/admin/return-reasons/<REASON_ID>' \
-H 'Authorization: Bearer <API_TOKEN>'
-H 'x-medusa-access-token: <API_TOKEN>'
```
</TabItem>
@@ -464,7 +464,7 @@ When you retrieve an order using the [Get Order API Route](https://docs.medusajs
```bash
curl -L -X GET '<BACKEND_URL>/admin/orders/<ORDER_ID>' \
-H 'Authorization: Bearer <API_TOKEN>'
-H 'x-medusa-access-token: <API_TOKEN>'
```
</TabItem>
@@ -578,7 +578,7 @@ You can mark a return as received by sending a request to the [Receive a Return
```bash
curl -L -X POST '<BACKEND_URL>/admin/returns/<RETURN_ID>/receive' \
-H 'Authorization: Bearer <API_TOKEN>' \
-H 'x-medusa-access-token: <API_TOKEN>' \
-H 'Content-Type: application/json' \
--data-raw '{
"items": [
@@ -675,7 +675,7 @@ You can cancel a return by sending a request to the [Cancel Return API Route](ht
```bash
curl -L -X POST '<BACKEND_URL>/admin/returns/<RETURN_ID>/cancel' \
-H 'Authorization: Bearer <API_TOKEN>'
-H 'x-medusa-access-token: <API_TOKEN>'
```
</TabItem>

View File

@@ -129,7 +129,7 @@ You can view an orders swaps by retrieving the order using the [Get Order API
```bash
curl -L -X GET '<BACKEND_URL>/admin/orders/<ORDER_ID>' \
-H 'Authorization: Bearer <API_TOKEN>'
-H 'x-medusa-access-token: <API_TOKEN>'
```
</TabItem>
@@ -212,7 +212,7 @@ Regardless of whether you need to refund or capture the payment, you can process
```bash
curl -L -X POST '<BACKEND_URL>/admin/orders/<ORDER_ID>/swaps/<SWAP_ID>/process-payment' \
-H 'Authorization: Bearer <API_TOKEN>'
-H 'x-medusa-access-token: <API_TOKEN>'
```
</TabItem>
@@ -302,7 +302,7 @@ You can create a fulfillment for a swap by sending a request to the [Create Swap
```bash
curl -L -X POST '<BACKEND_URL>/admin/orders/<ORDER_ID>/swaps/<SWAP_ID>/fulfillments' \
-H 'Authorization: Bearer <API_TOKEN>'
-H 'x-medusa-access-token: <API_TOKEN>'
```
</TabItem>
@@ -396,7 +396,7 @@ You can create a shipment for a swaps fulfillment using the [Create Swap Ship
```bash
curl -L -X POST '<BACKEND_URL>/admin/orders/<ORDER_ID>/swaps/<SWAP_ID>/shipments' \
-H 'Authorization: Bearer <API_TOKEN>'\
-H 'x-medusa-access-token: <API_TOKEN>'\
-H 'Content-Type: application/json' \
--data-raw '{
"fulfillment_id": "<FUL_ID>"
@@ -496,7 +496,7 @@ You can cancel a fulfillment by sending a request to the [Cancel Swap Fulfillmen
```bash
curl -L -X POST '<BACKEND_URL>/admin/orders/<ORDER_ID>/swaps/<SWAP_ID>/fulfillments/<FUL_ID>/cancel' \
-H 'Authorization: Bearer <API_TOKEN>'
-H 'x-medusa-access-token: <API_TOKEN>'
```
</TabItem>
@@ -585,7 +585,7 @@ You can cancel a swap by sending a request to the [Cancel Swap API Route](https:
```bash
curl -L -X POST '<BACKEND_URL>/admin/orders/<ORDER_ID>/swaps/<SWAP_ID>/cancel' \
-H 'Authorization: Bearer <API_TOKEN>'
-H 'x-medusa-access-token: <API_TOKEN>'
```
</TabItem>