zyrahjane
zyrahjane

Reputation: 379

Acumatica - Filter Generic Inquiry via REST

Trying to use this Generic Inquiry's REST API, I am able to retrieve all records though would like to filter them.

Can retrieve all data with PUT {{baseUrl}}/RawDataForReport?$expand=Result with an empty body request. Web endpoint result

When I added a field Period to filter it's only showing the first row.

web endpoint field to filter

enter image description here

An empty request body also shows the first row when I added Period.

I am not at all familiar Acumatica any useful resources would be greatly appreciated.

Upvotes: 0

Views: 1871

Answers (2)

Scott S
Scott S

Reputation: 31

I've been struggling to find a solution to the same problem.

I just figured it out with the help of this stack overflow post.

Acumatica run Generic Inquiry via REST API

Take a look at the last response (not the accepted answer).

Basically when you define your object in the Web Service Endpoint screen, you can define the filters (Use Populate -> Filters). these are the Parameters for the GI.

You define the results the same as you have it.

Then in your PUT request body pass the parameters. Example: { "Param1": { "Value": "Value1" }, "Param2": { "Value": "Value2" }

I just tested this with Postman, and it works well.

Upvotes: 0

Dmitrii Naumov
Dmitrii Naumov

Reputation: 1712

To filter the Generic Inquiry result with REST API you need to add the filtering parameter to the GI itself. For instancce, you have your period filter defined in the Generic Inquiry. You can define more filters the same way.

You can learn about designing GIs here: https://openuni.acumatica.com/courses/reporting/s130-inquiries-reports-and-dashboards/

Another option would be to use OData instead of REST API. in that case you would be able to use $filter parameter to filter data.

You can read more about it here:

https://help-2020r2.acumatica.com/Help?ScreenId=ShowWiki&pageid=36beb9aa-f04d-4f63-a93b-a00b1c315be0

https://help-2020r2.acumatica.com/Help?ScreenId=ShowWiki&pageid=5d97a93d-45e0-466e-ba5e-77e1ccf96643

Upvotes: 1

Related Questions