Missing fields - How can i get name, order_status_url, order_number in Order using GraphQL?

RavindraPatel
Shopify Partner
29 1 5

Hello Guys,

I am trying to get an order using GraphQL but couldn't get name, order_status_url, order_number, discount_codes, source_name ... and many more fields.

But on REST API i get all the above fields.


Is there any way to get all fields using GraphQL which available on REST API?

Replies 5 (5)

BStubbs
Shopify Partner
136 16 62

with GraphQL you have to specify the fields you want to get, so if you want those fields, you have to ask for them. Keep in mind some of them will be in other objects, like customer name will be in the Customer object etc.

Was this helpful? Press like!
Did it fix the problem? Mark it as the solution for others!
Buy me a beer? Well, sure!
RavindraPatel
Shopify Partner
29 1 5

@BStubbs 

You are right for specify fields in query but i didn’t get any fields mentioned in question and also not found in any object for order.

Thank you for your response.

BStubbs
Shopify Partner
136 16 62

What is the error message you get?

Was this helpful? Press like!
Did it fix the problem? Mark it as the solution for others!
Buy me a beer? Well, sure!
RavindraPatel
Shopify Partner
29 1 5

@BStubbs 

As per Shopify GraphQL Order Object missing several fields like name, order_status_url, order_number compare to REST API Order Object

so when i do query with above fields i get this error.

Field 'order_status_url' doesn't exist on type 'Order'


So the question was about How i get that missing fields on GraphQL Order Object.

 
BStubbs
Shopify Partner
136 16 62

You need to check the GraphQL docs. It's a completely different API, not just a different language. 

The error you are getting tells you the problem, 'order_status_url' isn't available on GraphQL. You need to use REST API for that.

The available fields for GraphQL can be found here: https://shopify.dev/docs/admin-api/graphql/reference/orders/order?api%5Bversion%5D=2021-01#fields-20...

 

Was this helpful? Press like!
Did it fix the problem? Mark it as the solution for others!
Buy me a beer? Well, sure!