REST Source Operations
Create a Source transformation in the Mapping Designer to read data from the web service application.
When you select a REST connection for a Source transformation in a mapping to read data from a web service application, you can select an operation.
After you specify the configured connection, specify Operations on the Source tab of the Source transformation. The Secure Agent displays operations applicable to the object configured in the connection. You can select the operation that you want to perform.
Select the operation you require, configure the request message in XML from the sample template provided, and configure the advanced properties for the operation. If you want to write to a relational target, define a relational structure for the source data by mapping the incoming fields that is in hierarchical format to the output fields in relational format. When you run the mapping, the Secure Agent retrieves data for the specified operation from the web service application.
Configuring a Request Using Request Message Editor
When you create a Source transformation, configure an XML request message for the operation that you want to perform in the web service application.
Use the Request Message Editor to create a request message. The request message is in XML format. You can use the default request message for the operation and then customize the request message to specify the data that you want to enter into the data flow.
To customize your request, copy the request message from the sample template to the Request Message Editor pane where you can edit the XML message and add the attributes for the request. Remove unnecessary and empty tags from the request message to avoid operation failure.
Parameterizing the Input Values in a Request Message
You can use in-out parameters to represent input values in a request XML.
Configure the in-out parameters in the Mapping Designer. From the Mapping Design page, you open the parameters panel and configure an in-out parameter.
The following image shows a configured empID in-out parameter value:
After you configure a parameter, use the parameter name in the following format, $$Name, in a request message. The XML uses the fields from the parameterized object.
For example, you want to use parameterized empID in an XML Request for a CouchDB_INPUT operation.
The following sample request shows the parameterized values that you can specify in an XML request:
<!--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>
Configuring In-Out Parameters in a Mapping
You can use an in-out parameter that holds a variable value that can change each time a task runs to manage incremental data loading.
Add the in-out parameterized values in complex expressions in a mapping when you want to update the parameters when each task runs. The in-out parameter acts like a placeholder for a value that stores a task stage. Informatica Cloud evaluates the parameter at runtime based on the specified configuration.
For example, you can use the following parameterized values in an Expression transformation:
SetVariable( $$empID, CONCAT(SUBSTR($$empID,1,3),TO_INTEGER(SUBSTR($$empID,4,2))+1) )
In the example, SetVariable function sets the parameter value each time the session runs. You set a default value for the $$empID parameter. You want to update the value of $$empID by one every time the task runs.
The following image shows the parameterized values used in an Expression transformation in the Mapping Designer:
When you deploy the mapping in a Mapping Configuration Task, you can configure the mapping to run according to a schedule. When the task runs, the Secure Agent updates the in-out parameters based on the specified parameters in the expression.
Field Mapping in a Source Transformation
The response message format follows the service response definition in the swagger specification file. You can map response fields from a hierarchical to a relational structure of output groups and fields.
After you configure an operation for a source and specify the request message, create the relational format from the hierarchical data to include groups and fields that you want in the output.
To do this, select the elements in the response structure that you want to include as output fields. The Secure Agent converts the XML response in the hierarchical structure to relational groups at run time.