REST V2 Connector Guide > Mapping and Mapping Configuration Tasks with REST Connector > REST Source Transformation in Mappings
  

REST Source Transformation in Mappings

When you configure a Source transformation, select the REST connection and choose an operation to represent a web service source. You can parameterize a REST connection.
You can select an operation for the source through the connection. Configure the request message using the request message template. You can parameterize the input values in the request XML. Configure the advanced properties to set the tracing level and the cache size for the web service response.
You can view the response structure in the field mapping. When you map the elements from the response structure to the output fields, the Secure Agent creates the output groups, along with the primary and foreign keys for the field names. When you deploy the mapping in a Mapping Configuration task and run the task, the Secure Agent reads the data from web service.

Advanced Source Properties

In a mapping, you can configure a source to represent a web service application source. For the REST source connections used in Mapping Configuration tasks, you can configure advanced properties in the Source page of the Mapping Configuration Task wizard.
The following table describes the advanced properties that you can configure in a source:
Property
Description
Tracing Level
Amount of detail that appears in the log for the source.
Use the following tracing levels:
  • - Terse
  • - Normal
  • - Verbose Initialization
  • - Verbose
Default is normal.
Cache Size for Web Service Response (KB)
Memory available for the web service response. If the web service response contains many rows or columns, you might want to increase the cache size. Default is 1024 KB.

REST Source Mapping Example

You are a human resources administrator and you want to extract contact information, such as first name, last name, email, and phone number of employees from Apache CouchDB to a flat file.
    1. Create a REST connection. Verify that you specify the absolute path of the swagger specification file and the authentication method in the connection properties.
    The following image shows the configured REST connection:
    2. Create a flat file connection to write data to the flat file.
    3. Create a REST mapping.
    The following image shows the REST mapping:
    4. Add a Source transformation. Specify a name and description in the general properties.
    5. On the Source tab, perform the following steps:
    1. a. In the Connection field, select the configured REST connection to connect to the Couch database.
    2. b. In the Operation field, select CouchDB as the operation.
    3. The following image shows the CouchDB operations:
    4. c. In the Request Options section, configure the request message in the following XML format, specify the attributes in the message, and validate the message:
    5. <!--1 or more repetitions:-->
      <proc:CouchDB_INPUT xmlns:proc="http://xml.schemas/infa/procedure/">
      <!--Optional:-->
      <CouchDB>
      <!--1 or more repetitions:-->
      <emp>
      $$empID
      </emp>
      </CouchDB>
      </proc:CouchDB_INPUT>
      The request message specifies the criteria to include the employee ID for all employees.
    6. d. In the Advanced Properties section, set the tracing level to Normal, and use the default cache size of 1024 KB.
    6. On the Field Mapping tab, select the elements, such as _id, FirstName, and LastName in the response structure that you want to map to the output fields.
    The following image shows the response structure on the left pane in a hierarchical format and the output groups on the right pane in a relational format:
    The Secure Agent creates two output groups, workPhoneNumber and couchDB_out, which results in two relational output files. Primary and foreign keys are auto-generated.
    7. Add three Target transformations and specify the target objects for each of the transformations. Perform the following steps:
    1. a. Select a flat file connection for each of the target transformations to write data to the flat files.
    2. b. Create target objects workPhoneNumber.csv, couchDB_out.csv, and NewTarget.csv files to write data to the target.
    3. c. Select the output group from CouchDB that you want to link to the target objects.
    8. Add an Expression transformation, and include a SetVariable function and the parameterized value $$empID in the expression so that the task updates the values by one at the end of each run.
    The following image shows the configured expression that utilizes the in-out parameters:
    9. Click Task Wizards > Mapping Configuration Task, and select the mapping for the task.
    10. When you save and run the mapping, the Secure Agent retrieves employee records from CouchDB and writes the data to the corresponding flat files.