Skip to main content
Solved

Upload attachment to bill endpoint failes

  • February 24, 2021
  • 1 reply
  • 250 views

I'm trying to upload an attachment to the endpoint bill in Acumatica Rest API but gets the error
"Operation is not valid due to the current state of the object".
I’m using the RestService class from  the Wiki page and the same PutFile function.

Rs.PutFile("Bill", "bf73fde2-2a71-eb11-80bc-00155d79641e", "test.pdf", sr.BaseStream)
The same call for stockItem works but not for bill? Using the id as key.

Someone who has an idea :wink:

Best answer by junmao01

You need use Bill Type and Reference number as key instead of id.

Use the PUT method: https://mycompany.acumatica.com/entity/Default/20.200.001/Bill/Bill/50-0008442/files/Invoice1.pdf

Please note, the first Bill is the endpoint name, the second Bill is the “Bills and  Adjustments” Type and followed by the Reference Nbr.
 

1 reply

Forum|alt.badge.img
  • Varsity I
  • Answer
  • July 18, 2022

You need use Bill Type and Reference number as key instead of id.

Use the PUT method: https://mycompany.acumatica.com/entity/Default/20.200.001/Bill/Bill/50-0008442/files/Invoice1.pdf

Please note, the first Bill is the endpoint name, the second Bill is the “Bills and  Adjustments” Type and followed by the Reference Nbr.