How to get all fields of FulfillmentEvents in GraphQL

AshwiniSharma
Shopify Partner
15 0 0

Hi, in shopify

FulfillmentEvent 

https://shopify.dev/docs/admin-api/rest/reference/shipping-and-fulfillment/fulfillmentevent?api[vers... 

has a lot more attributes in REST Admin API vs
GraphQL API. 

https://shopify.dev/docs/admin-api/graphql/reference/object/fulfillmentevent?api[version]=2020-07#fi...

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)

0 Likes
Greg_Kujawa
Shopify Partner
1016 83 219

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.

0 Likes
AshwiniSharma
Shopify Partner
15 0 0

I am trying to use a Bulk Extract using Graph QL, so cost is not an issue here.

But I would like to extract all fields. 

0 Likes
Greg_Kujawa
Shopify Partner
1016 83 219

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....

0 Likes
AshwiniSharma
Shopify Partner
15 0 0

I did this introspection. 

here is the query to GraphQL

 

{
  __type(name: "FulfillmentEvent") {
    name,
    fields {
      name
      type {
        name
        kind
      }
    }
  }
}

 

 
The response is as follows: 

 

{
    "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)

https://shopify.dev/docs/admin-api/rest/reference/shipping-and-fulfillment/fulfillmentevent?api[vers...

So how do I get the attributes that are listed in REST Admin API. 

Thanks

Ashwini Sharma

 

 

 

0 Likes
Greg_Kujawa
Shopify Partner
1016 83 219

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. 

0 Likes
Kevin_A
Shopify Staff
Shopify Staff
253 32 45

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

0 Likes