Filter Invoices by Customer (Entity) on REST API
Hi all,
I am using the NetSuite REST API Tutorial. I can successfully GET specific invoice IDs (e.g. {{REST_SERVICES}}/record/v1/invoice/<invoice.id>?expandSubResources=true
My next step is to GET all invoices for a specific customer. Looking at the schema, plus the response from the individual invoice, it looks like i should be filtering by entity.
https://www.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2016_1/schema/record/invoice.html
"entity": {"links": [{"rel": "self","href": "https://<account.id>.suitetalk.api.netsuite.com/services/rest/record/v1/customer/<customer.id>"}],"id": "<customer.id>","refName": "<customer.name>"},
However, I cannot seem to get this to work.
I am using EQUAL in the q for entity, entityId, entity.ID and the like on the get request, but no love. Also tried CONTAIN (incase it is a string, unlikely) – as from https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_1545222128.html
Anyone got a quick pointer on how this can work? I feel like this should be simple but unfortunately stuck in the weeds now.
ex: GET {{REST_SERVICES}}/record/v1/invoice?q=entity EQUAL ‘<customer.id>’
response
{"type": "https://www.rfc-editor.org/rfc/rfc9110.html#section-15.5.1","title": "Bad Request","status": 400,"o:errorDetails": [{"detail": "Invalid search query. Provide a valid search query.","o:errorQueryParam": "q","o:errorCode": "INVALID_PARAMETER"}]}
I think you might want ANY_OF or IS as the filter operator.
Thanks,
Chris




mooseymoose
FYI, that SRB browser gets updated occasionally with new releases https://www.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2023_2/schema/record/invoice.html. I’ve fallen into the trap of not using a new one and things have changed, not sure whether that applies to the schema or not. Also, I prefer this one https://<accountid>.app.netsuite.com/app/recordscatalog/rcbrowser.nl