How to Download PO PDF attachement using REST API

How to Download PO PDF attachement using REST API

How to download PO-PDF Attachment for Purchase Order using REST API.

In this section, we will see how to get PO-PDF attachment for Purchase order using REST API.

Let us consider below PO with PO Number as 100099.

A screenshot of a computer

AI-generated content may be incorrect.

Click on View PDF button to download PO PDF file.

A screenshot of a purchase order

AI-generated content may be incorrect.

Now to get this PDF document using REST API, we need to get DOCID which can be derived using below SQL query. We can pass PO Number to this SQL query to get DOCID.

select 
  

  PHA.SEGMENT1 PO_NUMBER,
  

  FAD.DOCUMENT_ID,
  

  FAD.CATEGORY_NAME,
  

  FDT.DM_VERSION_NUMBER DOCID,
  

  FDT.DM_DOCUMENT_ID,
  

  FDT.FILE_NAME,
  

  FDT.DM_TYPE,
  

  FDT.DESCRIPTION
  

   from FND_ATTACHED_DOCUMENTS FAD,
  

  PO_HEADERS_ALL PHA,
  

  FND_DOCUMENTS_TL FDT
  
where FAD.ENTITY_NAME='PO_DOC_PDF'
  
and FAD.PK1_VALUE=TO_CHAR(PHA.PO_HEADER_ID)
  
and FDT.DOCUMENT_ID=FAD.DOCUMENT_ID
and PHA.SEGMENT1='100099';
A computer screen with a white screen

AI-generated content may be incorrect.

Here we will get DOCID (726596).

We need this DOCID for calling REST API.

REST API:

Endpoint URL:

/fscmRestApi/resources/11.13.18.05/erpintegrations?finder=DocumentRF;docId=726596

Here we need to pass DOCID which we received from SQL query.

Method: GET

Let us decode base 64 responses.

A screenshot of a computer

AI-generated content may be incorrect.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top