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 themeCreate($source: URL!, $name: String!) { themeCreate(source: $source, name: $name) { theme { name role } userErrors { field message } } }\",\n \"variables\": {\n \"source\": \"http://www.example.com/dawn.zip\",\n \"name\": \"Dawn\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation themeCreate($source: URL!, $name: String!) {\n themeCreate(source: $source, name: $name) {\n theme {\n name\n role\n }\n userErrors {\n field\n message\n }\n }\n }`,\n \"variables\": {\n \"source\": \"http://www.example.com/dawn.zip\",\n \"name\": \"Dawn\"\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 themeCreate($source: URL!, $name: String!) {\n themeCreate(source: $source, name: $name) {\n theme {\n name\n role\n }\n userErrors {\n field\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"source\": \"http://www.example.com/dawn.zip\",\n \"name\": \"Dawn\"\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 = <<\"http://www.example.com/dawn.zip\",\n \"name\" => \"Dawn\",\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 themeCreate($source: URL!, $name: String!) {\n themeCreate(source: $source, name: $name) {\n theme {\n name\n role\n }\n userErrors {\n field\n message\n }\n }\n }`,\n {\n variables: {\n \"source\": \"http://www.example.com/dawn.zip\",\n \"name\": \"Dawn\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation themeCreate($source: URL!, $name: String!) {\n themeCreate(source: $source, name: $name) {\n theme {\n name\n role\n }\n userErrors {\n field\n message\n }\n }\n}"
input: { "source": "http://www.example.com/dawn.zip", "name": "Dawn" }
response: { "data": { "themeCreate": { "theme": { "name": "Dawn", "role": "UNPUBLISHED" }, "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 ThemeCreate($name: String, $source: URL!) { themeCreate(name: $name, source: $source) { theme { id } userErrors { code field message } } }\",\n \"variables\": {\n \"name\": \"New Theme\",\n \"source\": \"http://someurl.com/lemongrass.zip\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation ThemeCreate($name: String, $source: URL!) {\n themeCreate(name: $name, source: $source) {\n theme {\n id\n }\n userErrors {\n code\n field\n message\n }\n }\n }`,\n \"variables\": {\n \"name\": \"New Theme\",\n \"source\": \"http://someurl.com/lemongrass.zip\"\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 ThemeCreate($name: String, $source: URL!) {\n themeCreate(name: $name, source: $source) {\n theme {\n id\n }\n userErrors {\n code\n field\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"name\": \"New Theme\",\n \"source\": \"http://someurl.com/lemongrass.zip\"\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 = <<\"New Theme\",\n \"source\" => \"http://someurl.com/lemongrass.zip\",\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 ThemeCreate($name: String, $source: URL!) {\n themeCreate(name: $name, source: $source) {\n theme {\n id\n }\n userErrors {\n code\n field\n message\n }\n }\n }`,\n {\n variables: {\n \"name\": \"New Theme\",\n \"source\": \"http://someurl.com/lemongrass.zip\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation ThemeCreate($name: String, $source: URL!) {\n themeCreate(name: $name, source: $source) {\n theme {\n id\n }\n userErrors {\n code\n field\n message\n }\n }\n}"
input: { "name": "New Theme", "source": "http://someurl.com/lemongrass.zip" }
response: { "data": { "themeCreate": { "theme": { "id": "gid://shopify/OnlineStoreTheme/1049083724" }, "userErrors": [] } } }