Version: unstable
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/unstable/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation createCustomer($input: CustomerSetInput!) { customerSet(input: $input) { customer { id } userErrors { code field message } } }\",\n \"variables\": {\n \"input\": {\n \"email\": \"steve.lastnameson@example.com\",\n \"phone\": \"+16465555555\",\n \"firstName\": \"Steve\",\n \"lastName\": \"Lastname\"\n }\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation createCustomer($input: CustomerSetInput!) {\n customerSet(input: $input) {\n customer {\n id\n }\n userErrors {\n code\n field\n message\n }\n }\n }`,\n \"variables\": {\n \"input\": {\n \"email\": \"steve.lastnameson@example.com\",\n \"phone\": \"+16465555555\",\n \"firstName\": \"Steve\",\n \"lastName\": \"Lastname\"\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 createCustomer($input: CustomerSetInput!) {\n customerSet(input: $input) {\n customer {\n id\n }\n userErrors {\n code\n field\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"input\": {\n \"email\": \"steve.lastnameson@example.com\",\n \"phone\": \"+16465555555\",\n \"firstName\": \"Steve\",\n \"lastName\": \"Lastname\"\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 createCustomer($input: CustomerSetInput!) {\n customerSet(input: $input) {\n customer {\n id\n }\n userErrors {\n code\n field\n message\n }\n }\n }\nQUERY;\n\n$variables = [\n \"input\" => [\n \"email\" => \"steve.lastnameson@example.com\",\n \"phone\" => \"+16465555555\",\n \"firstName\" => \"Steve\",\n \"lastName\" => \"Lastname\",\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 createCustomer($input: CustomerSetInput!) {\n customerSet(input: $input) {\n customer {\n id\n }\n userErrors {\n code\n field\n message\n }\n }\n }`,\n {\n variables: {\n \"input\": {\n \"email\": \"steve.lastnameson@example.com\",\n \"phone\": \"+16465555555\",\n \"firstName\": \"Steve\",\n \"lastName\": \"Lastname\"\n }\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation createCustomer($input: CustomerSetInput!) {\n customerSet(input: $input) {\n customer {\n id\n }\n userErrors {\n code\n field\n message\n }\n }\n}"
input: { "input": { "email": "steve.lastnameson@example.com", "phone": "+16465555555", "firstName": "Steve", "lastName": "Lastname" } }
response: { "data": { "customerSet": { "customer": { "id": "gid://shopify/Customer/1073339458" }, "userErrors": [] } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/unstable/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation customerSet($input: CustomerSetInput!) { customerSet(input: $input) { userErrors { field message } customer { id firstName lastName } } }\",\n \"variables\": {\n \"input\": {\n \"id\": \"gid://shopify/Customer/1018520244\",\n \"firstName\": \"Steve\",\n \"lastName\": \"Lastname\"\n }\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation customerSet($input: CustomerSetInput!) {\n customerSet(input: $input) {\n userErrors {\n field\n message\n }\n customer {\n id\n firstName\n lastName\n }\n }\n }`,\n \"variables\": {\n \"input\": {\n \"id\": \"gid://shopify/Customer/1018520244\",\n \"firstName\": \"Steve\",\n \"lastName\": \"Lastname\"\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 customerSet($input: CustomerSetInput!) {\n customerSet(input: $input) {\n userErrors {\n field\n message\n }\n customer {\n id\n firstName\n lastName\n }\n }\n }\nQUERY\n\nvariables = {\n \"input\": {\n \"id\": \"gid://shopify/Customer/1018520244\",\n \"firstName\": \"Steve\",\n \"lastName\": \"Lastname\"\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 customerSet($input: CustomerSetInput!) {\n customerSet(input: $input) {\n userErrors {\n field\n message\n }\n customer {\n id\n firstName\n lastName\n }\n }\n }\nQUERY;\n\n$variables = [\n \"input\" => [\n \"id\" => \"gid://shopify/Customer/1018520244\",\n \"firstName\" => \"Steve\",\n \"lastName\" => \"Lastname\",\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 customerSet($input: CustomerSetInput!) {\n customerSet(input: $input) {\n userErrors {\n field\n message\n }\n customer {\n id\n firstName\n lastName\n }\n }\n }`,\n {\n variables: {\n \"input\": {\n \"id\": \"gid://shopify/Customer/1018520244\",\n \"firstName\": \"Steve\",\n \"lastName\": \"Lastname\"\n }\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation customerSet($input: CustomerSetInput!) {\n customerSet(input: $input) {\n userErrors {\n field\n message\n }\n customer {\n id\n firstName\n lastName\n }\n }\n}"
input: { "input": { "id": "gid://shopify/Customer/1018520244", "firstName": "Steve", "lastName": "Lastname" } }
response: { "data": { "customerSet": { "userErrors": [], "customer": { "id": "gid://shopify/Customer/1018520244", "firstName": "Steve", "lastName": "Lastname" } } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/unstable/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation customerSet($input: CustomerSetInput!, $upsertInput: CustomerSetUpsertInput) { customerSet(input: $input, upsertInput: $upsertInput) { userErrors { field message } customer { id firstName lastName } } }\",\n \"variables\": {\n \"upsertInput\": {\n \"match\": {\n \"email\": \"bob@example.org\"\n }\n },\n \"input\": {\n \"email\": \"bob@example.org\",\n \"firstName\": \"Steve\",\n \"lastName\": \"Lastname\"\n }\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation customerSet($input: CustomerSetInput!, $upsertInput: CustomerSetUpsertInput) {\n customerSet(input: $input, upsertInput: $upsertInput) {\n userErrors {\n field\n message\n }\n customer {\n id\n firstName\n lastName\n }\n }\n }`,\n \"variables\": {\n \"upsertInput\": {\n \"match\": {\n \"email\": \"bob@example.org\"\n }\n },\n \"input\": {\n \"email\": \"bob@example.org\",\n \"firstName\": \"Steve\",\n \"lastName\": \"Lastname\"\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 customerSet($input: CustomerSetInput!, $upsertInput: CustomerSetUpsertInput) {\n customerSet(input: $input, upsertInput: $upsertInput) {\n userErrors {\n field\n message\n }\n customer {\n id\n firstName\n lastName\n }\n }\n }\nQUERY\n\nvariables = {\n \"upsertInput\": {\n \"match\": {\n \"email\": \"bob@example.org\"\n }\n },\n \"input\": {\n \"email\": \"bob@example.org\",\n \"firstName\": \"Steve\",\n \"lastName\": \"Lastname\"\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 customerSet($input: CustomerSetInput!, $upsertInput: CustomerSetUpsertInput) {\n customerSet(input: $input, upsertInput: $upsertInput) {\n userErrors {\n field\n message\n }\n customer {\n id\n firstName\n lastName\n }\n }\n }\nQUERY;\n\n$variables = [\n \"upsertInput\" => [\n \"match\" => [\n \"email\" => \"bob@example.org\",\n ],\n ],\n \"input\" => [\n \"email\" => \"bob@example.org\",\n \"firstName\" => \"Steve\",\n \"lastName\" => \"Lastname\",\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 customerSet($input: CustomerSetInput!, $upsertInput: CustomerSetUpsertInput) {\n customerSet(input: $input, upsertInput: $upsertInput) {\n userErrors {\n field\n message\n }\n customer {\n id\n firstName\n lastName\n }\n }\n }`,\n {\n variables: {\n \"upsertInput\": {\n \"match\": {\n \"email\": \"bob@example.org\"\n }\n },\n \"input\": {\n \"email\": \"bob@example.org\",\n \"firstName\": \"Steve\",\n \"lastName\": \"Lastname\"\n }\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation customerSet($input: CustomerSetInput!, $upsertInput: CustomerSetUpsertInput) {\n customerSet(input: $input, upsertInput: $upsertInput) {\n userErrors {\n field\n message\n }\n customer {\n id\n firstName\n lastName\n }\n }\n}"
input: { "upsertInput": { "match": { "email": "bob@example.org" } }, "input": { "email": "bob@example.org", "firstName": "Steve", "lastName": "Lastname" } }
response: { "data": { "customerSet": { "userErrors": [], "customer": { "id": "gid://shopify/Customer/1018520244", "firstName": "Steve", "lastName": "Lastname" } } } }