Skip to main content
Question

REST-API embedded pdf file


Forum|alt.badge.img+5

I have pdf document embedded in XML file for EDI orders.

I want to create document based on embedded file and attach document to order.

We are using 23R2,  must be handled through REST-API

9 replies

Mathias Dahl
Superhero (Employee)
Forum|alt.badge.img+32
  • Superhero (Employee)
  • 2875 replies
  • June 7, 2024

Hi,

You need to tell us more about the use case for us to understand what can be done. Where is the XML/EDI/PDF? What tools/languages/platforms/libraries do you have available to pull this off? What is the trigger point for what to do? How large are those files? How often should this be done? Why does it have to be handled via a REST API? Who calls that, and when? Where is the REST API? What competences do you have? Etc.

 


Forum|alt.badge.img+5
  • Author
  • Do Gooder (Customer)
  • 9 replies
  • June 7, 2024

We receive XML file with Order info and Customers Purchase Order (PDF ) embedded in XML file.

We use software called Lobster to pick up and convert XML into to IFS standard message to create incoming customer order. But we would like to get embedded PDF from XML and make attachment to incoming customer order.
File is not that big, approx 50Kb

This process should run frequently, m 2-300 times / day.


Doesn't need to be REST-API, thought that REST-API is interface to use in 23R2.
I think we have good knowledge in integrations and REST-API


Mathias Dahl
Superhero (Employee)
Forum|alt.badge.img+32
  • Superhero (Employee)
  • 2875 replies
  • June 7, 2024

Extracting the PDF from the XML is something you need to figure out. I assume it's either stored Base64 encoded or as a CDATA tag with binary data. Once you have the PDF as a byte array/stream of bytes, we have many REST APIs that can be used to upload that as a file in Docman. I would recommend you first try with our Premium API CreateAndImportDocument.

Good luck!
 


Forum|alt.badge.img+5
  • Author
  • Do Gooder (Customer)
  • 9 replies
  • June 10, 2024

Thanks for you help.

I tried to use CreateAndImportDocument, but I get error message.

Error while uploading the file. Detail: Failed to set the file information. ORA-20115: EdmFile.The \"EDM File\" has already been removed by another user.

Document revision exists in Docman.

 



 

 


Mathias Dahl
Superhero (Employee)
Forum|alt.badge.img+32
  • Superhero (Employee)
  • 2875 replies
  • June 10, 2024

That projection is for creating new document, you cannot use it to upload a file to an existing document revision. Also, the If-Match header doesn't look right, it should say "Etag here", as I remember it (but please check the details in the API docs). The file name should be Base64 URL encoded and it looks light you might have done that.

 


Forum|alt.badge.img+5
  • Author
  • Do Gooder (Customer)
  • 9 replies
  • June 10, 2024

Mathias Dahl
Superhero (Employee)
Forum|alt.badge.img+32
  • Superhero (Employee)
  • 2875 replies
  • June 10, 2024

Ah, you are right. You can use that entityset to upload a file if you make sure the file reference exists. Does it? Also, which value did you use for the if-match header?


Forum|alt.badge.img+5
  • Author
  • Do Gooder (Customer)
  • 9 replies
  • June 11, 2024

I use Etag and * for If-match

 

Is it possible to send PDF file as base 64 encoded to REST-API, if so can you send which REST-API I should use?

 

Thanks.

 


Mathias Dahl
Superhero (Employee)
Forum|alt.badge.img+32
  • Superhero (Employee)
  • 2875 replies
  • July 31, 2024
ROXTOBANE wrote:

Is it possible to send PDF file as base 64 encoded to REST-API, if so can you send which REST-API I should use?
 

There might be REST APIs that accepts the file content as a Base64 encoded string, but it's hard to find such an API. There is no general capability of the platform that makes that possible in all APIs that accepts files to be uploaded. Unless someone else replies here, you are on your own there. It might be possible to add an option in our CreateAndImportDocument API for handling this. If this sounds useful I suggest you file an idea in the Ideas section here on IFS Community.


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