Solved

Using GI's with REST API

  • 22 September 2021
  • 4 replies
  • 338 views

Userlevel 3
Badge

I have extended a Web service End Point to include the results using instructions from https://www.acumatica.com/blog/contract-based-apis-in-generic-inquiries/. and Am using a GI as a data source with Celigo (integrator.io)

 

The problem I’m running into is it breaks down the GI into pages and with my  $Skip formula to chunk the data into pages. I think its because all the data is in the Detail item “Result” and it sees everything as 1 big record.  I think this because to read the results correctly I had to point the resource path to “Result”  

 

I’m at a loss here on how to fix the issue but I’m not an expert so maybe someone here has dealt with this and can help!

 

Thanks in advance,

 

Greg

icon

Best answer by stephenbologna39 23 September 2021, 04:09

View original

4 replies

Userlevel 3
Badge

Not an expert at all either so could be misunderstanding, but what do you mean by pages? Is that a Celigo ‘thing’? The API returns a JSON object, how this is interpreted by Celigo integrator might be up to them more than how the generic inquiry is configured. 

Maybe take a screenshot of your GI, if possible your HTTP request (that I assume integrator is generating), and the resulting response and we can take a look further!! 

 

Kyle

Userlevel 3
Badge

Thanks @xkylewrightx

 

What I was trying to say is I don’t think you can use Skip outside of the top level but maybe I’m just doing it wrong.

 

here is how I’m using it

"relativeURI": "/Echo_AptLookup?$expand=Result{{#compare export.http.paging.skip \"!=\" \"0\"}}&$skip={{{export.http.paging.skip}}}{{/compare}}",

Attached is a screenshot of the JSON from Postman and Celigo as well as a screenshot of the endpoint. 

 

 

 

Userlevel 3
Badge

Hi @greglang 

 

If you’re looking to pull data out of Acumatica from a Generic Inquiry, I would recommend using an OData feed rather than wiring the GI into your Web Services Endpoint.

To do this, you would only need to go to the Generic Inquiry and select ‘Expose via OData’:

 

 

From here, you can call your OData feed with the following URL template:

<BaseUrl>/OData/<TenantName>/<InquiryTitle>

 

For authentication, you can use Basic Authentication (ie username / password of existing Acumatica user).  I don’t think calling the Web Services API signin method works for OData feeds, but I know that bearer tokens do.

The advantages of this approach are:

  • It is usually (imho) simpler to call an OData feed to pull data out of Acumatica than it is to use the WS API
  • The data gets returned in a simpler structure than the WS API
  • You will find that URL params like $skip, $top, etc work the way it sounds like you need them to

 

 

Userlevel 3
Badge

@stephenbologna39 Thanks for taking time to explain! that was a good workaround and seems to run faster anyway. 

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2022  Acumatica, Inc. All rights reserved