cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Need help Updating PDF content through CPI

das_sappo
Participant
0 Kudos
529

Dear Experts,

I am receiving the PDF file in base64 encoded format in CPI and I need to update that through the below API but I am bit confused as how to send the PDF content . Only below information is available in the API specification . Could you please suggest how can I perform PUT operation for updating the PDF content.

I am able to update perfectly from POSTMAN, unable to replicate the same in CPI. Please suggest how can I pass file

das_sappo_0-1732636673292.png

das_sappo_0-1732639309076.png

 

 

 

 

 

View Entire Topic
sivaramaraju_danthuluri
Product and Topic Expert
Product and Topic Expert
0 Kudos
das_sappo
Participant
0 Kudos

I am now able to update the document in Ariba but the PDF is not opening there . It seems the decoded PDF is breaking in CPI.

Step- 1 : Getting base64 encoded PDF

Step-2: Decoding via standard Decoder

Step-3: Forming Request Body with the following Groovy before PUT call

def Message processData(Message message) {
def body = message.getBody(String);
body = body.replaceAll("\n", "\r\n");
def multipartBody = """--cpi\rContent-Disposition: form-data; name="file"; filename="DOC_T_V3.pdf"\r\nContent-Type: application/pdf\r\n\r\n""" + body + """\r\n\r\n--cpi--""";
message.setBody(multipartBody);
return message;
}

Please suggest what is missing here.