Order and OrderProduct rate limit issues

in Development
Hello,
Is there a way to get an Order and its associated OrderProduct(s) in a single call?
The problem we are having is that we pull a list of orders from the Order checkpoint (250 max per request) and then to get the OrderProduct(s) for each of those orders, we have to make a request to the OrderProduct endpoint for every single order. This very quickly exceeds the 300 per 5 min and 20 per sec request rate limits and becomes a non-workable solution.
Is there any way we can optimize this to use less requests? Even if we could get a list of all OrderProducts that would be helpful.
Thanks.
8 comments
Doesn't E-Com have webhooks you can use?
I'm not sure. Hoping to get it working through regular API requests.
It does offer webhooks. See here --> https://developers.lightspeedhq.com/ecom/tutorials/webhooks/ for details. Using these will help avoid hitting the API with requests. Unless you are performing a large initial sync.
We are a group of end-users of Lightspeed that want to collect some information in a spreadsheet via the API. I don't think webhooks is the right solution for us but thanks for the suggestion.
I would also recommend using webhooks, but if that's not the right solution for you, then getting the information from OrderProduct is the way to go.
Thanks for the advice @Ali_Masoumie could you also comment on the original question? Looking for a way to optimize API calls to reduce total number of calls.
Please consider using webhooks.
If you, for example, set up an 'orders/created' webhook, you will get a webhook with all the needed information as soon as an order is created.
You can test this out by creating a webhook and point it to https://webhook.site/
By using webhooks, you do not have to make any calls yourself to get the data.
Thanks @Ali_Masoumie . Again this is for a group of Lightspeed end-users, not a group of 3rd party software developers, so implementing a webhook is probably not the right choice. If there is no way to optimize our API calls then we will work within those limits.