docs: added publishable API keys documentation pages (#2972)
* docs: added publishable api keys docs * Update docs/content/advanced/admin/manage-publishable-api-keys.mdx Co-authored-by: Frane Polić <16856471+fPolic@users.noreply.github.com> * Update publishable-api-keys.mdx * Update docs/content/advanced/storefront/use-sales-channels.mdx Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com> * added note in admin how-to guide * added note in conceptual guide * Update docs/content/advanced/backend/publishable-api-keys/index.md Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com> * small fixes Co-authored-by: Frane Polić <16856471+fPolic@users.noreply.github.com> Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
@@ -26,7 +26,7 @@ import PublishableApiKeyService from "../../../../services/publishable-api-key"
|
||||
* import Medusa from "@medusajs/medusa-js"
|
||||
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
* // must be previously logged in or use api token
|
||||
* medusa.admin.publishableApiKeys.addSalesChannels(publishableApiKeyId, {
|
||||
* medusa.admin.publishableApiKeys.addSalesChannelsBatch(publishableApiKeyId, {
|
||||
* sales_channel_ids: [
|
||||
* {
|
||||
* id: channel_id
|
||||
@@ -39,7 +39,7 @@ import PublishableApiKeyService from "../../../../services/publishable-api-key"
|
||||
* - lang: Shell
|
||||
* label: cURL
|
||||
* source: |
|
||||
* curl --location --request POST 'https://medusa-url.com/admin/publishable-api-keys/afasf/batch' \
|
||||
* curl --location --request POST 'https://medusa-url.com/admin/publishable-api-keys/{pak_id}/batch' \
|
||||
* --header 'Authorization: Bearer {api_token}' \
|
||||
* --header 'Content-Type: application/json' \
|
||||
* --data-raw '{
|
||||
|
||||
@@ -22,16 +22,21 @@ import PublishableApiKeyService from "../../../../services/publishable-api-key"
|
||||
* import Medusa from "@medusajs/medusa-js"
|
||||
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
* // must be previously logged in or use api token
|
||||
* medusa.admin.publishableApiKey.create()
|
||||
* .then(({ publishable_api_key }) => {
|
||||
* console.log(publishable_api_key.id)
|
||||
* })
|
||||
* medusa.admin.publishableApiKeys.create({
|
||||
* title
|
||||
* })
|
||||
* .then(({ publishable_api_key }) => {
|
||||
* console.log(publishable_api_key.id)
|
||||
* })
|
||||
* - lang: Shell
|
||||
* label: cURL
|
||||
* source: |
|
||||
* curl --location --request POST 'https://medusa-url.com/admin/publishable-api-keys' \
|
||||
* --header 'Authorization: Bearer {api_token}'
|
||||
* -d '{ "created_by": "user_123" }'
|
||||
* --header 'Authorization: Bearer {api_token}' \
|
||||
* --header 'Content-Type: application/json' \
|
||||
* --data-raw '{
|
||||
* "title": "Web API Key"
|
||||
* }'
|
||||
* security:
|
||||
* - api_token: []
|
||||
* - cookie_auth: []
|
||||
|
||||
@@ -26,7 +26,7 @@ import PublishableApiKeyService from "../../../../services/publishable-api-key"
|
||||
* import Medusa from "@medusajs/medusa-js"
|
||||
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
* // must be previously logged in or use api token
|
||||
* medusa.admin.publishableApiKeys.removeSalesChannels(publishableApiKeyId, {
|
||||
* medusa.admin.publishableApiKeys.deleteSalesChannelsBatch(publishableApiKeyId, {
|
||||
* sales_channel_ids: [
|
||||
* {
|
||||
* id: channel_id
|
||||
@@ -39,7 +39,7 @@ import PublishableApiKeyService from "../../../../services/publishable-api-key"
|
||||
* - lang: Shell
|
||||
* label: cURL
|
||||
* source: |
|
||||
* curl --location --request DELETE 'https://medusa-url.com/admin/publishable-api-keys/afasf/batch' \
|
||||
* curl --location --request DELETE 'https://medusa-url.com/admin/publishable-api-keys/{pka_id}/batch' \
|
||||
* --header 'Authorization: Bearer {api_token}' \
|
||||
* --header 'Content-Type: application/json' \
|
||||
* --data-raw '{
|
||||
|
||||
@@ -17,14 +17,14 @@ import PublishableApiKeyService from "../../../../services/publishable-api-key"
|
||||
* import Medusa from "@medusajs/medusa-js"
|
||||
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
* // must be previously logged in or use api token
|
||||
* medusa.admin.publishableApiKey.delete(key_id)
|
||||
* .then(({ id, object, deleted }) => {
|
||||
* console.log(id)
|
||||
* })
|
||||
* medusa.admin.publishableApiKeys.delete(publishableApiKeyId)
|
||||
* .then(({ id, object, deleted }) => {
|
||||
* console.log(id)
|
||||
* })
|
||||
* - lang: Shell
|
||||
* label: cURL
|
||||
* source: |
|
||||
* curl --location --request DELETE 'https://medusa-url.com/admin/publishable-api-key/{id}' \
|
||||
* curl --location --request DELETE 'https://medusa-url.com/admin/publishable-api-key/{pka_id}' \
|
||||
* --header 'Authorization: Bearer {api_token}'
|
||||
* security:
|
||||
* - api_token: []
|
||||
|
||||
@@ -17,16 +17,15 @@ import PublishableApiKeyService from "../../../../services/publishable-api-key"
|
||||
* import Medusa from "@medusajs/medusa-js"
|
||||
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
* // must be previously logged in or use api token
|
||||
* medusa.admin.publishableApiKey.retrieve(pubKeyId)
|
||||
* .then(({ publishable_api_key }) => {
|
||||
* console.log(publishable_api_key.id)
|
||||
* })
|
||||
* medusa.admin.publishableApiKeys.retrieve(publishableApiKeyId)
|
||||
* .then(({ publishable_api_key }) => {
|
||||
* console.log(publishable_api_key.id)
|
||||
* })
|
||||
* - lang: Shell
|
||||
* label: cURL
|
||||
* source: |
|
||||
* curl --location --request GET 'https://medusa-url.com/admin/publishable-api-keys/pubkey_123' \
|
||||
* curl --location --request GET 'https://medusa-url.com/admin/publishable-api-keys/{pka_id}' \
|
||||
* --header 'Authorization: Bearer {api_token}'
|
||||
* -d '{ "created_by": "user_123" }'
|
||||
* security:
|
||||
* - api_token: []
|
||||
* - cookie_auth: []
|
||||
|
||||
@@ -21,13 +21,13 @@ import { extendedFindParamsMixin } from "../../../../types/common"
|
||||
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
* // must be previously logged in or use api token
|
||||
* medusa.admin.publishableApiKeys.listSalesChannels()
|
||||
* .then(({ sales_channels, limit, offset, count }) => {
|
||||
* console.log(sales_channels)
|
||||
* .then(({ sales_channels }) => {
|
||||
* console.log(sales_channels.length)
|
||||
* })
|
||||
* - lang: Shell
|
||||
* label: cURL
|
||||
* source: |
|
||||
* curl --location --request GET 'https://medusa-url.com/admin/publishable-api-keys/pk_123/sales-channels' \
|
||||
* curl --location --request GET 'https://medusa-url.com/admin/publishable-api-keys/{pka_id}/sales-channels' \
|
||||
* --header 'Authorization: Bearer {api_token}'
|
||||
* security:
|
||||
* - api_token: []
|
||||
|
||||
@@ -24,7 +24,7 @@ import PublishableApiKeyService from "../../../../services/publishable-api-key"
|
||||
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
* // must be previously logged in or use api token
|
||||
* medusa.admin.publishableApiKeys.list()
|
||||
* .then(({ publishable_api_keys }) => {
|
||||
* .then(({ publishable_api_keys, count, limit, offset }) => {
|
||||
* console.log(publishable_api_keys)
|
||||
* })
|
||||
* - lang: Shell
|
||||
|
||||
@@ -18,16 +18,15 @@ import PublishableApiKeyService from "../../../../services/publishable-api-key"
|
||||
* import Medusa from "@medusajs/medusa-js"
|
||||
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
* // must be previously logged in or use api token
|
||||
* medusa.admin.publishableApiKey.revoke()
|
||||
* medusa.admin.publishableApiKeys.revoke(publishableApiKeyId)
|
||||
* .then(({ publishable_api_key }) => {
|
||||
* console.log(publishable_api_key.id)
|
||||
* })
|
||||
* - lang: Shell
|
||||
* label: cURL
|
||||
* source: |
|
||||
* curl --location --request POST 'https://medusa-url.com/admin/publishable-api-keys/pubkey_123/revoke' \
|
||||
* curl --location --request POST 'https://medusa-url.com/admin/publishable-api-keys/{pka_id}/revoke' \
|
||||
* --header 'Authorization: Bearer {api_token}'
|
||||
* -d '{ "created_by": "user_123", "revoked_by": "user_123" }'
|
||||
* security:
|
||||
* - api_token: []
|
||||
* - cookie_auth: []
|
||||
|
||||
@@ -24,20 +24,20 @@ import PublishableApiKeyService from "../../../../services/publishable-api-key"
|
||||
* import Medusa from "@medusajs/medusa-js"
|
||||
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
* // must be previously logged in or use api token
|
||||
* medusa.admin.publishableApiKey.update(publishable_key_id, {
|
||||
* medusa.admin.publishableApiKeys.update(publishableApiKeyId, {
|
||||
* title: "new title"
|
||||
* })
|
||||
* .then(({ publishable_api_key }) => {
|
||||
* console.log(publishable_api_key.id)
|
||||
* })
|
||||
* .then(({ publishable_api_key }) => {
|
||||
* console.log(publishable_api_key.id)
|
||||
* })
|
||||
* - lang: Shell
|
||||
* label: cURL
|
||||
* source: |
|
||||
* curl --location --request POST 'https://medusa-url.com/admin/publishable-api-key/{id}' \
|
||||
* curl --location --request POST 'https://medusa-url.com/admin/publishable-api-key/{pka_id}' \
|
||||
* --header 'Authorization: Bearer {api_token}' \
|
||||
* --header 'Content-Type: application/json' \
|
||||
* --data-raw '{
|
||||
* "title": "updated title"
|
||||
* "title": "new title"
|
||||
* }'
|
||||
* security:
|
||||
* - api_token: []
|
||||
|
||||
Reference in New Issue
Block a user