Creating a REST API with JSON payload in OIC to read CSV based files

This tutorial will emphasize creating REST API within OIC to read CSV files from the FTP server.


To proceed with the use case, we need to first create a connection using an FTP adapter, Below article guide you to create  FTP Connection


Here is the sample file which is located on FTP Server, now we will develop an integration to read this file and generate JSON payload through REST. 



We have a sample file already located in the FTP server, now let's hop into the workspace to create an integration






Select App Driven Orechestration 



Fill the Name, Identifier and provide the package information for the better practice


Drop the REST Trigger on the pallette



Fill the endpoint Name



Provide the resource URI name and endpoint action as "GET"




provide a sample JSON file as shown in the screenshot




Here is the sample payload 

[
{"id":"",
"firstname":"",
"lastname":"",
"designation":"",
"email":""
}
]


Click the Next and opt the queryparam and then click on Done button to complete the REST connector configuration




Next step is to drop FTP Connection onto the workspace




enter the endpoint name which you would like to pass






Select operation "Read a File"  and provide input directory for example /oracle/pranay

Note: Directory must exist on the server otherwise integration will fail and provide the file name as well




Click on Yes to provide structure to contents of the file



Choose sample CSV File



Define the columns 


Click on Done



I have already checked in file and its ready to get picked by REST API upon its call 


The next step is to create the mapping between REST connector and FTP connectors


Map the query param



Map the columns 



Enable the track identifier and  activate the integration in OIC console, copy the URL, and put  the credentials 

 










Here is the data of CSV file from FTP server in JSON format  









Comments

Popular posts from this blog

Sample HZ API's script to Create Contacts and Contact Points in Oracle

REST integration built-in OIC to read Large files with size more than 10MB