Hi, in shopify
FulfillmentEvent
has a lot more attributes in REST Admin API vs
GraphQL API.
How can i get the other fields (present in REST API) using GraphQL?
Also is there a way to Extract all Fulfillments (and FulfillmentEvents) using GraphQL Bulk API.
Usecase scenario: I am trying to extract all Orders (OrderLineItems, Fulfillments, FulfillmentEvents)
Because GraphQL requests have associated cost, the API consumer must specify which specific field(s) they want to retrieve in the response --> https://shopify.dev/concepts/graphql/queries. So if you need a whole long list of fields from an endpoint then these must be individually specified. There isn't a wildcard that I'm aware of.
By it's very nature GraphQL requires explicitly field identification. In other words, you can't just issue a * wildcard to say "I'd like all the fields." Unless the particular GraphQL implementation supports introspection (https://graphql.org/learn/introspection/). Which I doubt that Shopify does....
I did this introspection.
here is the query to GraphQL
{
__type(name: "FulfillmentEvent") {
name,
fields {
name
type {
name
kind
}
}
}
}
{
"data": {
"__type": {
"name": "FulfillmentEvent",
"fields": [
{
"name": "happenedAt",
"type": {
"name": null,
"kind": "NON_NULL"
}
},
{
"name": "id",
"type": {
"name": null,
"kind": "NON_NULL"
}
},
{
"name": "status",
"type": {
"name": null,
"kind": "NON_NULL"
}
}
]
}
},
"extensions": {
"cost": {
"requestedQueryCost": 3,
"actualQueryCost": 3,
"throttleStatus": {
"maximumAvailable": 1000.0,
"currentlyAvailable": 997,
"restoreRate": 50.0
}
}
}
}
As you see, GraphQL lists only 3 fields (happenedAt, id, and status).
The same object returns a lot more fields from REST Admin API (as can be seen in the link below)
So how do I get the attributes that are listed in REST Admin API.
Thanks
Ashwini Sharma
That's fantastic news the the Shopify GraphQL implementation supports introspection. So that knocks out what you were looking for. As for their REST API, by default all exposed property fields are returned in the REST API response body. Anything that's listed as being visible per the API docs will appear in there.
Hey @AshwiniSharma
Most if not all of the data should be present in the graphQL API but will likely be under different connections. I suggest you take a look at the fulfillment object documentation and take a look at the various data provided under the 3 different connections.
Kevin_A | 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
User | Count |
---|---|
15 | |
8 | |
8 | |
8 | |
6 |