Solved

Add Files to Salesorder line item using REST API

  • 8 March 2022
  • 9 replies
  • 628 views

Userlevel 7
Badge +11

Hello Everyone,

Am trying to add Sales Order line item Image using the REST API.

Tried like below but it's not working. (Checked with LineNbr and the InventoryID)

[AcumaticaBaseUrl]/entity/Default/20.200.001/SalesOrder/[OrderType]/[OrderNbr]/[LineNbr]/files/[Desired filename in Acumatica]

 

Referred the below links.
acumatica - Add Files to Salesorder line item - Stack Overflow
Attach Files with Rest API - Acumatica Developers Blog . .

Can anyone please assist here?

icon

Best answer by Evgeny Afanasiev 17 April 2023, 10:05

View original

9 replies

Userlevel 4
Badge

Hi @jinin 
There is an issue with number of key fields specified in the URL. For Sales Order, we need to pass OrderType and OrderNbr. “1” passed after the OrderNbr in URL would be causing the issue.

You can try this request and it should attach the image to the Sales Order:
{{BaseUrl}}/entity/Default/20.200.001/SalesOrder/SO/SO006480/Files/Test.jpg

Userlevel 7
Badge +11

Hi @ruchikasharma23 

I want to add the files in Sales order Line details(Details tab). Not for the Sales Order.
 

 

Userlevel 4
Badge

Hi @jinin 
At present, it is not possible to attach files to detail lines with REST API.
However, you can do so using screen based web service API.

Userlevel 7
Badge +11

Hi @ruchikasharma23,


In the latest Acumatica version, SOAP API is not recommended to use, and also it is stopped support from version 21R2.

Am looking for a solution with REST API

Userlevel 3
Badge +2

I think there might be a bit of confusion here, let me try to clarify it.

While it is true that support for SOAP is going away this is only valid for the Contract Based Web Services which means that the latest version of the Default endpoint (Version 20.200.001) does not have any SOAP support as well as any future endpoint.

But the 2 previous version that are still provided out of the box at this moment 17.200.001 and 18.200.001 do still support SOAP.

 

This does not apply for the Screen Based Web Service as it is only SOAP and is remaining that way for now.

 

Unfortunately for now the possibility does not exist yet in REST to attach a file to a detail item.

Unless you were to create a screen that would display the detail item as a top level item using all of its key field in a form format.

 

In the reference that you link in your question you might see that while it is able to do the request like you are trying to they do mention having to create a new screen that uses the DAC SOLine as a primary DAC.

Userlevel 7
Badge +11

Hi @SLavigueur 

Thank you for your reply.

I will try with the alternate approach to create a new screen that uses the DAC SOLine as a primary DAC.

.

Userlevel 6
Badge +3

@jinin

We have faced similar problem,As @SLavigueur  mentioned  we have used this workaround approach and it worked.
 

Userlevel 7
Badge +11

Hi @praveenpo  Thanks for the response.

Yes, we tried this approach and it is working for us.
 

@SLavigueur  Thank you!!

Userlevel 3
Badge

Hi @jinin,

It looks like this post requires an update.
Since the System Contract 4 (Default endpoints 20.200.001 and 22.200.001) it is possible to attach the files to the document details. Here is a documentation: https://help.acumatica.com/(W(6))/Help?ScreenId=ShowWiki&pageid=591def3d-5fe5-42c1-bb35-cfe5b4c77f6f

If you make the GET call like this:
{{sitename}}/entity/Default/22.200.001/SalesOrder/{{Type}}/{{OrderNbr}}?$expand=Details

In response you will get following node:

"_links": {

                    "files:put""
/{{SitePath}}/entity/Default/20.200.001/files/PX.Objects.SO.SOOrderEntry/Transactions/2bc54f8e-75f0-4a75-b850-4931565b168d/{filename}"


Following PUT request and the link in "files:put" would attach the file to the detail record:
{{sitename}}/entity/Default/20.200.001/files/PX.Objects.SO.SOOrderEntry/Transactions/2bc54f8e-75f0-4a75-b850-4931565b168d/MyFile.png

As before, the content of the file should be passed as binary in the body of the request.

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 — 2024  Acumatica, Inc. All rights reserved