The API for requesting order information includes a “fields” parameter where one can specify fields of interest. Extra, unneeded data doesn’t come over the wire. Great! If one of the fields I’m interested in is line_items, is there a way to specify which fields of each line_item I want?
This request will still give me a bunch of data that I don't care about via the line_items:
I just need the ‘name’ field for each line item.
I am also looking for the solution for this. Not sure if Shopify has added this feature which I feel really a good feature.
Hope they will add it soon if not already done. Please confirm how can we access the nested field if already done.
Thnks & regards,
I've found when working with most API providers...it's better to get too much data than too little. :) Sometimes there can be a lack of API endpoint properties, or a litany of nested relational fields that have to be queried.
So in those cases you either can't retrieve the data, or else have to make several iterative calls to retrieve the data you are looking for. While I get it, in that you have to parse through the response sets and ignore a lot of fields that you don't need or care about. But it's far better than the alternative. And at least we can issue REST API queries with filter criteria. Some API providers lack enough of this functionality. So besides unnecessary fields in the responses, you have to discard entire records that aren't what you're looking for!
I typically agree with everything you are saying.
I won't speak for anyone else but the main reason I'd like to see this is due to memory consumption issues at scale.
While working on hosted application platforms like heroku you are often memory constrained. And while it's nice to have all the data for testing purposes it's create a memory problem when you are trying to import 250 orders at a time and the line_items array of objects is massive.
It's caused us to lower this to retrieving 100 orders at a time which of course means more API call in general but other than beefing up our own dynos (cost prohibitive for some) there's really not an option.