filter using Additional relations in API

DonyDony Member Posts: 17
edited July 2020 in Development

Hi,

I was just wondering if you we can filter the data on basis of additional relations which we provide in API url.

as an example, to get orders I am using this URL currently

"https://api.lightspeedapp.com/API/Account/{accountID}/Order.json?offset=0&complete=false&load_relations=["OrderLines","Note","Vendor","Shop","CustomFieldValues"]"

i will get some Orders with custom fields which and I want to filter the orders according to value of custom Field relation.


is it possible?

Post edited by Dony on

2 comments

  • gregaricangregarican Member Posts: 1,061 

    I'm not aware of query parameters that could also filter by load_relations subvalues. Usually I've found you can filter to a degree against the primary endpoint you are hitting, as you've observed. What I've discovered is that a lot of the time my API requests will pull too many records, and then it's up to me as the API consumer to iterate through the records and keep just those that I need to handle on my end. It's an expensive process given the API rate limit constraints, but it's reliable. That way I don't have to worry about trial and error of undocumented query parameters. I just pull to much and then filter once I get the result set back. Makes my solutions a little less scalable due to the API rate limits but also provides less gotchas :)

  • DonyDony Member Posts: 17

    That is the only we can do it in this. but it cost the performance of application where we are integrating.

Sign In or Register to comment.