I have tried everything to get the line items for an order using the associations request from the Admin API. Not sure if I’m going wrong or it doesn’t work.
{
„id“: „25d2bf073f08442daa036e9c06e29792“,
„associations“: {
„lineItems“: {},
„addresses“: {},
„transactions“: {}
},
„includes“: {
„order_line_item“: [„id“, „label“, „quantity“]
}
}
Also having trouble with this, did we get a solution in the end?
Not yet - literally spent a whole day on this - the API seemingly ignores the json request body - I get the same response and payload from the api/order endpoint irrespective of what I put in the request.
Eventually managed to get this to work - using a GET request on the Admin API you need to add any filter/association/include requests etc as an HTTP Query String directly to the URL.
I had been adding it as a JSON request. If you’re using Integromat HTTP modules - it doesn’t even seem to recognise the Query String Parameters - so just add straight to the URL.
So for example for this:
{
associations: {
lineItems: {
limit: 50
}
}
add this to the end of the URL:
?associations[lineItems][limit]=50
Even if you don’t want to ‚limit‘ or ‚filter‘ or ‚include‘ - you will not get the payload for associations unless you add some parameter - ie this on its own won’t work: ?associations[lineItems]