Skip to main content
Solved

Error in the API URL for SyncHistory Entity


To get the data from StockItem Entity - we have this one

 

const ACUMATICA_API_URL = `https://client.acumatica.com/entity/EndpointName/EndpointVersion/StockItem/${stockItemId}?$expand=RelatedItems`;

This works and I get these data.

 

And I got this new SyncDetails (or SyncHistory) entity:

 

I’ve tried this URL: 

https://client.acumatica.com/entity/EndpointName/EndpointVersion/SyncHistory

Best answer by andriitkachenko

Oh, it’s a GI, got it.

Did you try this request in Postman/Thunder Client?

I tried to create a similar endpoint and entity on one of my instances - I don’t have an integrated store to show any values, but the request seems to be working fine.

Does it respond with any error code?

For GIs, you don’t propagate Fields in the Top-Level entity, as it acts as a Filter. You create a Lower Tier Entity which then acts as an entity you want to get. Here’s the link from StackOverflow that explains it in more detail. Also you can take a look at this article at Acumatica Blog.

Alternatively, you might want to use OData and $filter instead. As far as I remember it provides easier access to GI data.

View original
Did this topic help you find an answer to your question?

Vignesh Ponnusamy
Acumatica Moderator
Forum|alt.badge.img+5

Hi @kyrenmearr,

From the screenshot and description, I assume SyncDetails is a sub entity of the SyncHistory and you are trying retrieve the sub entity.

In this case you can use expand to fetch the sub entity under a specific entity. For more details on expand parameter kindly refer, https://help.acumatica.com/Help?ScreenId=ShowWiki&pageid=b6c2fecd-0b2e-4aba-9bad-4c5050befe25 

If my assumptions isn’t right, kindly share more details and screenshots of the API endpoint setup, so we can check. Thanks,


Hi @Vignesh Ponnusamy - sorry! I renamed the SyncHistory to SyncDetails instead.

I thought that for better reflection of the problem, I created a new entity named “Kyren”

 

Trying to access that entity but it just doesn’t work like those I access with StockItem or SalesOrder

const ACUMATICA_API_URL = `https://pwrstoragesolutions.acumatica.com/entity/Four13Gadget/23.200.002/Kyren?$filter=ERPID eq 'UPS12-305PLP'`;

  const accessToken = await api.acumaticaAuth();

  try {
    logger.info('Access token:', accessToken); // Log the access token for debugging
    const response = await axios.put(ACUMATICA_API_URL, {
      headers: {
        'Authorization': `Bearer ${accessToken.access_token}`,
        'Accept': 'application/json',
        'Content-Type': 'application/json'
      },
      timeout: 30000
    });


    logger.info('Data fetched successfully from Acumatica', data);
    return response.data;

 

Also, when authenticating this is the scope of the access I have:


scope:"api api:concurrent_access email mobile:attachments:upload mobile:location:tracking mobile:push-notifications:registrations offline_access openid phone profile support_access"

 


andriitkachenko
Jr Varsity I
Forum|alt.badge.img+6

Hi @kyrenmearr 

I see from your code that you’re sending a PUT request. To retrieve data, you need the GET method.

You’re also trying to send an Authorization header. Do you have the OAuth 2.0 authorization flow set up? If not, you need to use a separate Login call to receive an authorization cookie.

You can see examples in the I310 course or in the wiki (at a smaller capacity).


You’re also trying to send an Authorization header. Do you have the OAuth 2.0 authorization flow set up? If not, you need to use a separate Login call to receive an authorization cookie.

 

Yes - there’s a different authorization flow set-up and it’s working.

 

I see from your code that you’re sending a PUT request. To retrieve data, you need the GET method.

 

It says in the ! info tooltip - “To retrieve data from the Inquiry form, use the Put method and pass the inquiry parameters in it.”

 


andriitkachenko
Jr Varsity I
Forum|alt.badge.img+6

Oh, it’s a GI, got it.

Did you try this request in Postman/Thunder Client?

I tried to create a similar endpoint and entity on one of my instances - I don’t have an integrated store to show any values, but the request seems to be working fine.

Does it respond with any error code?

For GIs, you don’t propagate Fields in the Top-Level entity, as it acts as a Filter. You create a Lower Tier Entity which then acts as an entity you want to get. Here’s the link from StackOverflow that explains it in more detail. Also you can take a look at this article at Acumatica Blog.

Alternatively, you might want to use OData and $filter instead. As far as I remember it provides easier access to GI data.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings