Skip to main content
Solved

Using GI's with REST API

  • Sep 22, 2021 5:17 PM UTC
  • 4 replies
  • 2159 views
  • Translate All

greglang
Varsity I
Forum|alt.badge.img+1

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

Best answer by stephenbologna39

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

 

 

View original

4 replies

xkylewrightx
Semi-Pro I
Forum|alt.badge.img+1

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

Translate

greglang
Varsity I
Forum|alt.badge.img+1
  • Author
  • Varsity I
  • Sep 22, 2021 9:05 PM UTC

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. 

 

 

 

Translate

Forum|alt.badge.img+2

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

 

 

Translate

greglang
Varsity I
Forum|alt.badge.img+1
  • Author
  • Varsity I
  • Sep 24, 2021 12:16 AM UTC

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

Translate