- •The Advanced Fetch Objects action fetches data from Shopify using an XML payload with a GraphQL query to retrieve specific information, such as orders, products, or customers. It is similar to Query Objects, however, it requires an XML-formatted request body instead of JSON.
The following snippet is a sample request body:
<root>
<query>query {{ orders(first: 10, query: "created_at:>2025-1-25") {{ edges {{ node {{ id createdAt updatedAt }} }} }} }}</query>
</root>
The following snippet is a sample request body with variables:
<root xmlns:m="urn:informatica:ae:xquery:json2xml:meta-data">
<query>query orders($first: Int, $query: String) {{ orders(first: $first, query: $query) {{ edges {{ node {{ id createdAt updatedAt }} }} }} }}
</query>
<variables>
<first m:type="xs:int">10</first>
<query>created_at:>2025-1-25</query>
</variables>
</root>
The following snippet is a sample response:
{
"data": {
"orders": {
"edges": [
{
"node": {
"updatedAt": "2025-01-27T11:18:41Z",
"id": "gid://shopify/Order/6536052572445",
"createdAt": "2025-01-27T11:18:40Z"
}
},
{
"node": {
"updatedAt": "2025-01-27T14:50:57Z",
"id": "gid://shopify/Order/6536220377373",
"createdAt": "2025-01-27T14:50:56Z"
}
},
{
"node": {
"updatedAt": "2025-01-28T08:55:21Z",
"id": "gid://shopify/Order/6537230254365",
"createdAt": "2025-01-28T08:55:20Z"
}
}
]
}
},
"extensions": {
"cost": {
"requestedQueryCost": "6",
"actualQueryCost": "4",
"throttleStatus": {
"currentlyAvailable": "1996",
"maximumAvailable": "2000",
"restoreRate": "100"
}
}
}
}
- •The Advanced Modify Objects action creates or updates Shopify data by executing mutations, such as modifying product details, order statuses, or customer information, using an XML payload with a GraphQL query. It executes GraphQL mutation requests using an XML payload. It is similar to Modify Objects, however, it requires an XML-formatted request body instead of JSON. This is useful for systems that prefer XML over JSON.
The following snippet is a sample request body:
<root>
<query>mutation {{ productCreate(product: {{title: "Cool socks", productOptions: [{{name: "Color", values: [{{name: "Red"}}, {{name: "Blue"}}]}}, {{name: "Size", values: [{{name: "Small"}}, {{name: "Large"}}]}}]}}) {{ product {{ id title options {{ id name position optionValues {{ id name hasVariants }} }} }} userErrors {{ field message }} }} }}</query>
</root>
The following snippet is a sample request body with variables:
<root xmlns:m="urn:informatica:ae:xquery:json2xml:meta-data">
<query>mutation CreateProductWithOptions($input: ProductInput!) {{ productCreate(input: $input) {{ product {{ id title options {{ id name position optionValues {{ id name hasVariants }} }} }} userErrors {{ field message }} }} }}</query>
<variables>
<input>
<title>Cool gloves</title>
<productOptions m:isArray="true">
<name>Color</name>
<values m:isArray="true">
<name>Red</name>
</values>
<values m:isArray="true">
<name>Blue</name>
</values>
</productOptions>
<productOptions m:isArray="true">
<name>Size</name>
<values m:isArray="true">
<name>Small</name>
</values>
<values m:isArray="true">
<name>Large</name>
</values>
</productOptions>
</input>
</variables>
</root>
The following snippet is a sample response:
{
"data": {
"productCreate": {
"product": {
"title": "Cool socks",
"id": "gid://shopify/Product/9731439198493",
"options": [
{
"position": "1",
"name": "Color",
"optionValues": [
{
"hasVariants": "true",
"name": "Red",
"id": "gid://shopify/ProductOptionValue/4580599955741"
},
{
"hasVariants": "false",
"name": "Blue",
"id": "gid://shopify/ProductOptionValue/4580599988509"
}
],
"id": "gid://shopify/ProductOption/12238988345629"
},
{
"position": "2",
"name": "Size",
"optionValues": [
{
"hasVariants": "true",
"name": "Small",
"id": "gid://shopify/ProductOptionValue/4580600021277"
},
{
"hasVariants": "false",
"name": "Large",
"id": "gid://shopify/ProductOptionValue/4580600054045"
}
],
"id": "gid://shopify/ProductOption/12238988378397"
}
]
},
"userErrors": ""
}
},
"extensions": {
"cost": {
"requestedQueryCost": "12",
"actualQueryCost": "12",
"throttleStatus": {
"currentlyAvailable": "1988",
"maximumAvailable": "2000",
"restoreRate": "100"
}
}
}
}
You must escape special characters inside values as shown in the following table:
Special characters | Escape with |
---|
< | < |
> | > |
{ | {{ |
} | }} |
& | & |
To use fields with data types, such as array, boolean, double, or integer, you must use an annotation as shown in the following sample code:
<root xmlns:m="urn:informatica:ae:xquery:json2xml:meta-data">
<field_array m:isArray="true">
<property_1> ...</property_1>
</field_array>
<field_boolean m:type="xs:boolean">true</field_boolean>
<field_double m:type="xs:double">10.3</field_double>
<field_integer m:type="xs:int">5</field_integer>
</root>
- •The Fetch Objects action fetches data from Shopify using GraphQL queries to retrieve specific information, such as orders, products, or customers. It executes GraphQL query requests using a JSON payload. The request body must contain a valid GraphQL query formatted in JSON.
The following snippet is a sample request body:
{ "query": "query { orders(first: 10, query: \"created_at:>2025-1-25\") { edges { node { id createdAt updatedAt } } } }" }
If variables need to be used, the requestBody payload should look like this:
{
"query": "query orders($first: Int, $query: String) { orders(first: $first, query: $query) { edges { node { id createdAt updatedAt } } } }",
"variables": {
"first": 3,
"query": "created_at:>2025-1-25"
}
}
The following snippet is a sample response:
<root>
<extensions>
<cost>
<throttleStatus>
<restoreRate>100</restoreRate>
<currentlyAvailable>1996</currentlyAvailable>
<maximumAvailable>2000</maximumAvailable>
</throttleStatus>
<requestedQueryCost>4</requestedQueryCost>
<actualQueryCost>4</actualQueryCost>
</cost>
</extensions>
<data>
<orders>
<edges>
<node>
<createdAt>2025-01-27T11:18:40Z</createdAt>
<id>gid://shopify/Order/6536052572445</id>
<updatedAt>2025-01-27T11:18:41Z</updatedAt>
</node>
</edges>
<edges>
<node>
<createdAt>2025-01-27T14:50:56Z</createdAt>
<id>gid://shopify/Order/6536220377373</id>
<updatedAt>2025-01-27T14:50:57Z</updatedAt>
</node>
</edges>
<edges>
<node>
<createdAt>2025-01-28T08:55:20Z</createdAt>
<id>gid://shopify/Order/6537230254365</id>
<updatedAt>2025-01-28T08:55:21Z</updatedAt>
</node>
</edges>
</orders>
</data>
</root>
Note: Special characters inside values, such as quotation marks ("), must be escaped (\"). The query field value cannot contain a line break. Otherwise, an error occurs.
- •The Modify Objects action creates or updates Shopify data by executing mutations, such as updating product details, changing order statuses, or modifying customer information. It executes GraphQL mutation requests using a JSON payload.
The following snippet is a sample request body:
{
"query": "mutation { productCreate(product: {title: \"Cool gloves\", productOptions: [{name: \"Color\", values: [{name: \"Red\"}, {name: \"Blue\"}]}, {name: \"Size\", values: [{name: \"Small\"}, {name: \"Large\"}]}]}) { product { id title options { id name position optionValues { id name hasVariants } } } userErrors { field message } } }"
}
The following snippet is a sample request body with variables:
{
"query": "mutation CreateProductWithOptions($input: ProductInput!) { productCreate(input: $input) { product { id title options { id name position optionValues { id name hasVariants } } } userErrors { field message } } }",
"variables" : {
"input": {
"title": "Cool gloves",
"productOptions": [
{
"name": "Color",
"values": [
{"name": "Red"},
{"name": "Blue"}
]
},
{
"name": "Size",
"values": [
{"name": "Small"},
{"name": "Large"}
]
}
]
}
}
}
The following snippet is a sample response:
{
"data": {
"productCreate": {
"product": {
"title": "Cool gloves",
"id": "gid://shopify/Product/9727927714077",
"options": [
{
"position": "1",
"name": "Color",
"optionValues": [
{
"hasVariants": "true",
"name": "Red",
"id": "gid://shopify/ProductOptionValue/4572342026525"
},
{
"hasVariants": "false",
"name": "Blue",
"id": "gid://shopify/ProductOptionValue/4572342059293"
}
],
"id": "gid://shopify/ProductOption/12234878517533"
},
{
"position": "2",
"name": "Size",
"optionValues": [
{
"hasVariants": "true",
"name": "Small",
"id": "gid://shopify/ProductOptionValue/4572342092061"
},
{
"hasVariants": "false",
"name": "Large",
"id": "gid://shopify/ProductOptionValue/4572342124829"
}
],
"id": "gid://shopify/ProductOption/12234878550301"
}
]
},
"userErrors": ""
}
},
"extensions": {
"cost": {
"requestedQueryCost": "12",
"actualQueryCost": "12",
"throttleStatus": {
"currentlyAvailable": "1988",
"maximumAvailable": "2000",
"restoreRate": "100"
}
}
}
}
Note: Special characters inside values, such as quotation marks ("), must be escaped (\"). The query field value cannot contain a line break. Otherwise, an error occurs.
- •The Upload Files action uploads files to an external URL, where the files are stored and later used in Shopify for operations, such as creating files or adding product media. This action uploads files using the parameters returned by the stagedUploadsCreate mutation. A request is sent to stagedUploadsCreate to obtain temporary upload credentials, and then the file is uploaded using those parameters.
The following snippet is a sample of the stagedUploadsCreate mutation:
<root xmlns:m="urn:informatica:ae:xquery:json2xml:meta-data">
<query>mutation stagedUploadsCreate($input: [StagedUploadInput!]!) {{ stagedUploadsCreate(input: $input) {{ stagedTargets {{ url resourceUrl parameters {{ name value }} }} }} }}</query>
<variables>
<input m:isArray="true">
<filename>test.jpg</filename>
<mimeType>image/jpg</mimeType>
<httpMethod>POST</httpMethod>
<resource>IMAGE</resource>
</input>
</variables>
</root>
The following snippet is a sample response:
{
"data": {
"stagedUploadsCreate": {
"stagedTargets": {
"resourceUrl": "https://shopify-staged-uploads.storage.googleapis.com/tmp/91830288669/products/221ae463-1c45-4f5b-9f44-ea378f103c01/test.jpg",
"parameters": [
{
"name": "Content-Type",
"value": "image/jpg"
},
{
"name": "success_action_status",
"value": "201"
},
{
"name": "acl",
"value": "private"
},
{
"name": "key",
"value": "tmp/91830288669/products/221ae463-1c45-4f5b-9f44-ea378f103c01/test.jpg"
},
{
"name": "x-goog-date",
"value": "20250203T175505Z"
},
{
"name": "x-goog-credential",
"value": "merchant-assets@shopify-tiers.iam.gserviceaccount.com/20250203/auto/storage/goog4_request"
},
{
"name": "x-goog-algorithm",
"value": "GOOG4-RSA-SHA256"
},
{
"name": "x-goog-signature",
"value": "a8f9db54283dd3aa2b0682935f3fc7816ae5e46fa714d21125caa3d70bdf5b75a48ea7999b653147e66789a5d212ed8c71d2885925b9d83ee000f177148fa28c2435cbf070dc3c13e9e91bb5d0c8a4529a6a56c4ead2b6107f438d8cd314a906d8ab3f69fbd12393c8f73c07dd81f4708e0327379a79f165b487ccc6f6bc1ea415f2b5468542185e3191cfa0ea7c1892c0fc01979f1d9362f6264bb03b1c45eb59a1f710b188f6517ca84cff60ad1e25b2e340418c7beec5697780f292d3ab2433fc7c9927d64c725cfa8088fcde6828edc9dbd5c14b7aecd3abbb6af2bcb99a7df2354e28b44848968b3b7ab6ed546adb1b1dfe5fd577ce08ca034b4f6f4a08"
},
{
"name": "policy",
"value": "eyJjb25kaXRpb25zIjpbeyJDb250ZW50LVR5cGUiOiJpbWFnZVwvanBnIn0seyJzdWNjZXNzX2FjdGlvbl9zdGF0dXMiOiIyMDEifSx7ImFjbCI6InByaXZhdGUifSxbImNvbnRlbnQtbGVuZ3RoLXJhbmdlIiwxLDIwOTcxNTIwXSx7ImJ1Y2tldCI6InNob3BpZnktc3RhZ2VkLXVwbG9hZHMifSx7ImtleSI6InRtcFwvOTE4MzAyODg2NjlcL3Byb2R1Y3RzXC8yMjFhZTQ2My0xYzQ1LTRmNWItOWY0NC1lYTM3OGYxMDNjMDFcL3Rlc3QuanBnIn0seyJ4LWdvb2ctZGF0ZSI6IjIwMjUwMjAzVDE3NTUwNVoifSx7IngtZ29vZy1jcmVkZW50aWFsIjoibWVyY2hhbnQtYXNzZXRzQHNob3BpZnktdGllcnMuaWFtLmdzZXJ2aWNlYWNjb3VudC5jb21cLzIwMjUwMjAzXC9hdXRvXC9zdG9yYWdlXC9nb29nNF9yZXF1ZXN0In0seyJ4LWdvb2ctYWxnb3JpdGhtIjoiR09PRzQtUlNBLVNIQTI1NiJ9XSwiZXhwaXJhdGlvbiI6IjIwMjUtMDItMDRUMTc6NTU6MDVaIn0="
}
],
"url": "https://shopify-staged-uploads.storage.googleapis.com/"
}
}
},
"extensions": {
"cost": {
"requestedQueryCost": "11",
"actualQueryCost": "11",
"throttleStatus": {
"currentlyAvailable": "1989",
"maximumAvailable": "2000",
"restoreRate": "100"
}
}
}
}
Enter the field values from the stagedUploadsCreate response and attach the file for upload.
The following snippet is a sample of the file upload response:
<PostResponse>
<Location>https://storage.googleapis.com/shopify-staged-uploads/tmp/91830288669/products/221ae463-1c45-4f5b-9f44-ea378f103c01/test.jpg</Location>
<Bucket>shopify-staged-uploads</Bucket> i
<Key>tmp/91830288669/products/221ae463-1c45-4f5b-9f44-ea378f103c01/test.jpg</Key>
<ETag>"6b75954c15f7fed43b8dbeeaf091caff"</ETag>
</PostResponse>
The following snippet is a sample of the stagedUploadsCreate mutation with the video file:
<root xmlns:m="urn:informatica:ae:xquery:json2xml:meta-data">
<query>mutation stagedUploadsCreate($input: [StagedUploadInput!]!) {{ stagedUploadsCreate(input: $input) {{ stagedTargets {{ url resourceUrl parameters {{ name value }} }} }} }}</query>
<variables>
<input m:isArray="true">
<filename>test.mp4</filename>
<mimeType>video/mp4</mimeType>
<resource>VIDEO</resource>
<fileSize>702231</fileSize>
</input>
</variables>
</root>
The following snippet is a sample of a video file upload response:
{
"data": {
"stagedUploadsCreate": {
"stagedTargets": {
"resourceUrl": "https://shopify-video-production-core-originals.storage.googleapis.com?external_video_id=42058667",
"parameters": [
{
"name": "GoogleAccessId",
"value": "video-production@video-production-225115.iam.gserviceaccount.com"
},
{
"name": "key",
"value": "c/o/v/74717c3362734849bdcb63d5657e7254.mp4"
},
{
"name": "policy",
"value": "eyJjb25kaXRpb25zIjpbWyJlcSIsIiRidWNrZXQiLCJzaG9waWZ5LXZpZGVvLXByb2R1Y3Rpb24tY29yZS1vcmlnaW5hbHMiXSxbImVxIiwiJGtleSIsImMvby92Lzc0NzE3YzMzNjI3MzQ4NDliZGNiNjNkNTY1N2U3MjU0Lm1wNCJdLFsiY29udGVudC1sZW5ndGgtcmFuZ2UiLDcwMjIzMSw3MDIyMzFdXSwiZXhwaXJhdGlvbiI6IjIwMjUtMDItMDRUMTM6MTU6NThaIn0="
},
{
"name": "signature",
"value": "NECjI7NoxOAlJOetjwnNNR0B50DivgcGAX581Q3aNeK3DOl4qWiVHozbHuEUn8r+qBgHA6m7YZGNoYqi+d3y8n5OBdboTTgrBAKS02xtTfyhu/hw0zLpUif78UBEw+wv9t15j+dV08uMsNWrI0HW2UBJ9yyqo3EtBFBjCCGIN2MaMhLR/BQfClT2RB2NrIuOpYb3k4IQIC9WXqeXuij0xF9PbDjGen6YUjlA+aPZduiUKqFRrOOXrhAYk8ggmADKq2reFkXWGI7P2aFLXEjAIdRWAqDImmNaO/YKoob+4YLJY4shdtojtzePP8PeLJ/WhGHXUvsm0gTzl2Y0xDrJXg=="
}
],
"url": "https://shopify-video-production-core-originals.storage.googleapis.com"
}
}
},
"extensions": {
"cost": {
"requestedQueryCost": "11",
"actualQueryCost": "11",
"throttleStatus": {
"currentlyAvailable": "1989",
"maximumAvailable": "2000",
"restoreRate": "100"
}
}
}
}
Enter the field values from the stagedUploadsCreate response and attach the file for upload.
The response contains only the status code 204 without any content. Therefore, you must save the resourceUrl parameter from the stagedUploadsCreate response as a link to the uploaded video file.
For example, the next step could be to use the fileCreate mutation to add this file to Shopify Admin as shown in the following snippet:
<root>
<query>mutation fileCreate($files: [FileCreateInput!]!) {{ fileCreate(files: $files) {{ files {{ id fileStatus alt createdAt }} }} }}</query>
<variables>
<files>
<alt>Test video upload</alt>
<contentType>VIDEO</contentType>
<originalSource> https://shopify-video-production-core-originals.storage.googleapis.com/?external_video_id=42057131</originalSource>
</files>
</variables>
</root>
The following snippet is a sample response:
{
"data": {
"fileCreate": {
"files": {
"alt": "Test video upload",
"fileStatus": "UPLOADED",
"id": "gid://shopify/Video/52421481005341",
"createdAt": "2025-02-04T16:31:34Z"
}
}
},
"extensions": {
"cost": {
"requestedQueryCost": "20",
"actualQueryCost": "20",
"throttleStatus": {
"currentlyAvailable": "1980",
"maximumAvailable": "2000",
"restoreRate": "100"
}
}
}
}