Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Graphiql - basic problem - where's the json?

Graphiql - basic problem - where's the json?

hookbeak
Shopify Partner
15 1 6

I'm struggling to get to grips with graphiql - but breaking down all of my issues one by one....

 

i've run a query in the graphiql app to grab all my products and it's given me a result of :

 

--------------------------------------------------------------------------------------------------------------

{
"data": {
"bulkOperationRunQuery": {
"bulkOperation": {
"id": "gid://shopify/BulkOperation/1234567890",
"status": "CREATED"
},
"userErrors": []
}
},
"extensions": {
"cost": {
"requestedQueryCost": 10,
"actualQueryCost": 10,
"throttleStatus": {
"maximumAvailable": 1000,
"currentlyAvailable": 990,
"restoreRate": 50
}
}
}
}

--------------------------------------------------------------------------------------------------------------

 

so as far as i understand me running this query has created a json file *somewhere* -most likely i think indicated by this:

 

"id": "gid://shopify/BulkOperation/1234567890",

But how do i access this json? this isn't an endpoint i can grab the json from. Am i missing something fundamental here?

Reply 1 (1)

Alan
Shopify Staff
129 15 25

Hey @hookbeak - definitely understand where you're coming from here, setting up these bulk operations can be a little tricky at first for sure. From what I can see based on the response body you shared, your Bulk Operation query mutation ran successfully, so that's good news!

 

You are totally correct that it will create a JSONL file containing the relevant information your Bulk Operation surfaced - you'll just need to run another query in order to retrieve it. This is generally done by setting up a webhook subscription for the "BULK_OPERATIONS_FINISH" topic, which will send you a webhook once the operation has been completed with a link to that JSONL file. 

However, if this is your most recent or only Bulk Operations Query, you can also surface the URL to the JSONL file directly in your API Client using this GraphQL query:

query {
  currentBulkOperation {
    id
    status
    errorCode
    createdAt
    completedAt
    objectCount
    fileSize
    url
    partialDataUrl
  }
}

 

Our documentation on getting starting with Bulk Operations goes over this in more detail, but let us know if we can clarify anything on our end. Happy to dig into this more with you if need be!

 

Cheers, 

Alan | API 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