GraphQL treating children as siblings

Solved
bgodbgg
Tourist
8 0 1

I am trying to use the bulk API to pull all orders and for each order, all of their line items.  I am starting my query like below, and when I get the response via the jsonurl, It shows line 1 as an order object, then one object per line for each line item, then the next order object.  So instead of 1 json object per order, I'm getting 1 + X line items of json objects.  Is it possible to get the line items as children instead of siblings?

 

{
        orders (query:"created_at:>'2020-05-08T00:00:00Z'") {
    		edges {
    			node {
    				lineItems {
    					edges {
    						node {
    							id
    							variant_id: variant {
    								id
    							}
}
}
}
}
}
}
}

 

0 Likes
_JB
Shopify Staff
Shopify Staff
750 87 165

This is an accepted solution.

Hey @bgodbgg,

 

The behaviour you describe is expected for the Bulk Operations API, since it uses the JSONL format. As you already mentioned, the JSONL format outputs data on separate lines, and each line is a valid JSON object. This allows more flexibility in consuming the data since you can stream the file 1 line at a time. At this time there's no way to change the output of bulk operation exports, but if you haven't already I recommend taking a look at our bulk operations tutorial which contains examples for parsing the data using different languages.

JB | Developer Support @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog