Thursday, July 8, 2021

OIC - Configre rest trigger to get CSV file

Here I will show you how to configure a rest trigger to binary mode to get csv file. The media type will be text/plain.

You can also get binary file as 

  • Octet-stream
  • Pdf
  • Msword
  • Zip
  • Jpeg,png,bmp,gif
  • Other media type like text/plain

Implementation Steps:

Step1: Create an app driven integration and choose verb as POST, Configure a request payload for this endpoint and /csvData as relative resource URI.

Step2: In the request section, select the request payload format as Binary and media type as Other media Type and media type as text/plain.

Step3: Drag and drop a stage action and read the file 

Choose stage file operarion as Read Entire File.

Configure the file reference as Yes

Specify the Filr reference: /nssrcmpr:execute/nsmpr2:streamReference

Step4: Provide a sample csv file, record and recordset names.



"Sri", 1

Step5: Take a logger action and select Log as always, logger message as readfile/readresponse/empRecordSet.

Step6: Add the tracking as streamReference and save and activate.

Step7: Once the integrarion activated, do the following:

  • click on run and Test, 
  • go to body and select File button and select your file and test. 
  • Go to the monitoring section and open activity stream, you can see the logger contains the csv file data.

Test from Postman:

You can also test this rest from postman following the below steps:

Step1: From the integration take the endpoint uri and open in postman with post verb,

Step2:  Go to the authorization tab and select basic auth and provide OIC instance access credentials.

Step3: Go to the header tab and add Content-Type as text/plain.

Step4: Go to the Body tab and select binary and choose the test.csv file and hit the send button.

No comments:

Post a Comment

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...