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:
@@ -121,7 +121,7 @@ You can list inventory items by sending a request to the [List Inventory Items A
|
||||
|
||||
```bash
|
||||
curl -L -X GET '<BACKEND_URL>/admin/inventory-items' \
|
||||
-H 'Authorization: Bearer <API_TOKEN>'
|
||||
-H 'x-medusa-access-token: <API_TOKEN>'
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
@@ -206,7 +206,7 @@ You can create an inventory item by sending a request to the [Create Inventory I
|
||||
|
||||
```bash
|
||||
curl -L -X POST '<BACKEND_URL>/admin/inventory-items' \
|
||||
-H 'Authorization: Bearer <API_TOKEN>' \
|
||||
-H 'x-medusa-access-token: <API_TOKEN>' \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"variant_id": "variant_123"
|
||||
@@ -285,7 +285,7 @@ You can retrieve an inventory item by sending a request to the [Get Inventory It
|
||||
|
||||
```bash
|
||||
curl -L -X GET '<BACKEND_URL>/admin/inventory-items/<ITEM_ID>' \
|
||||
-H 'Authorization: Bearer <API_TOKEN>'
|
||||
-H 'x-medusa-access-token: <API_TOKEN>'
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
@@ -372,7 +372,7 @@ You can update an inventory item by sending a request to the [Update Inventory I
|
||||
|
||||
```bash
|
||||
curl -L -X POST '<BACKEND_URL>/admin/inventory-items/<ITEM_ID>' \
|
||||
-H 'Authorization: Bearer <API_TOKEN>' \
|
||||
-H 'x-medusa-access-token: <API_TOKEN>' \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"origin_country": "US"
|
||||
@@ -461,7 +461,7 @@ You can list inventory levels of an inventory item by sending a request to the [
|
||||
|
||||
```bash
|
||||
curl -L -X GET '<BACKEND_URL>/admin/inventory-items/<ITEM_ID>/location-levels' \
|
||||
-H 'Authorization: Bearer <API_TOKEN>'
|
||||
-H 'x-medusa-access-token: <API_TOKEN>'
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
@@ -555,7 +555,7 @@ You can create a location level by sending a request to the [Create Inventory Le
|
||||
|
||||
```bash
|
||||
curl -L -X POST '<BACKEND_URL>/admin/inventory-items/<ITEM_ID>/location-levels' \
|
||||
-H 'Authorization: Bearer <API_TOKEN>' \
|
||||
-H 'x-medusa-access-token: <API_TOKEN>' \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"location_id": "<LOCATION_ID>",
|
||||
@@ -658,7 +658,7 @@ You can update a location level by sending a request to the [Update Location Lev
|
||||
|
||||
```bash
|
||||
curl -L -X POST '<BACKEND_URL>/admin/inventory-items/<ITEM_ID>/location-levels/<LOCATION_ID>' \
|
||||
-H 'Authorization: Bearer <API_TOKEN>' \
|
||||
-H 'x-medusa-access-token: <API_TOKEN>' \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"stocked_quantity": 10
|
||||
@@ -740,7 +740,7 @@ You can delete a location level of an inventory item by sending a request to the
|
||||
|
||||
```bash
|
||||
curl -L -X DELETE '<BACKEND_URL>/admin/inventory-items/<ITEM_ID>/location-levels/<LOC_ID>' \
|
||||
-H 'Authorization: Bearer <API_TOKEN>'
|
||||
-H 'x-medusa-access-token: <API_TOKEN>'
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
@@ -813,7 +813,7 @@ You can delete an inventory item by sending a request to the [Delete Inventory I
|
||||
|
||||
```bash
|
||||
curl -L -X DELETE '<BACKEND_URL>/admin/inventory-items/<ITEM_ID>' \
|
||||
-H 'Authorization: Bearer <API_TOKEN>'
|
||||
-H 'x-medusa-access-token: <API_TOKEN>'
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
|
||||
+7
-7
@@ -146,7 +146,7 @@ You can create an item allocation by sending a request to the [Create a Reservat
|
||||
|
||||
```bash
|
||||
curl -L -X POST '<BACKEND_URL>/admin/reservations' \
|
||||
-H 'Authorization: Bearer <API_TOKEN>' \
|
||||
-H 'x-medusa-access-token: <API_TOKEN>' \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"line_item_id": "<LINE_ITEM_ID>",
|
||||
@@ -237,7 +237,7 @@ You can retrieve the item allocations of a line item in an order using the [List
|
||||
|
||||
```bash
|
||||
curl -L -X GET '<BACKEND_URL>/admin/reservations?line_item_id=<LINE_ITEM_ID>' \
|
||||
-H 'Authorization: Bearer <API_TOKEN>'
|
||||
-H 'x-medusa-access-token: <API_TOKEN>'
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
@@ -307,7 +307,7 @@ You can retrieve a single item allocation by its ID using the [Get a Reservation
|
||||
|
||||
```bash
|
||||
curl -L -X GET '<BACKEND_URL>/admin/reservations/<RESERVATION_ID>' \
|
||||
-H 'Authorization: Bearer <API_TOKEN>'
|
||||
-H 'x-medusa-access-token: <API_TOKEN>'
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
@@ -390,7 +390,7 @@ You can update an item allocation to change the location to allocate from or the
|
||||
|
||||
```bash
|
||||
curl -L -X POST '<BACKEND_URL>/admin/reservations/<RESERVATION_ID>' \
|
||||
-H 'Authorization: Bearer <API_TOKEN>' \
|
||||
-H 'x-medusa-access-token: <API_TOKEN>' \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"quantity": 3
|
||||
@@ -475,7 +475,7 @@ You can delete an item allocation by sending a request to the [Delete Reservatio
|
||||
|
||||
```bash
|
||||
curl -L -X DELETE '<BACKEND_URL>/admin/reservations/<RESERVATION_ID>' \
|
||||
-H 'Authorization: Bearer <API_TOKEN>'
|
||||
-H 'x-medusa-access-token: <API_TOKEN>'
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
@@ -575,7 +575,7 @@ When you create a fulfillment of an order, you can specify the location to fulfi
|
||||
|
||||
```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": [
|
||||
@@ -689,7 +689,7 @@ When requesting a return, you can specify the location to return the item to by
|
||||
|
||||
```bash
|
||||
curl -L -X POST '<BACKEND_URL>/admin/orders/<ORDER_ID>/return' \
|
||||
-H 'Authorization: Bearer <API_TOKEN>' \
|
||||
-H 'x-medusa-access-token: <API_TOKEN>' \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"items": [
|
||||
|
||||
@@ -128,7 +128,7 @@ You can list all reservations in your store by sending a request to the [List Re
|
||||
|
||||
```bash
|
||||
curl -L -X GET '<BACKEND_URL>/admin/reservations' \
|
||||
-H 'Authorization: Bearer <API_TOKEN>'
|
||||
-H 'x-medusa-access-token: <API_TOKEN>'
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
@@ -223,7 +223,7 @@ You can create a reservation by sending a request to the [Create Reservation API
|
||||
|
||||
```bash
|
||||
curl -L -X POST '<BACKEND_URL>/admin/reservations' \
|
||||
-H 'Authorization: Bearer <API_TOKEN>' \
|
||||
-H 'x-medusa-access-token: <API_TOKEN>' \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"location_id": "<LOC_ID>",
|
||||
@@ -316,7 +316,7 @@ You can update a reservation by sending a request to the [Update Reservation API
|
||||
|
||||
```bash
|
||||
curl -L -X POST '<BACKEND_URL>/admin/reservations/<RESERVATION_ID>' \
|
||||
-H 'Authorization: Bearer <API_TOKEN>' \
|
||||
-H 'x-medusa-access-token: <API_TOKEN>' \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"quantity": 3
|
||||
@@ -401,7 +401,7 @@ You can delete a reservation by sending a request to the [Delete Reservation API
|
||||
|
||||
```bash
|
||||
curl -L -X DELETE '<BACKEND_URL>/admin/reservations/<RESERVATION_ID>' \
|
||||
-H 'Authorization: Bearer <API_TOKEN>'
|
||||
-H 'x-medusa-access-token: <API_TOKEN>'
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
|
||||
@@ -123,7 +123,7 @@ You can list stock locations by using the [List Stock Locations API Route](https
|
||||
|
||||
```bash
|
||||
curl -L -X GET '<BACKEND_URL>/admin/stock-locations' \
|
||||
-H 'Authorization: Bearer <API_TOKEN>'
|
||||
-H 'x-medusa-access-token: <API_TOKEN>'
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
@@ -202,7 +202,7 @@ You can create a stock location using the [Create a Stock Location API Route](ht
|
||||
|
||||
```bash
|
||||
curl -L -X POST '<BACKEND_URL>/admin/stock-locations' \
|
||||
-H 'Authorization: Bearer <API_TOKEN>' \
|
||||
-H 'x-medusa-access-token: <API_TOKEN>' \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"name": "Main Warehouse"
|
||||
@@ -281,7 +281,7 @@ You can retrieve a stock location by sending a request to the [Get Stock Locatio
|
||||
|
||||
```bash
|
||||
curl -L -X GET '<BACKEND_URL>/admin/stock-locations/<LOC_ID>' \
|
||||
-H 'Authorization: Bearer <API_TOKEN>'
|
||||
-H 'x-medusa-access-token: <API_TOKEN>'
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
@@ -369,7 +369,7 @@ You can associate a stock location with a sales channel by sending a request to
|
||||
|
||||
```bash
|
||||
curl -L -X POST '<BACKEND_URL>/admin/sales-channels/<CHANNEL_ID>/stock-locations' \
|
||||
-H 'Authorization: Bearer <API_TOKEN>' \
|
||||
-H 'x-medusa-access-token: <API_TOKEN>' \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"location_id": "<LOC_ID>"
|
||||
@@ -467,7 +467,7 @@ You can remove the association between a stock location and a sales channel by s
|
||||
|
||||
```bash
|
||||
curl -L -X DELETE '<BACKEND_URL>/admin/sales-channels/<CHANNEL_ID>/stock-locations' \
|
||||
-H 'Authorization: Bearer <API_TOKEN>' \
|
||||
-H 'x-medusa-access-token: <API_TOKEN>' \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"location_id": "<LOC_ID>"
|
||||
@@ -568,7 +568,7 @@ You can update a stock location by sending a request to the [Update Stock Locati
|
||||
|
||||
```bash
|
||||
curl -L -X POST '<BACKEND_URL>/admin/stock-locations/<LOC_ID>' \
|
||||
-H 'Authorization: Bearer <API_TOKEN>' \
|
||||
-H 'x-medusa-access-token: <API_TOKEN>' \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"name": "Main Warehouse"
|
||||
@@ -647,7 +647,7 @@ You can delete a stock location by sending a request to the [Delete Stock Locati
|
||||
|
||||
```bash
|
||||
curl -L -X DELETE '<BACKEND_URL>/admin/stock-locations/<LOC_ID>' \
|
||||
-H 'Authorization: Bearer <API_TOKEN>'
|
||||
-H 'x-medusa-access-token: <API_TOKEN>'
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
|
||||
Reference in New Issue
Block a user