Friday, June 16, 2023

OIC - How to call "upload as attachement REST integration" from another integration in Oracle Integration

Usecase: In my previous blogs, I have shown you how to upload single or multiple attachments in REST API. Here, I will show how to call that exposed REST API service from another integration.

For upload attachment in Rest API:

https://soalicious.blogspot.com/2023/06/oic-upload-attachment-in-rest-api.html

For upload multiple attachments in REST API:

https://soalicious.blogspot.com/2023/06/oic-upload-multiple-attachements-in.html


Logic steps:

  1. Create an OIC self REST invoke connection so that we can call the OIC rest upload attachment service.
  2. Confugure a rest trigger to get the employee details as json.
  3. Take a stage and write a file for example Employee.csv using sample CSV file and map the request employees to the csv file.
  4. Drag and drop the created OIC self connection and configure rest invoke with POST verb and resource URI of the upload attachment rest service. Take the request as multipart form-data.
  5. Map the stage file reference to attachement reference and provide content type as "text/CSV" and partname as filename of the stage write response.

Implementation steps with screenshots:

Create OIC self connection:


Integration flow:



Configure Rest Trigger





Stage to write a file:






Invoke rest upload attachment service






Notes: 
  • Content type should be mapped while invoking to Rest upload attachment integration. This case we have mapped as "text/CSV", otherwise you will get the error:  An error occurred while invoking the rest endpoint .[[Media type is null.]]. The 406 Not acceptable is an HTTP response statue code indicating that the client has requested a response using accept-headers that the server is unable to fulfill.

Thursday, June 15, 2023

OIC - Upload multiple attachements in REST API Oracle Integration

UseCase: We will upload multiple files as attachments to REST API and then for each file, we will write it to stage and then zip the files and wite the zip file to FTP directory.

Highlevel steps:

  • Configure a rest trigger with POST verb and select request as multipart with payload options.
  • Take a for each action and assign for each attachment repeating element.
  • Take a stage and write the file into stage using opaque schema and encodeReferenceToBase64() function.
  • Outside of for each, Take another stage and zip the files.
  • Drag and drop a FTP connection and write the zip file to a ftp ditectory. 


Implementation steps(with screenshots):


















Add tracking, save , activate and test.





OIC - Upload attachment in REST API Oracle Integration Cloud

UseCase: We will upload a CSV file as attachment to REST API and then parse the CSV file and send back the contents as json back to the consumer.

Highlevel steps:

  • Configure a rest trigger with POST verb and select request as multipart with payload options and response as a json payload
  • Take a stage and write the file into stage using opaque schema and encodeReferenceToBase64() function.
  • Take another stage and read the file using sample deilimited doc.
  • Map the read contents to rest response.

Json response payload:

[{

"FirstName":"",

"LastName":"",

"Designation":""

}]

For opaque schema:

https://soalicious.blogspot.com/2022/02/xsd-opaque-schema.html


Detailed implementation steps: 

Integration flow:


Steps:


















Featured Post

11g to 12c OSB projects migration points

1. Export 11g OSB code and import in 12c Jdeveloper. Steps to import OSB project in Jdeveloper:   File⇾Import⇾Service Bus Resources⇾ Se...