Version: unstable
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/api/unstable/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Storefront-Access-Token: {storefront_access_token}' \\\n-d '{\n\"query\": \"mutation customerEmailMarketingSubscribe($email: String!) { customerEmailMarketingSubscribe(email: $email) { customer { email } customerUserErrors { field message code } } }\",\n \"variables\": {\n \"email\": \"johnsmith@shopify.com\"\n }\n}'\n" Node example: "const client = new shopify.clients.Storefront({\n domain: 'your-development-store.myshopify.com',\n storefrontAccessToken,\n});\nconst data = await client.query({\n data: {\n \"query\": `mutation customerEmailMarketingSubscribe($email: String!) {\n customerEmailMarketingSubscribe(email: $email) {\n customer {\n email\n }\n customerUserErrors {\n field\n message\n code\n }\n }\n }`,\n \"variables\": {\n \"email\": \"johnsmith@shopify.com\"\n },\n },\n});\n" Ruby example: null PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new ShopifyClientsStorefront(\"your-development-store.myshopify.com\", $storefrontAccessToken);\n$query = <<<QUERY\n mutation customerEmailMarketingSubscribe($email: String!) {\n customerEmailMarketingSubscribe(email: $email) {\n customer {\n email\n }\n customerUserErrors {\n field\n message\n code\n }\n }\n }\nQUERY;\n\n$variables = [\n \"email\" => \"johnsmith@shopify.com\",\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" Remix example: "const { storefront } = await unauthenticated.storefront(\n 'your-development-store.myshopify.com'\n);\n\nconst response = await storefront.graphql(\n `#graphql\n mutation customerEmailMarketingSubscribe($email: String!) {\n customerEmailMarketingSubscribe(email: $email) {\n customer {\n email\n }\n customerUserErrors {\n field\n message\n code\n }\n }\n }`,\n {\n variables: {\n \"email\": \"johnsmith@shopify.com\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation customerEmailMarketingSubscribe($email: String!) {\n customerEmailMarketingSubscribe(email: $email) {\n customer {\n email\n }\n customerUserErrors {\n field\n message\n code\n }\n }\n}"
input: { "email": "johnsmith@shopify.com" }
response: { "data": { "customerEmailMarketingSubscribe": { "customer": { "email": "johnsmith@shopify.com" }, "customerUserErrors": [] } } }