You are a weather analyst. Using Informatica Intelligent Cloud Services, you want to use a RESTful service to read the weather data of any city for analysis.
In this example, you pass the required city names as data filters, receive the JSON message format output, and write the output to a .csv file.
Perform the following steps:
1Create a REST API Connection to use as a source.
aCreate a URL input parameters config file.
bUse the URL input parameters config file in the connection.
2Create a synchronization task.
aConfigure source to access REST API endpoint.
bConfigure target to write data to a flat file.
cConfigure data filters.
dMap the fields.
eSave and run the synchronization task.
Create a REST API Connection
1On the Connections page, click New Connection.
2Specify the following details:
Connection Property
Description
Connection Name
Enter a unique name for the connection. For example: OpenWeather_REST
Description
Provide a relevant description for the connection.
Specify a path on the Secure Agent machine where you want to generate the response file. For example: C:\Informatica\Cloud\FlatFile_Connections\Weather
Url Input Parameters Config File Name
Specify the path and name of the config file. For example:
When the file is created for the first time, it contains the values that are provided in the Url Request Parameters field.
Form Input Parameters Config File Name
N/A
Header Input Parameters Config File Name
N/A
Create the config csv file
Select Yes
3Select No in the Create the config csv file parameter as shown in the following image:
4Click Finish to create the connection.
Open the config.csv file. The following image shows the sample config file:
Add the additional parameter values with a valid syntax. The following image shows the sample config file after adding additional parameter values:
Create a Synchronization Task
1Click New > Tasks.
2Select Synchronization Task and click Create.
3In the New Synchronization Task page, configure the following fields:
Field
Description
Task Name
Name of the synchronization task. For example: REST_GetWeather_By_City
Description
Description of the synchronization task. Maximum length is 255 characters.
Task Operation
Select Insert.
4Click Next.
5On the Source page, configure the following fields:
Field
Description
Connection
Select the connection you created. For example: OpenWeather_REST
Source Type
Select Single.
Source Object
Select JsonRoot.
6Click Next.
7On the Target page, configure the following fields:
Field
Description
Connection
Select the flat file connection.
Target Object
Click Create Target. Change the default file name to WeatherByCity.csv and select all fields in the file.
8Click Next.
9On the Data Filters page, create a new filter and filter by _FLT_URL_Input_Parameters_Config_File_Path. Provide the path and name of the config file that contains different values for different records:
The following image shows the data filter:
10Click Next.
11On the Field Mapping page, click Automatch.
12Click Validate Mapping.
13Click Finish, and then run the task from the page.
The following image shows the sample output:
You can also create a mapping or mapping task to make a GET request.
14 Configure advanced source properties.
Advanced source properties appear on the Schedule page of the Synchronization Task wizard.
The following table describes the advanced source properties that you can configure for a REST API source:
Field
Description
Time delay in ms
Specifies the amount of time (milliseconds) to wait before the connector retries for a response.
Retry Count
Specifies the number of tries to get the response from an endpoint based on the time delay.
Note: If the connector is not able to get response based on the time delay in ms and retry count properties, it throws an exception.