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
@@ -110,7 +110,7 @@ You can list the tax rates by sending a request to the [List Tax Rates API Route
```bash
curl -L -X GET '<BACKEND_URL>/admin/tax-rates' \
-H 'Authorization: Bearer <API_TOKEN>'
-H 'x-medusa-access-token: <API_TOKEN>'
```
</TabItem>
@@ -185,7 +185,7 @@ You can retrieve the tax rate of a region by passing the `region_id` query param
```bash
curl -L -X GET '<BACKEND_URL>/admin/tax-rates?region_id=reg_123' \
-H 'Authorization: Bearer <API_TOKEN>'
-H 'x-medusa-access-token: <API_TOKEN>'
```
</TabItem>
@@ -258,7 +258,7 @@ This query parameter also accepts an array of strings, allowing you to filter th
```bash
curl -L -X GET '<BACKEND_URL>/admin/tax-rates?region_id[]=reg_123&region_id[]=reg_456' \
-H 'Authorization: Bearer <API_TOKEN>'
-H 'x-medusa-access-token: <API_TOKEN>'
```
</TabItem>
@@ -350,7 +350,7 @@ You can create a tax rate by sending a request to the [Create Tax Rate API Route
```bash
curl -L -X POST '<BACKEND_URL>/admin/tax-rates' \
-H 'Authorization: Bearer <API_TOKEN>' \
-H 'x-medusa-access-token: <API_TOKEN>' \
-H 'Content-Type: application/json' \
--data-raw '{
"code": "TEST",
@@ -454,7 +454,7 @@ You can update a tax rate by sending a request to the [Update Tax Rate API Route
```bash
curl -L -X POST '<BACKEND_URL>/admin/tax-rates/<TAX_RATE_ID>' \
-H 'Authorization: Bearer <API_TOKEN>' \
-H 'x-medusa-access-token: <API_TOKEN>' \
-H 'Content-Type: application/json' \
--data-raw '{
"name": "New Tax Rate"
@@ -553,7 +553,7 @@ You can add a product to a tax rate by sending a request to the [Add Products AP
```bash
curl -L -X POST '<BACKEND_URL>/admin/tax-rates/<TAX_RATE_ID>/products/batch' \
-H 'Authorization: Bearer <API_TOKEN>' \
-H 'x-medusa-access-token: <API_TOKEN>' \
-H 'Content-Type: application/json' \
--data-raw '{
"products": [
@@ -646,7 +646,7 @@ You can remove a product from a tax rate by sending a request to the [Delete Pro
```bash
curl -L -X DELETE '<BACKEND_URL>/admin/tax-rates/<TAX_RATE_ID>/products/batch' \
-H 'Authorization: Bearer <API_TOKEN>' \
-H 'x-medusa-access-token: <API_TOKEN>' \
-H 'Content-Type: application/json' \
--data-raw '{
"products": [
@@ -751,7 +751,7 @@ You can add a product type to a tax rate by sending a request to the [Add Produc
```bash
curl -L -X POST '<BACKEND_URL>/admin/tax-rates/<TAX_RATE_ID>/product-types/batch' \
-H 'Authorization: Bearer <API_TOKEN>' \
-H 'x-medusa-access-token: <API_TOKEN>' \
-H 'Content-Type: application/json' \
--data-raw '{
"product_types": [
@@ -852,7 +852,7 @@ You can remove a product type from a tax rate by sending a request to the [Delet
```bash
curl -L -X DELETE '<BACKEND_URL>/admin/tax-rates/<TAX_RATE_ID>/product-types/batch' \
-H 'Authorization: Bearer <API_TOKEN>' \
-H 'x-medusa-access-token: <API_TOKEN>' \
-H 'Content-Type: application/json' \
--data-raw '{
"product_types": [
@@ -957,7 +957,7 @@ You can add a shipping option to a tax rate by sending a request to the [Add Shi
```bash
curl -L -X POST '<BACKEND_URL>/admin/tax-rates/<TAX_RATE_ID>/shipping-options/batch' \
-H 'Authorization: Bearer <API_TOKEN>' \
-H 'x-medusa-access-token: <API_TOKEN>' \
-H 'Content-Type: application/json' \
--data-raw '{
"shipping_options": [
@@ -1054,7 +1054,7 @@ You can remove a shipping option from a tax rate by sending a request to the [De
```bash
curl -L -X DELETE '<BACKEND_URL>/admin/tax-rates/<TAX_RATE_ID>/shipping-options/batch' \
-H 'Authorization: Bearer <API_TOKEN>' \
-H 'x-medusa-access-token: <API_TOKEN>' \
-H 'Content-Type: application/json' \
--data-raw '{
"shipping_options": [
@@ -1135,7 +1135,7 @@ You can delete a tax rate by sending a request to the [Delete Tax Rate API Route
```bash
curl -L -X DELETE '<BACKEND_URL>/admin/tax-rates/<TAX_RATE_ID>' \
-H 'Authorization: Bearer <API_TOKEN>'
-H 'x-medusa-access-token: <API_TOKEN>'
```
</TabItem>
@@ -114,7 +114,7 @@ You can list all tax providers of a store using the [List Tax Providers API Rout
```bash
curl -L -X GET '<BACKEND_URL>/admin/store/tax-providers' \
-H 'Authorization: Bearer <API_TOKEN>'
-H 'x-medusa-access-token: <API_TOKEN>'
```
</TabItem>
@@ -193,7 +193,7 @@ You can change the tax provider of a region using the [Update Region API Route](
```bash
curl -L -X POST '<BACKEND_URL>/admin/regions/<REGION_ID>' \
-H 'Authorization: Bearer <API_TOKEN>' \
-H 'x-medusa-access-token: <API_TOKEN>' \
-H 'Content-Type: application/json' \
--data-raw '{
"tax_provider_id": "<TAX_PROVIDER_ID>"
@@ -292,7 +292,7 @@ In addition to changing the tax provider, you can use the same [Update Region AP
```bash
curl -L -X POST '<BACKEND_URL>/admin/regions/<REGION_ID>' \
-H 'Authorization: Bearer <API_TOKEN>' \
-H 'x-medusa-access-token: <API_TOKEN>' \
-H 'Content-Type: application/json' \
--data-raw '{
"tax_provider_id": "<TAX_PROVIDER_ID>",