Version: 2024-10
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation giftCardUpdate($id: ID!, $input: GiftCardUpdateInput!) { giftCardUpdate(id: $id, input: $input) { userErrors { message field } giftCard { id customer { id } } } }\",\n \"variables\": {\n \"id\": \"gid://shopify/GiftCard/63396415\",\n \"input\": {\n \"customerId\": \"gid://shopify/Customer/331283560\"\n }\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation giftCardUpdate($id: ID!, $input: GiftCardUpdateInput!) {\n giftCardUpdate(id: $id, input: $input) {\n userErrors {\n message\n field\n }\n giftCard {\n id\n customer {\n id\n }\n }\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/GiftCard/63396415\",\n \"input\": {\n \"customerId\": \"gid://shopify/Customer/331283560\"\n }\n },\n },\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation giftCardUpdate($id: ID!, $input: GiftCardUpdateInput!) {\n giftCardUpdate(id: $id, input: $input) {\n userErrors {\n message\n field\n }\n giftCard {\n id\n customer {\n id\n }\n }\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/GiftCard/63396415\",\n \"input\": {\n \"customerId\": \"gid://shopify/Customer/331283560\"\n }\n}\n\nresponse = client.query(query: query, variables: variables)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation giftCardUpdate($id: ID!, $input: GiftCardUpdateInput!) {\n giftCardUpdate(id: $id, input: $input) {\n userErrors {\n message\n field\n }\n giftCard {\n id\n customer {\n id\n }\n }\n }\n }\nQUERY;\n\n$variables = [\n \"id\" => \"gid://shopify/GiftCard/63396415\",\n \"input\" => [\n \"customerId\" => \"gid://shopify/Customer/331283560\",\n ],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation giftCardUpdate($id: ID!, $input: GiftCardUpdateInput!) {\n giftCardUpdate(id: $id, input: $input) {\n userErrors {\n message\n field\n }\n giftCard {\n id\n customer {\n id\n }\n }\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/GiftCard/63396415\",\n \"input\": {\n \"customerId\": \"gid://shopify/Customer/331283560\"\n }\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation giftCardUpdate($id: ID!, $input: GiftCardUpdateInput!) {\n giftCardUpdate(id: $id, input: $input) {\n userErrors {\n message\n field\n }\n giftCard {\n id\n customer {\n id\n }\n }\n }\n}"
input: { "id": "gid://shopify/GiftCard/63396415", "input": { "customerId": "gid://shopify/Customer/331283560" } }
response: { "data": { "giftCardUpdate": { "userErrors": [], "giftCard": { "id": "gid://shopify/GiftCard/63396415", "customer": { "id": "gid://shopify/Customer/331283560" } } } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation giftCardUpdate($id: ID!, $input: GiftCardUpdateInput!) { giftCardUpdate(id: $id, input: $input) { giftCard { id recipientAttributes { recipient { id } message preferredName sendNotificationAt } } userErrors { message field } } }\",\n \"variables\": {\n \"id\": \"gid://shopify/GiftCard/63396415\",\n \"input\": {\n \"recipientAttributes\": {\n \"id\": \"gid://shopify/Customer/331283560\",\n \"message\": \"Happy Birthday!\",\n \"preferredName\": \"Dad\",\n \"sendNotificationAt\": \"2024-10-01T12:00:00Z\"\n }\n }\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation giftCardUpdate($id: ID!, $input: GiftCardUpdateInput!) {\n giftCardUpdate(id: $id, input: $input) {\n giftCard {\n id\n recipientAttributes {\n recipient {\n id\n }\n message\n preferredName\n sendNotificationAt\n }\n }\n userErrors {\n message\n field\n }\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/GiftCard/63396415\",\n \"input\": {\n \"recipientAttributes\": {\n \"id\": \"gid://shopify/Customer/331283560\",\n \"message\": \"Happy Birthday!\",\n \"preferredName\": \"Dad\",\n \"sendNotificationAt\": \"2024-10-01T12:00:00Z\"\n }\n }\n },\n },\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation giftCardUpdate($id: ID!, $input: GiftCardUpdateInput!) {\n giftCardUpdate(id: $id, input: $input) {\n giftCard {\n id\n recipientAttributes {\n recipient {\n id\n }\n message\n preferredName\n sendNotificationAt\n }\n }\n userErrors {\n message\n field\n }\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/GiftCard/63396415\",\n \"input\": {\n \"recipientAttributes\": {\n \"id\": \"gid://shopify/Customer/331283560\",\n \"message\": \"Happy Birthday!\",\n \"preferredName\": \"Dad\",\n \"sendNotificationAt\": \"2024-10-01T12:00:00Z\"\n }\n }\n}\n\nresponse = client.query(query: query, variables: variables)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation giftCardUpdate($id: ID!, $input: GiftCardUpdateInput!) {\n giftCardUpdate(id: $id, input: $input) {\n giftCard {\n id\n recipientAttributes {\n recipient {\n id\n }\n message\n preferredName\n sendNotificationAt\n }\n }\n userErrors {\n message\n field\n }\n }\n }\nQUERY;\n\n$variables = [\n \"id\" => \"gid://shopify/GiftCard/63396415\",\n \"input\" => [\n \"recipientAttributes\" => [\n \"id\" => \"gid://shopify/Customer/331283560\",\n \"message\" => \"Happy Birthday!\",\n \"preferredName\" => \"Dad\",\n \"sendNotificationAt\" => \"2024-10-01T12:00:00Z\",\n ],\n ],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation giftCardUpdate($id: ID!, $input: GiftCardUpdateInput!) {\n giftCardUpdate(id: $id, input: $input) {\n giftCard {\n id\n recipientAttributes {\n recipient {\n id\n }\n message\n preferredName\n sendNotificationAt\n }\n }\n userErrors {\n message\n field\n }\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/GiftCard/63396415\",\n \"input\": {\n \"recipientAttributes\": {\n \"id\": \"gid://shopify/Customer/331283560\",\n \"message\": \"Happy Birthday!\",\n \"preferredName\": \"Dad\",\n \"sendNotificationAt\": \"2024-10-01T12:00:00Z\"\n }\n }\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation giftCardUpdate($id: ID!, $input: GiftCardUpdateInput!) {\n giftCardUpdate(id: $id, input: $input) {\n giftCard {\n id\n recipientAttributes {\n recipient {\n id\n }\n message\n preferredName\n sendNotificationAt\n }\n }\n userErrors {\n message\n field\n }\n }\n}"
input: { "id": "gid://shopify/GiftCard/63396415", "input": { "recipientAttributes": { "id": "gid://shopify/Customer/331283560", "message": "Happy Birthday!", "preferredName": "Dad", "sendNotificationAt": "2024-10-01T12:00:00Z" } } }
response: { "data": { "giftCardUpdate": { "giftCard": { "id": "gid://shopify/GiftCard/63396415", "recipientAttributes": { "recipient": { "id": "gid://shopify/Customer/331283560" }, "message": "Happy Birthday!", "preferredName": "Dad", "sendNotificationAt": "2024-10-01T12:00:00Z" } }, "userErrors": [] } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation GiftCardUpdate($id: ID!, $input: GiftCardUpdateInput!) { giftCardUpdate(id: $id, input: $input) { giftCard { id note } userErrors { message field } } }\",\n \"variables\": {\n \"id\": \"gid://shopify/GiftCard/63396415\",\n \"input\": {\n \"note\": \"A note.\"\n }\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation GiftCardUpdate($id: ID!, $input: GiftCardUpdateInput!) {\n giftCardUpdate(id: $id, input: $input) {\n giftCard {\n id\n note\n }\n userErrors {\n message\n field\n }\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/GiftCard/63396415\",\n \"input\": {\n \"note\": \"A note.\"\n }\n },\n },\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation GiftCardUpdate($id: ID!, $input: GiftCardUpdateInput!) {\n giftCardUpdate(id: $id, input: $input) {\n giftCard {\n id\n note\n }\n userErrors {\n message\n field\n }\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/GiftCard/63396415\",\n \"input\": {\n \"note\": \"A note.\"\n }\n}\n\nresponse = client.query(query: query, variables: variables)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation GiftCardUpdate($id: ID!, $input: GiftCardUpdateInput!) {\n giftCardUpdate(id: $id, input: $input) {\n giftCard {\n id\n note\n }\n userErrors {\n message\n field\n }\n }\n }\nQUERY;\n\n$variables = [\n \"id\" => \"gid://shopify/GiftCard/63396415\",\n \"input\" => [\n \"note\" => \"A note.\",\n ],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation GiftCardUpdate($id: ID!, $input: GiftCardUpdateInput!) {\n giftCardUpdate(id: $id, input: $input) {\n giftCard {\n id\n note\n }\n userErrors {\n message\n field\n }\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/GiftCard/63396415\",\n \"input\": {\n \"note\": \"A note.\"\n }\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation GiftCardUpdate($id: ID!, $input: GiftCardUpdateInput!) {\n giftCardUpdate(id: $id, input: $input) {\n giftCard {\n id\n note\n }\n userErrors {\n message\n field\n }\n }\n}"
input: { "id": "gid://shopify/GiftCard/63396415", "input": { "note": "A note." } }
response: { "data": { "giftCardUpdate": { "giftCard": { "id": "gid://shopify/GiftCard/63396415", "note": "A note." }, "userErrors": [] } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation giftCardUpdate($id: ID!, $input: GiftCardUpdateInput!) { giftCardUpdate(id: $id, input: $input) { userErrors { message field } giftCard { id expiresOn } } }\",\n \"variables\": {\n \"id\": \"gid://shopify/GiftCard/746346263\",\n \"input\": {\n \"expiresOn\": null\n }\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation giftCardUpdate($id: ID!, $input: GiftCardUpdateInput!) {\n giftCardUpdate(id: $id, input: $input) {\n userErrors {\n message\n field\n }\n giftCard {\n id\n expiresOn\n }\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/GiftCard/746346263\",\n \"input\": {\n \"expiresOn\": null\n }\n },\n },\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation giftCardUpdate($id: ID!, $input: GiftCardUpdateInput!) {\n giftCardUpdate(id: $id, input: $input) {\n userErrors {\n message\n field\n }\n giftCard {\n id\n expiresOn\n }\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/GiftCard/746346263\",\n \"input\": {\n \"expiresOn\": null\n }\n}\n\nresponse = client.query(query: query, variables: variables)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation giftCardUpdate($id: ID!, $input: GiftCardUpdateInput!) {\n giftCardUpdate(id: $id, input: $input) {\n userErrors {\n message\n field\n }\n giftCard {\n id\n expiresOn\n }\n }\n }\nQUERY;\n\n$variables = [\n \"id\" => \"gid://shopify/GiftCard/746346263\",\n \"input\" => [\n \"expiresOn\" => null,\n ],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation giftCardUpdate($id: ID!, $input: GiftCardUpdateInput!) {\n giftCardUpdate(id: $id, input: $input) {\n userErrors {\n message\n field\n }\n giftCard {\n id\n expiresOn\n }\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/GiftCard/746346263\",\n \"input\": {\n \"expiresOn\": null\n }\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation giftCardUpdate($id: ID!, $input: GiftCardUpdateInput!) {\n giftCardUpdate(id: $id, input: $input) {\n userErrors {\n message\n field\n }\n giftCard {\n id\n expiresOn\n }\n }\n}"
input: { "id": "gid://shopify/GiftCard/746346263", "input": { "expiresOn": null } }
response: { "data": { "giftCardUpdate": { "userErrors": [], "giftCard": { "id": "gid://shopify/GiftCard/746346263", "expiresOn": null } } } }