REST API Connector Guide > REST API Operations > Making a GET Request
  

Making a GET Request

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:
  1. 1Create a REST API Connection to use as a source.
    1. aCreate a URL input parameters config file.
    2. bUse the URL input parameters config file in the connection.
  2. 2Create a synchronization task.
    1. aConfigure source to access REST API endpoint.
    2. bConfigure target to write data to a flat file.
    3. cConfigure data filters.
    4. dMap the fields.
    5. 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.
    Type
    Select ReST (Informatica Cloud Labs)
    Runtime Environment
    Select the appropriate Secure Agent.
    Base URL
    http://api.openweathermap.org/data/2.5/weather
    Is Base Url Dynamic
    Checked
    Url Request Parameters
    q=bangalore;APPID=70ab007d4fe120b85d11d5432cbe7609
    Form Request Parameters
    N/A
    Header Request Parameters
    N/A
    Media Type
    Select application/json
    Request Type
    Select GET
    Authentication Type
    NO_AUTH
    Auth UserId
    N/A
    Auth Password
    N/A
    OAuth Consumer Key
    N/A
    OAuth Consumer Secret
    N/A
    OAuth Token
    N/A
    OAuth Token Secret
    N/A
    Additional Custom OAuth Parameters
    N/A
    Config File or Private Key File Name
    N/A
    Sample Response XML or JSON File Path
    N/A
    Response Folder Path
    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:
    C:\Informatica\Cloud\FlatFile_Connections\Weather\config.csv
    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:
The following image shows the sample config file with dynamic base URL.

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.