RE: REST API invoice record filtering
According to the metadata catalog / swagger:
services/rest/record/v1/metadata-catalog/invoice
It should be possible to filter on the "status" column.
The statuses of our test invoices are:
["Paid In Full", "Open", "Pending Approval", "Rejected"]
But when we try to filter we don't receive any records:
I, [2020-06-25T10:53:48.403779 #50187] INFO -- : get https://xxx-sb1.suitetalk.api.netsuite.com/services/rest/record/v1/invoice?q=status+IS+Open
D, [2020-06-25T10:53:48.406444 #50187] DEBUG -- : [httplog] Sending: GET https://xxx-sb1.suitetalk.api.netsuite.com/services/rest/record/v1/invoice?q=status+IS+Open
D, [2020-06-25T10:53:48.406680 #50187] DEBUG -- : [httplog] Data:
ETHON: performed EASY effective_url=https://xxx-sb1.suitetalk.api.netsuite.com/services/rest/record/v1/invoice?q=status+IS+Open response_code=200 return_code=ok total_time=0.439834
D, [2020-06-25T10:53:48.848226 #50187] DEBUG -- : [httplog] Status: 0
D, [2020-06-25T10:53:48.848439 #50187] DEBUG -- : [httplog] Benchmark: 0.441168 seconds
D, [2020-06-25T10:53:48.848654 #50187] DEBUG -- : [httplog] Response: (not showing binary data)
I, [2020-06-25T10:53:48.848881 #50187] INFO -- Status: 200
=> "{\"links\":[{\"rel\":\"self\",\"href\":\"https://xxx-sb1.suitetalk.api.netsuite.com/services/rest/record/v1/invoice?limit=1000&offset=0\"}],\"count\":0,\"hasMore\":false,\"items\":[],\"offset\":0,\"totalResults\":0}\n"
Is this broken?
Its badly documented and has surprisingly bad metadata. The values for the query should match Transaction Statuses for SuiteScript Search Filters.
Dear battk,
Thanks again.
Is it also possible to filter invoices by subsidiary? Is it possible to filter records by a subrecord/relation?
Something like this:
GET https://xxx-sb1.suitetalk.api.netsuite.com/services/rest/record/v1/invoice?q=subsidiary+IS+34&offset=0&limit=1000 response_code=400 return_code=ok total_time=0.38531899999999997
OAuth2::Error: {“type”:”https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1″,”title”:”Invalid search query Field ‘subsidiary’ for record ‘transaction’ was not found. Reason: NOT_EXPOSED – Field is marked as internal for channel SEARCH.”,”status”:400,”o:errorCode”:”INVALID_PARAMETER”}
I also tried with SuiteQL. No luck 🙁
https://netsuiteprofessionals.com/question/suiteql-rest-api-filter-invoices-by-subsidiary/
Battk,
When doing the same with SuiteQL no records are returned. Any idea why?
POST https://xxx-sb1.suitetalk.api.netsuite.com/services/rest/query/v1/suiteql?limit=1000&offset=0
Data: {“q”:”SELECT id FROM transaction WHERE status = ‘CustInvc:A'”}
{“links”=> [{“rel”=>”self”, “href”=>”https://xxx-sb1.suitetalk.api.netsuite.com/services/rest/query/v1/suiteql?limit=1000&offset=0”}], “count”=>0, “hasMore”=>false, “items”=>[], “offset”=>0, “totalResults”=>0}