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 08:41:38 +00:00
committed by GitHub
parent e2cb72efd8
commit 44470bf8c5
32 changed files with 217 additions and 217 deletions
@@ -170,7 +170,7 @@ You can create a discount by sending a request to the [Create Discount API Route
```bash
curl -L -X POST '<BACKEND_URL>/admin/discounts' \
-H 'Authorization: Bearer <API_TOKEN>' \
-H 'x-medusa-access-token: <API_TOKEN>' \
-H 'Content-Type: application/json' \
--data-raw '{
"code": "<CODE>",
@@ -272,7 +272,7 @@ For example, you can update the discounts description and status by sending t
```bash
curl -L -X POST '<BACKEND_URL>/admin/discounts/<DISCOUNT_ID>' \
-H 'Authorization: Bearer <API_TOKEN>' \
-H 'x-medusa-access-token: <API_TOKEN>' \
-H 'Content-Type: application/json' \
--data-raw '{
"is_disabled": true
@@ -384,7 +384,7 @@ You can send a request to the [Create Condition API Route](https://docs.medusajs
```bash
curl -L -X POST '<BACKEND_URL>/admin/discounts/<DISCOUNT_ID>/conditions' \
-H 'Authorization: Bearer <API_TOKEN>' \
-H 'x-medusa-access-token: <API_TOKEN>' \
-H 'Content-Type: application/json' \
--data-raw '{
"operator": "in",
@@ -498,7 +498,7 @@ You can retrieve a condition and its resources by sending a request to the [Get
```bash
curl -L -X GET '<BACKEND_URL>/admin/discounts/<DISCOUNT_ID>/conditions/<CONDITION_ID>&expand=products' \
-H 'Authorization: Bearer <API_TOKEN>'
-H 'x-medusa-access-token: <API_TOKEN>'
```
</TabItem>
@@ -606,7 +606,7 @@ For example, to update the products in a condition:
```bash
curl -L -X POST '<BACKEND_URL>/admin/discounts/<DISCOUNT_ID>/conditions/<CONDITION_ID>' \
-H 'Authorization: Bearer <API_TOKEN>' \
-H 'x-medusa-access-token: <API_TOKEN>' \
-H 'Content-Type: application/json' \
--data-raw '{
"products": [
@@ -698,7 +698,7 @@ You can delete a condition by sending a request to the [Delete Condition API Rou
```bash
curl -L -X DELETE '<BACKEND_URL>/admin/discounts/<DISCOUNT_ID>/conditions/<CONDITION_ID>' \
-H 'Authorization: Bearer <API_TOKEN>'
-H 'x-medusa-access-token: <API_TOKEN>'
```
</TabItem>
@@ -763,7 +763,7 @@ You can delete a discount by sending a request to the [Delete Discount API Route
```bash
curl -L -X DELETE '<BACKEND_URL>/admin/discounts/<DISCOUNT_ID>' \
-H 'Authorization: Bearer <API_TOKEN>'
-H 'x-medusa-access-token: <API_TOKEN>'
```
</TabItem>