How to get all fields of FulfillmentEvents in GraphQL

AshwiniSharma
Shopify Partner
16 0 1

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)

Replies 7 (7)
Greg_Kujawa
Shopify Partner
1020 83 262

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.

AshwiniSharma
Shopify Partner
16 0 1

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. 

Greg_Kujawa
Shopify Partner
1020 83 262

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

AshwiniSharma
Shopify Partner
16 0 1

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

 

 

 

Greg_Kujawa
Shopify Partner
1020 83 262

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. 

Kevin_A
Shopify Staff
Shopify Staff
318 42 60

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 | Solutions Engineer @ 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

YuTomori
Tourist
14 0 2

Did you find the way to fetch FulfillmentEvents by bulk operation?

I tried it by the query below.

mutation {
  bulkOperationRunQuery(
    query: """
    {
      orders {
        edges {
          node {
            id
            fulfillments {
              events {
                edges {
                   node {
                     happenedAt
                     id
                     status
                   }
                }
              }
            }
          }
        }
      }
    }
    """
  ) {
    bulkOperation {
      id
      status
      url
    }
    userErrors {
      field
      message
    }
  }
}

but got the error response.

"userErrors": [
    {
        "field": [
            "query"
        ],
        "message": "Queries that contain a connection field within a list field are not currently supported."
    }
]

 

How I can solve it ?