Skip to main content
Solved

REST API Assistance


Forum|alt.badge.img+3

Have been trying to retrieve the data from the Details tab of the Sales Orders(SO301000) screen using the below link with GET request and have been getting the attached screenshot in the response. The requirement is to retrieve the data from the Details tab for all the Sales Orders.

 

URL: /entity/Default/20.200.001/SalesOrderDetails?$expand=Details

 


Kindly let me know how shall I get the list in the Response.

Thank you in advance

Best answer by RohitRattan88

Hello @Harshita as @vigneshponnusamy89 suggested, make sure you $expand on Details but still use SalesOrder endpoint.

Make sure you do login call before trying to work with REST APIs though.

Here’s and example:

Then you can call the SalesOrder GET :

 

Please refer to I310 for additional details:

I310 Data Retrieval with REST API Basics 2022 R2 (acumatica.com)

Hopefully it helps.

Rohit

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

10 replies

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

Hi @Harshita

In the request you need to target the top level entity, and then expand the detail entity. The request URL should be like below,

  • <<Instance URL>>/entity/Default/20.200.001/SalesOrder?$expand=Details

 

To to a filter record based on a field you can use the filter like below,

 

  • /entity/Default/20.200.001/SalesOrder?$filter=OrderNbr eq 'SO006883'&$expand=Details

For more details on the using parameters in the request refer,

Thanks,


Forum|alt.badge.img+3
  • Author
  • Captain II
  • 317 replies
  • April 14, 2023

Thank you @vigneshponnusamy89 for your prompt reply. I did check out with the below mentioned url, but still it lists out the same response. 

  • <<Instance URL>>/entity/Default/20.200.001/SalesOrder?$expand=Details

I would like to retrieve the data based on the following example:
If there are two Sales Orders with IDs SO-001 and SO-002, and each Sales Order has two Line Items, then the API should return a list of four Line Items, which would be the two Line Items associated with SO-001 and the two Line Items associated with SO-002.


RohitRattan88
Acumatica Moderator
Forum|alt.badge.img+4
  • Acumatica Moderator
  • 248 replies
  • Answer
  • April 14, 2023

Hello @Harshita as @vigneshponnusamy89 suggested, make sure you $expand on Details but still use SalesOrder endpoint.

Make sure you do login call before trying to work with REST APIs though.

Here’s and example:

Then you can call the SalesOrder GET :

 

Please refer to I310 for additional details:

I310 Data Retrieval with REST API Basics 2022 R2 (acumatica.com)

Hopefully it helps.

Rohit


Forum|alt.badge.img+3
  • Author
  • Captain II
  • 317 replies
  • April 15, 2023

Thank you @RohitRattan88 for the solution. It worked now. The main issue I was facing was related to the value for Accept & Content Type keys under the Headers section. The values are required to be set to application/json.


Forum|alt.badge.img+3
  • Author
  • Captain II
  • 317 replies
  • April 17, 2023

Hello @vigneshponnusamy89 & @RohitRattan88 
Similarly I have been trying to update the status of the Sales Orders to “Completed” by using a PUT request with the below mentioned URL and request body:

URL: /entity/Default/20.200.001/SOOrder and also tried with /entity/Default/20.200.001/SalesOrder

Request Body: "Status": { "value" : "Completed"}.

But the status isn’t getting updated.

Can you please guide me out in the same?

Thank you in advance.


RohitRattan88
Acumatica Moderator
Forum|alt.badge.img+4
  • Acumatica Moderator
  • 248 replies
  • April 17, 2023

Hello @Harshita,
Completing a Sales Order is an "Action" to be performed which can be done using POST call.
Please refer to I330(I330 Data Manipulation with REST API 2022 R2 (acumatica.com)) for respective documentation.
Rohit


Forum|alt.badge.img+3
  • Author
  • Captain II
  • 317 replies
  • April 17, 2023

Hello Rohit,

I have defined a new Action that is required to be performed as shown below and did try to run a POST request, but still triggering the error 415-Unsupported Media Type

 

URL : /entity/CustomL/20.200.002/SalesOrder/Completed

Kindly let me know what I am missing here.

 

Thank you.


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

@Harshita, Please ensure you have the request body type set to JSON,

 

 


RohitRattan88
Acumatica Moderator
Forum|alt.badge.img+4
  • Acumatica Moderator
  • 248 replies
  • April 17, 2023

@Harshita also make sure you have correct Headers set for the call:

 


Forum|alt.badge.img+3
  • Author
  • Captain II
  • 317 replies
  • April 18, 2023

Thank you @RohitRattan88  for listing out the Header point. I checked out by modifying the Headers and as @vigneshponnusamy89 had mentioned, to set the body type to JSON. I ran the POST request, and looks like it is working now.

But since the button is disabled, the action wont work. But still need to confirm on this if still it could work or not.

 


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