-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DEVDOCS-5825: [new] Create store-metafields #480
Open
bc-traciporter
wants to merge
8
commits into
main
Choose a base branch
from
DEVDOCS-5825
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
709f5dd
DEVDOCS-5825: [new] Create store-metafields
bc-traciporter a518166
add store metafield rest endpoints
bc-traciporter 2abc263
resolving linter errors
bc-traciporter 6ba9635
fix linter errors
bc-traciporter 09dd131
Merge branch 'main' into DEVDOCS-5825
bc-traciporter b9b8d60
editorial change
bc-traciporter 5f9258b
Add in 10,000 limit
bc-traciporter 3e9bdb6
Merge branch 'main' into DEVDOCS-5825
bc-traciporter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
134 changes: 134 additions & 0 deletions
134
docs/store-operations/catalog/graphql-admin/store-metafields
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
# Store metafields | ||
|
||
Store metafields allow you to attach a metafield to the store itself. They are suitable for any global information against the store that is not channel specific. Channel metafields are appropriate for any storefront-specific data you need to store in metafields. There are two ways to create a store metafield in Admin GraphQL. You can remove the resource ID or use the store’s Global ID. Examples of each type are below: | ||
|
||
## Remove resource ID | ||
|
||
<Tabs items={['Request', 'Response']}> | ||
<Tab> | ||
```graphql filename="Example mutation: Create a store metafield" showLineNumbers copy | ||
POST https://api.bigcommerce.com/stores/{{STORE_HASH}}/graphql | ||
X-Auth-Token: {{ACCESS_TOKEN}} | ||
Content-Type: application/json | ||
Accept: application/json | ||
|
||
mutation Metafield($input: CreateMetafieldInput!) { | ||
metafield { | ||
createMetafield(input: $input) { | ||
metafield { | ||
id | ||
description | ||
key | ||
namespace | ||
permissionSet | ||
resourceId | ||
value | ||
ownerClientId | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
```json filename="GraphQL variables" showLineNumbers copy | ||
{ | ||
"input":{ | ||
"namespace": "Warehouse Locations", | ||
"key": "Location", | ||
"value": "4HG", | ||
"permissionSet": "APP_ONLY" | ||
} | ||
} | ||
``` | ||
</Tab> | ||
<Tab> | ||
|
||
```json filename="Example mutation: Create a store metafield" showLineNumbers copy | ||
{ | ||
"data": { | ||
"metafield": { | ||
"createMetafield": { | ||
"metafield": { | ||
"id": "bc/store/metafield/74", | ||
"description": "", | ||
"key": "'Location", | ||
"namespace": Warehouse Locations", | ||
"permissionSet": "APP_ONLY", | ||
"resourceId": "bc/store/store/1001197568", | ||
"value": "4HG", | ||
"ownerClientId": "k8l7zz0ynkd1bfbxx02p2k7pnk3n8ov" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
</Tab> | ||
</Tabs> | ||
|
||
## Use the Global ID | ||
|
||
<Tabs items={['Request', 'Response']}> | ||
<Tab> | ||
```graphql filename="Example mutation: Create a store metafield" showLineNumbers copy | ||
POST https://api.bigcommerce.com/stores/{{STORE_HASH}}/graphql | ||
X-Auth-Token: {{ACCESS_TOKEN}} | ||
Content-Type: application/json | ||
Accept: application/json | ||
|
||
mutation Metafield($input: CreateMetafieldInput!) { | ||
metafield { | ||
createMetafield(input: $input) { | ||
metafield { | ||
id | ||
description | ||
key | ||
namespace | ||
permissionSet | ||
resourceId | ||
value | ||
ownerClientId | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
```json filename="GraphQL variables" showLineNumbers copy | ||
{ | ||
"input":{ | ||
"namespace": "Warehouse Locations", | ||
"key": "Location", | ||
"value": "4HG", | ||
"permissionSet": "APP_ONLY", | ||
"resourceId": "bc/store/store/1001197568" | ||
} | ||
} | ||
``` | ||
</Tab> | ||
<Tab> | ||
|
||
```json filename="Example mutation: Create a store metafield" showLineNumbers copy | ||
{ | ||
"data": { | ||
"metafield": { | ||
"createMetafield": { | ||
"metafield": { | ||
"id": "bc/store/metafield/71", | ||
"description": "", | ||
"key": "'Location", | ||
"namespace": Warehouse Locations", | ||
"permissionSet": "APP_ONLY", | ||
"resourceId": "bc/store/store/1001197568", | ||
"value": "4HG", | ||
"ownerClientId": "k8l7zz0ynkd1bfbxx02p2k7pnk3n8ov" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
</Tab> | ||
</Tabs> | ||
|
||
<Callout typo="info"> | ||
You can create 10,000 metafields instead of the typical limit of 250 per entity-per-client-id. | ||
</Callout> |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zvuki do you think we should recommend one way of doing this over another?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zvuki what is the preferred way?