Have your say in Community Polls: What was/is your greatest motivation to start your own business?
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.

Order shipping_line/s value type not matching between REST and GraphQL

Solved

Order shipping_line/s value type not matching between REST and GraphQL

spriteNOice
Tourist
6 0 1

Why is shipping_lines in REST api an object array but only an object in GraphQL? Is it expected to have only one per order? If so, why an array in REST? Thanks!

https://shopify.dev/docs/admin-api/rest/reference/orders/order?api[version]=2020-07

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

Accepted Solution (1)

Kevin_A
Shopify Staff
318 42 61

This is an accepted solution.

Hey @spriteNOice 

In GraphQL, the shippingLine object will return null in cases where there are more than 1. In version 2020-10, graphQL will introduce a shippingLines connection that will return a collection of all shippingLines. You can check that out here.

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

View solution in original post

Reply 1 (1)

Kevin_A
Shopify Staff
318 42 61

This is an accepted solution.

Hey @spriteNOice 

In GraphQL, the shippingLine object will return null in cases where there are more than 1. In version 2020-10, graphQL will introduce a shippingLines connection that will return a collection of all shippingLines. You can check that out here.

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