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 deliveryProfileUpdate($id: ID!, $profile: DeliveryProfileInput!) { deliveryProfileUpdate(id: $id, profile: $profile) { profile { id name profileLocationGroups { locationGroup { id locations(first: 5) { nodes { name address { country } } } } locationGroupZones(first: 2) { edges { node { zone { id name countries { code { countryCode } provinces { code } } } } } } } } userErrors { field message } } }\",\n \"variables\": {\n \"id\": \"gid://shopify/DeliveryProfile/593363170\",\n \"profile\": {\n \"name\": \"Sample Updated Delivery Profile\",\n \"locationGroupsToUpdate\": [\n {\n \"id\": \"gid://shopify/DeliveryLocationGroup/955592432\",\n \"locationsToAdd\": [\n \"gid://shopify/Location/884687543\"\n ],\n \"zonesToCreate\": [\n {\n \"name\": \"USA Zone\",\n \"countries\": {\n \"code\": \"US\",\n \"provinces\": [\n {\n \"code\": \"CO\"\n }\n ]\n },\n \"methodDefinitionsToCreate\": [\n {\n \"name\": \"Standard\",\n \"rateDefinition\": {\n \"price\": {\n \"amount\": 1.0,\n \"currencyCode\": \"USD\"\n }\n }\n }\n ]\n }\n ]\n }\n ]\n }\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation deliveryProfileUpdate($id: ID!, $profile: DeliveryProfileInput!) {\n deliveryProfileUpdate(id: $id, profile: $profile) {\n profile {\n id\n name\n profileLocationGroups {\n locationGroup {\n id\n locations(first: 5) {\n nodes {\n name\n address {\n country\n }\n }\n }\n }\n locationGroupZones(first: 2) {\n edges {\n node {\n zone {\n id\n name\n countries {\n code {\n countryCode\n }\n provinces {\n code\n }\n }\n }\n }\n }\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/DeliveryProfile/593363170\",\n \"profile\": {\n \"name\": \"Sample Updated Delivery Profile\",\n \"locationGroupsToUpdate\": [\n {\n \"id\": \"gid://shopify/DeliveryLocationGroup/955592432\",\n \"locationsToAdd\": [\n \"gid://shopify/Location/884687543\"\n ],\n \"zonesToCreate\": [\n {\n \"name\": \"USA Zone\",\n \"countries\": {\n \"code\": \"US\",\n \"provinces\": [\n {\n \"code\": \"CO\"\n }\n ]\n },\n \"methodDefinitionsToCreate\": [\n {\n \"name\": \"Standard\",\n \"rateDefinition\": {\n \"price\": {\n \"amount\": 1.0,\n \"currencyCode\": \"USD\"\n }\n }\n }\n ]\n }\n ]\n }\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 deliveryProfileUpdate($id: ID!, $profile: DeliveryProfileInput!) {\n deliveryProfileUpdate(id: $id, profile: $profile) {\n profile {\n id\n name\n profileLocationGroups {\n locationGroup {\n id\n locations(first: 5) {\n nodes {\n name\n address {\n country\n }\n }\n }\n }\n locationGroupZones(first: 2) {\n edges {\n node {\n zone {\n id\n name\n countries {\n code {\n countryCode\n }\n provinces {\n code\n }\n }\n }\n }\n }\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/DeliveryProfile/593363170\",\n \"profile\": {\n \"name\": \"Sample Updated Delivery Profile\",\n \"locationGroupsToUpdate\": [{\"id\"=>\"gid://shopify/DeliveryLocationGroup/955592432\", \"locationsToAdd\"=>[\"gid://shopify/Location/884687543\"], \"zonesToCreate\"=>[{\"name\"=>\"USA Zone\", \"countries\"=>{\"code\"=>\"US\", \"provinces\"=>[{\"code\"=>\"CO\"}]}, \"methodDefinitionsToCreate\"=>[{\"name\"=>\"Standard\", \"rateDefinition\"=>{\"price\"=>{\"amount\"=>1.0, \"currencyCode\"=>\"USD\"}}}]}]}]\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 deliveryProfileUpdate($id: ID!, $profile: DeliveryProfileInput!) {\n deliveryProfileUpdate(id: $id, profile: $profile) {\n profile {\n id\n name\n profileLocationGroups {\n locationGroup {\n id\n locations(first: 5) {\n nodes {\n name\n address {\n country\n }\n }\n }\n }\n locationGroupZones(first: 2) {\n edges {\n node {\n zone {\n id\n name\n countries {\n code {\n countryCode\n }\n provinces {\n code\n }\n }\n }\n }\n }\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n }\nQUERY;\n\n$variables = [\n \"id\" => \"gid://shopify/DeliveryProfile/593363170\",\n \"profile\" => [\n \"name\" => \"Sample Updated Delivery Profile\",\n \"locationGroupsToUpdate\" => [{\"id\"=>\"gid://shopify/DeliveryLocationGroup/955592432\", \"locationsToAdd\"=>[\"gid://shopify/Location/884687543\"], \"zonesToCreate\"=>[{\"name\"=>\"USA Zone\", \"countries\"=>{\"code\"=>\"US\", \"provinces\"=>[{\"code\"=>\"CO\"}]}, \"methodDefinitionsToCreate\"=>[{\"name\"=>\"Standard\", \"rateDefinition\"=>{\"price\"=>{\"amount\"=>1.0, \"currencyCode\"=>\"USD\"}}}]}]}],\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 deliveryProfileUpdate($id: ID!, $profile: DeliveryProfileInput!) {\n deliveryProfileUpdate(id: $id, profile: $profile) {\n profile {\n id\n name\n profileLocationGroups {\n locationGroup {\n id\n locations(first: 5) {\n nodes {\n name\n address {\n country\n }\n }\n }\n }\n locationGroupZones(first: 2) {\n edges {\n node {\n zone {\n id\n name\n countries {\n code {\n countryCode\n }\n provinces {\n code\n }\n }\n }\n }\n }\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/DeliveryProfile/593363170\",\n \"profile\": {\n \"name\": \"Sample Updated Delivery Profile\",\n \"locationGroupsToUpdate\": [\n {\n \"id\": \"gid://shopify/DeliveryLocationGroup/955592432\",\n \"locationsToAdd\": [\n \"gid://shopify/Location/884687543\"\n ],\n \"zonesToCreate\": [\n {\n \"name\": \"USA Zone\",\n \"countries\": {\n \"code\": \"US\",\n \"provinces\": [\n {\n \"code\": \"CO\"\n }\n ]\n },\n \"methodDefinitionsToCreate\": [\n {\n \"name\": \"Standard\",\n \"rateDefinition\": {\n \"price\": {\n \"amount\": 1.0,\n \"currencyCode\": \"USD\"\n }\n }\n }\n ]\n }\n ]\n }\n ]\n }\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation deliveryProfileUpdate($id: ID!, $profile: DeliveryProfileInput!) {\n deliveryProfileUpdate(id: $id, profile: $profile) {\n profile {\n id\n name\n profileLocationGroups {\n locationGroup {\n id\n locations(first: 5) {\n nodes {\n name\n address {\n country\n }\n }\n }\n }\n locationGroupZones(first: 2) {\n edges {\n node {\n zone {\n id\n name\n countries {\n code {\n countryCode\n }\n provinces {\n code\n }\n }\n }\n }\n }\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n}"
input: { "id": "gid://shopify/DeliveryProfile/593363170", "profile": { "name": "Sample Updated Delivery Profile", "locationGroupsToUpdate": [ { "id": "gid://shopify/DeliveryLocationGroup/955592432", "locationsToAdd": [ "gid://shopify/Location/884687543" ], "zonesToCreate": [ { "name": "USA Zone", "countries": { "code": "US", "provinces": [ { "code": "CO" } ] }, "methodDefinitionsToCreate": [ { "name": "Standard", "rateDefinition": { "price": { "amount": 1.0, "currencyCode": "USD" } } } ] } ] } ] } }
response: { "data": { "deliveryProfileUpdate": { "profile": { "id": "gid://shopify/DeliveryProfile/593363170", "name": "Sample Updated Delivery Profile", "profileLocationGroups": [ { "locationGroup": { "id": "gid://shopify/DeliveryLocationGroup/955592432", "locations": { "nodes": [ { "name": "Ottawa Store", "address": { "country": "Canada" } }, { "name": "Ottawa Warehouse", "address": { "country": "Canada" } }, { "name": "Shipping Origin", "address": { "country": "Canada" } } ] } }, "locationGroupZones": { "edges": [ { "node": { "zone": { "id": "gid://shopify/DeliveryZone/161697132", "name": "Canada", "countries": [ { "code": { "countryCode": "CA" }, "provinces": [ { "code": "ON" } ] } ] } } }, { "node": { "zone": { "id": "gid://shopify/DeliveryZone/1066475777", "name": "USA Zone", "countries": [ { "code": { "countryCode": "US" }, "provinces": [ { "code": "CO" } ] } ] } } } ] } } ] }, "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 deliveryProfileUpdate($id: ID!, $profile: DeliveryProfileInput!) { deliveryProfileUpdate(id: $id, profile: $profile) { profile { id name profileLocationGroups { locationGroup { id locations(first: 5) { nodes { name address { country } } } } locationGroupZones(first: 2) { edges { node { zone { id name countries { code { countryCode } provinces { code } } } } } } } } userErrors { field message } } }\",\n \"variables\": {\n \"id\": \"gid://shopify/DeliveryProfile/593363170\",\n \"profile\": {\n \"name\": \"Sample Updated Delivery Profile\",\n \"locationGroupsToCreate\": [\n {\n \"locationsToAdd\": [\n \"gid://shopify/Location/415211365\"\n ],\n \"zonesToCreate\": [\n {\n \"name\": \"USA Zone\",\n \"countries\": {\n \"code\": \"US\",\n \"provinces\": [\n {\n \"code\": \"CO\"\n }\n ]\n },\n \"methodDefinitionsToCreate\": [\n {\n \"name\": \"Standard\",\n \"rateDefinition\": {\n \"price\": {\n \"amount\": 1.0,\n \"currencyCode\": \"USD\"\n }\n }\n }\n ]\n },\n {\n \"name\": \"Mexico Zone\",\n \"countries\": {\n \"code\": \"MX\",\n \"provinces\": [\n {\n \"code\": \"MOR\"\n }\n ]\n },\n \"methodDefinitionsToCreate\": [\n {\n \"name\": \"Standard\",\n \"rateDefinition\": {\n \"price\": {\n \"amount\": 1.0,\n \"currencyCode\": \"USD\"\n }\n }\n }\n ]\n }\n ]\n }\n ]\n }\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation deliveryProfileUpdate($id: ID!, $profile: DeliveryProfileInput!) {\n deliveryProfileUpdate(id: $id, profile: $profile) {\n profile {\n id\n name\n profileLocationGroups {\n locationGroup {\n id\n locations(first: 5) {\n nodes {\n name\n address {\n country\n }\n }\n }\n }\n locationGroupZones(first: 2) {\n edges {\n node {\n zone {\n id\n name\n countries {\n code {\n countryCode\n }\n provinces {\n code\n }\n }\n }\n }\n }\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/DeliveryProfile/593363170\",\n \"profile\": {\n \"name\": \"Sample Updated Delivery Profile\",\n \"locationGroupsToCreate\": [\n {\n \"locationsToAdd\": [\n \"gid://shopify/Location/415211365\"\n ],\n \"zonesToCreate\": [\n {\n \"name\": \"USA Zone\",\n \"countries\": {\n \"code\": \"US\",\n \"provinces\": [\n {\n \"code\": \"CO\"\n }\n ]\n },\n \"methodDefinitionsToCreate\": [\n {\n \"name\": \"Standard\",\n \"rateDefinition\": {\n \"price\": {\n \"amount\": 1.0,\n \"currencyCode\": \"USD\"\n }\n }\n }\n ]\n },\n {\n \"name\": \"Mexico Zone\",\n \"countries\": {\n \"code\": \"MX\",\n \"provinces\": [\n {\n \"code\": \"MOR\"\n }\n ]\n },\n \"methodDefinitionsToCreate\": [\n {\n \"name\": \"Standard\",\n \"rateDefinition\": {\n \"price\": {\n \"amount\": 1.0,\n \"currencyCode\": \"USD\"\n }\n }\n }\n ]\n }\n ]\n }\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 deliveryProfileUpdate($id: ID!, $profile: DeliveryProfileInput!) {\n deliveryProfileUpdate(id: $id, profile: $profile) {\n profile {\n id\n name\n profileLocationGroups {\n locationGroup {\n id\n locations(first: 5) {\n nodes {\n name\n address {\n country\n }\n }\n }\n }\n locationGroupZones(first: 2) {\n edges {\n node {\n zone {\n id\n name\n countries {\n code {\n countryCode\n }\n provinces {\n code\n }\n }\n }\n }\n }\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/DeliveryProfile/593363170\",\n \"profile\": {\n \"name\": \"Sample Updated Delivery Profile\",\n \"locationGroupsToCreate\": [{\"locationsToAdd\"=>[\"gid://shopify/Location/415211365\"], \"zonesToCreate\"=>[{\"name\"=>\"USA Zone\", \"countries\"=>{\"code\"=>\"US\", \"provinces\"=>[{\"code\"=>\"CO\"}]}, \"methodDefinitionsToCreate\"=>[{\"name\"=>\"Standard\", \"rateDefinition\"=>{\"price\"=>{\"amount\"=>1.0, \"currencyCode\"=>\"USD\"}}}]}, {\"name\"=>\"Mexico Zone\", \"countries\"=>{\"code\"=>\"MX\", \"provinces\"=>[{\"code\"=>\"MOR\"}]}, \"methodDefinitionsToCreate\"=>[{\"name\"=>\"Standard\", \"rateDefinition\"=>{\"price\"=>{\"amount\"=>1.0, \"currencyCode\"=>\"USD\"}}}]}]}]\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 deliveryProfileUpdate($id: ID!, $profile: DeliveryProfileInput!) {\n deliveryProfileUpdate(id: $id, profile: $profile) {\n profile {\n id\n name\n profileLocationGroups {\n locationGroup {\n id\n locations(first: 5) {\n nodes {\n name\n address {\n country\n }\n }\n }\n }\n locationGroupZones(first: 2) {\n edges {\n node {\n zone {\n id\n name\n countries {\n code {\n countryCode\n }\n provinces {\n code\n }\n }\n }\n }\n }\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n }\nQUERY;\n\n$variables = [\n \"id\" => \"gid://shopify/DeliveryProfile/593363170\",\n \"profile\" => [\n \"name\" => \"Sample Updated Delivery Profile\",\n \"locationGroupsToCreate\" => [{\"locationsToAdd\"=>[\"gid://shopify/Location/415211365\"], \"zonesToCreate\"=>[{\"name\"=>\"USA Zone\", \"countries\"=>{\"code\"=>\"US\", \"provinces\"=>[{\"code\"=>\"CO\"}]}, \"methodDefinitionsToCreate\"=>[{\"name\"=>\"Standard\", \"rateDefinition\"=>{\"price\"=>{\"amount\"=>1.0, \"currencyCode\"=>\"USD\"}}}]}, {\"name\"=>\"Mexico Zone\", \"countries\"=>{\"code\"=>\"MX\", \"provinces\"=>[{\"code\"=>\"MOR\"}]}, \"methodDefinitionsToCreate\"=>[{\"name\"=>\"Standard\", \"rateDefinition\"=>{\"price\"=>{\"amount\"=>1.0, \"currencyCode\"=>\"USD\"}}}]}]}],\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 deliveryProfileUpdate($id: ID!, $profile: DeliveryProfileInput!) {\n deliveryProfileUpdate(id: $id, profile: $profile) {\n profile {\n id\n name\n profileLocationGroups {\n locationGroup {\n id\n locations(first: 5) {\n nodes {\n name\n address {\n country\n }\n }\n }\n }\n locationGroupZones(first: 2) {\n edges {\n node {\n zone {\n id\n name\n countries {\n code {\n countryCode\n }\n provinces {\n code\n }\n }\n }\n }\n }\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/DeliveryProfile/593363170\",\n \"profile\": {\n \"name\": \"Sample Updated Delivery Profile\",\n \"locationGroupsToCreate\": [\n {\n \"locationsToAdd\": [\n \"gid://shopify/Location/415211365\"\n ],\n \"zonesToCreate\": [\n {\n \"name\": \"USA Zone\",\n \"countries\": {\n \"code\": \"US\",\n \"provinces\": [\n {\n \"code\": \"CO\"\n }\n ]\n },\n \"methodDefinitionsToCreate\": [\n {\n \"name\": \"Standard\",\n \"rateDefinition\": {\n \"price\": {\n \"amount\": 1.0,\n \"currencyCode\": \"USD\"\n }\n }\n }\n ]\n },\n {\n \"name\": \"Mexico Zone\",\n \"countries\": {\n \"code\": \"MX\",\n \"provinces\": [\n {\n \"code\": \"MOR\"\n }\n ]\n },\n \"methodDefinitionsToCreate\": [\n {\n \"name\": \"Standard\",\n \"rateDefinition\": {\n \"price\": {\n \"amount\": 1.0,\n \"currencyCode\": \"USD\"\n }\n }\n }\n ]\n }\n ]\n }\n ]\n }\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation deliveryProfileUpdate($id: ID!, $profile: DeliveryProfileInput!) {\n deliveryProfileUpdate(id: $id, profile: $profile) {\n profile {\n id\n name\n profileLocationGroups {\n locationGroup {\n id\n locations(first: 5) {\n nodes {\n name\n address {\n country\n }\n }\n }\n }\n locationGroupZones(first: 2) {\n edges {\n node {\n zone {\n id\n name\n countries {\n code {\n countryCode\n }\n provinces {\n code\n }\n }\n }\n }\n }\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n}"
input: { "id": "gid://shopify/DeliveryProfile/593363170", "profile": { "name": "Sample Updated Delivery Profile", "locationGroupsToCreate": [ { "locationsToAdd": [ "gid://shopify/Location/415211365" ], "zonesToCreate": [ { "name": "USA Zone", "countries": { "code": "US", "provinces": [ { "code": "CO" } ] }, "methodDefinitionsToCreate": [ { "name": "Standard", "rateDefinition": { "price": { "amount": 1.0, "currencyCode": "USD" } } } ] }, { "name": "Mexico Zone", "countries": { "code": "MX", "provinces": [ { "code": "MOR" } ] }, "methodDefinitionsToCreate": [ { "name": "Standard", "rateDefinition": { "price": { "amount": 1.0, "currencyCode": "USD" } } } ] } ] } ] } }
response: { "data": { "deliveryProfileUpdate": { "profile": { "id": "gid://shopify/DeliveryProfile/593363170", "name": "Sample Updated Delivery Profile", "profileLocationGroups": [ { "locationGroup": { "id": "gid://shopify/DeliveryLocationGroup/955592432", "locations": { "nodes": [ { "name": "Ottawa Store", "address": { "country": "Canada" } }, { "name": "Shipping Origin", "address": { "country": "Canada" } } ] } }, "locationGroupZones": { "edges": [ { "node": { "zone": { "id": "gid://shopify/DeliveryZone/161697132", "name": "Canada", "countries": [ { "code": { "countryCode": "CA" }, "provinces": [ { "code": "ON" } ] } ] } } } ] } }, { "locationGroup": { "id": "gid://shopify/DeliveryLocationGroup/982182450", "locations": { "nodes": [ { "name": "US Store", "address": { "country": "United States" } } ] } }, "locationGroupZones": { "edges": [ { "node": { "zone": { "id": "gid://shopify/DeliveryZone/1066475776", "name": "Mexico Zone", "countries": [ { "code": { "countryCode": "MX" }, "provinces": [ { "code": "MOR" } ] } ] } } }, { "node": { "zone": { "id": "gid://shopify/DeliveryZone/1066475775", "name": "USA Zone", "countries": [ { "code": { "countryCode": "US" }, "provinces": [ { "code": "CO" } ] } ] } } } ] } } ] }, "userErrors": [] } } }