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 ReturnApproveRequest($input: ReturnApproveRequestInput!) { returnApproveRequest(input: $input) { return { id name status returnLineItems(first: 1) { edges { node { id } } } order { id } } userErrors { code field message } } }\",\n \"variables\": {\n \"input\": {\n \"id\": \"gid://shopify/Return/945000959\"\n }\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation ReturnApproveRequest($input: ReturnApproveRequestInput!) {\n returnApproveRequest(input: $input) {\n return {\n id\n name\n status\n returnLineItems(first: 1) {\n edges {\n node {\n id\n }\n }\n }\n order {\n id\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }`,\n \"variables\": {\n \"input\": {\n \"id\": \"gid://shopify/Return/945000959\"\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 ReturnApproveRequest($input: ReturnApproveRequestInput!) {\n returnApproveRequest(input: $input) {\n return {\n id\n name\n status\n returnLineItems(first: 1) {\n edges {\n node {\n id\n }\n }\n }\n order {\n id\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"input\": {\n \"id\": \"gid://shopify/Return/945000959\"\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 ReturnApproveRequest($input: ReturnApproveRequestInput!) {\n returnApproveRequest(input: $input) {\n return {\n id\n name\n status\n returnLineItems(first: 1) {\n edges {\n node {\n id\n }\n }\n }\n order {\n id\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }\nQUERY;\n\n$variables = [\n \"input\" => [\n \"id\" => \"gid://shopify/Return/945000959\",\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 ReturnApproveRequest($input: ReturnApproveRequestInput!) {\n returnApproveRequest(input: $input) {\n return {\n id\n name\n status\n returnLineItems(first: 1) {\n edges {\n node {\n id\n }\n }\n }\n order {\n id\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }`,\n {\n variables: {\n \"input\": {\n \"id\": \"gid://shopify/Return/945000959\"\n }\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation ReturnApproveRequest($input: ReturnApproveRequestInput!) {\n returnApproveRequest(input: $input) {\n return {\n id\n name\n status\n returnLineItems(first: 1) {\n edges {\n node {\n id\n }\n }\n }\n order {\n id\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n}"
input: { "input": { "id": "gid://shopify/Return/945000959" } }
response: { "data": { "returnApproveRequest": { "return": { "id": "gid://shopify/Return/945000959", "name": "#1001-R1", "status": "OPEN", "returnLineItems": { "edges": [ { "node": { "id": "gid://shopify/ReturnLineItem/677614676" } } ] }, "order": { "id": "gid://shopify/Order/311154583" } }, "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 ReturnApproveRequest($input: ReturnApproveRequestInput!) { returnApproveRequest(input: $input) { return { id status } userErrors { code field message } } }\",\n \"variables\": {\n \"input\": {\n \"id\": \"gid://shopify/Return/945000958\"\n }\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation ReturnApproveRequest($input: ReturnApproveRequestInput!) {\n returnApproveRequest(input: $input) {\n return {\n id\n status\n }\n userErrors {\n code\n field\n message\n }\n }\n }`,\n \"variables\": {\n \"input\": {\n \"id\": \"gid://shopify/Return/945000958\"\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 ReturnApproveRequest($input: ReturnApproveRequestInput!) {\n returnApproveRequest(input: $input) {\n return {\n id\n status\n }\n userErrors {\n code\n field\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"input\": {\n \"id\": \"gid://shopify/Return/945000958\"\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 ReturnApproveRequest($input: ReturnApproveRequestInput!) {\n returnApproveRequest(input: $input) {\n return {\n id\n status\n }\n userErrors {\n code\n field\n message\n }\n }\n }\nQUERY;\n\n$variables = [\n \"input\" => [\n \"id\" => \"gid://shopify/Return/945000958\",\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 ReturnApproveRequest($input: ReturnApproveRequestInput!) {\n returnApproveRequest(input: $input) {\n return {\n id\n status\n }\n userErrors {\n code\n field\n message\n }\n }\n }`,\n {\n variables: {\n \"input\": {\n \"id\": \"gid://shopify/Return/945000958\"\n }\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation ReturnApproveRequest($input: ReturnApproveRequestInput!) {\n returnApproveRequest(input: $input) {\n return {\n id\n status\n }\n userErrors {\n code\n field\n message\n }\n }\n}"
input: { "input": { "id": "gid://shopify/Return/945000958" } }
response: { "data": { "returnApproveRequest": { "return": null, "userErrors": [ { "code": "INVALID_STATE", "field": [ "input", "id" ], "message": "Return is not approvable. Only returns with status REQUESTED can be approved." } ] } } }