Anchor to gateConfigurationCreategate
gateConfigurationCreate
mutationDeprecated
Requires access scope. Also: You must have write access to
gates
to create gate configurations.
Create a new gate configuration. Gates API is being sunset and will be removed in a future version. Use metafields
instead for gate configuration.
Anchor to Arguments
Arguments
- Anchor to inputinput•Gate
Configuration requiredCreate Input! Specifies the input fields for a gate configuation.
Was this section helpful?
Anchor to GateConfigurationCreatePayload returnsGateConfigurationCreatePayload returns
- Anchor to gateConfigurationgate•
Configuration The created gate configuration.
- Anchor to userErrorsuser•
Errors [GateConfiguration non-nullUser Error!]! The list of errors that occurred from executing the mutation.
Was this section helpful?
- Create a gate configuration and return it
- Create a gate configuration with metafields and return it
- gateConfigurationCreate reference
Examples
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation gateConfigurationCreate($input: GateConfigurationCreateInput!) {
gateConfigurationCreate(input: $input) {
userErrors {
field
message
}
gateConfiguration {
id
name
handle
createdAt
updatedAt
}
}
}`,
{
variables: {
"input": {
"name": "My first gate",
"handle": "gate_from_app"
}
},
},
);
const data = await response.json();
mutation gateConfigurationCreate($input: GateConfigurationCreateInput!) {
gateConfigurationCreate(input: $input) {
userErrors {
field
message
}
gateConfiguration {
id
name
handle
createdAt
updatedAt
}
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/unstable/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "mutation gateConfigurationCreate($input: GateConfigurationCreateInput!) { gateConfigurationCreate(input: $input) { userErrors { field message } gateConfiguration { id name handle createdAt updatedAt } } }",
"variables": {
"input": {
"name": "My first gate",
"handle": "gate_from_app"
}
}
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation gateConfigurationCreate($input: GateConfigurationCreateInput!) {
gateConfigurationCreate(input: $input) {
userErrors {
field
message
}
gateConfiguration {
id
name
handle
createdAt
updatedAt
}
}
}`,
{
variables: {
"input": {
"name": "My first gate",
"handle": "gate_from_app"
}
},
},
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"query": `mutation gateConfigurationCreate($input: GateConfigurationCreateInput!) {
gateConfigurationCreate(input: $input) {
userErrors {
field
message
}
gateConfiguration {
id
name
handle
createdAt
updatedAt
}
}
}`,
"variables": {
"input": {
"name": "My first gate",
"handle": "gate_from_app"
}
},
},
});
session = ShopifyAPI::Auth::Session.new(
shop: "your-development-store.myshopify.com",
access_token: access_token
)
client = ShopifyAPI::Clients::Graphql::Admin.new(
session: session
)
query = <<~QUERY
mutation gateConfigurationCreate($input: GateConfigurationCreateInput!) {
gateConfigurationCreate(input: $input) {
userErrors {
field
message
}
gateConfiguration {
id
name
handle
createdAt
updatedAt
}
}
}
QUERY
variables = {
"input": {
"name": "My first gate",
"handle": "gate_from_app"
}
}
response = client.query(query: query, variables: variables)
Input variables
JSON{
"input": {
"name": "My first gate",
"handle": "gate_from_app"
}
}
Response
JSON{
"gateConfigurationCreate": {
"userErrors": [],
"gateConfiguration": {
"id": "gid://shopify/GateConfiguration/589189058",
"name": "My first gate",
"handle": "gate_from_app",
"createdAt": "2024-09-12T01:10:12Z",
"updatedAt": "2024-09-12T01:10:12Z"
}
}
}