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

Making a POST Request

You are an operation manager in a marketing services organization. At a regular interval, you need to tweet the marketing content for your multiple clients. Instead of accessing Twitter account for each client every time, you can use Informatica Cloud REST API Connector to call the Twitter Update API.
To make a POST request to a REST API, you configure the payload required by the API when you create a task. The Twitter Update API does not require a payload. Therefore, in this example, you configure the text to be tweeted in Field Mapping without configuring a payload. This example does not parse the response of the POST request.
Perform the following steps:
  1. 1. Create a REST API Connection to use as a target.
  2. 2. Create and run a Data Synchronization task.

Create a Connection

    1. Click Configure > Connections.
    2. Click New to create a connection.
    The New Connection page appears.
    3. Specify the following details:
    Connection Property
    Description
    Connection Name
    Enter a unique name for the connection.
    Description
    Provide a relevant description for the connection.
    Type
    Select ReST (Informatica Cloud Labs) from the list.
    Runtime Environment
    Select the appropriate secure agent from the list.
    Base URL
    Enter https://api.twitter.com/1.1/statuses/update.json
    Url Request Parameters
    status=TestTweet
    Media Type
    Select application/json
    Request Type
    Select POST
    Authentication Type
    Select OAUTH
    OAuth Consumer Key
    Provide Oauth consumer key for your Twitter account.
    OAuth Consumer Secret
    Provide Oauth consumer secret key for your Twitter account.
    OAuth Token
    Provide Oauth token for your Twitter account.
    OAuth Token Secret
    Provide OAuth token secret for your Twitter account.
    Create the config csv file
    Select No
    The following image shows the sample values:
    4. Click Ok to save the connection.

Create a Data Synchronization Task

For POST request, configure the REST API connection as target.
Before you create a Data Synchronization task, create a flat file and save the text that you want to tweet. For example, TwitterStatus.txt. Create a flat file connection to use as a source.
  1. 1. To create a Data Synchronization task, click Task Wizards > Data Synchronization, and then click New.
  2. 2. In the Data Synchronization Task Details area, configure the following fields:
  3. Field
    Description
    Task Name
    Name of the Data Synchronization task. For example: REST_TwitterUpdate
    Description
    Description of the Data Synchronization task. Maximum length is 255 characters.
    Task Operation
    Select Insert.
  4. 3. Click Next.
  5. 4. On the Source page, configure the following fields:
  6. Field
    Description
    Connection
    Select the flat file connection.
    Source Type
    Select Single.
    Source Object
    Select TwitterStatus.txt.
  7. 5. Click Next.
  8. 6. On the Target page, configure the following fields:
  9. Field
    Description
    Connection
    Select the connection you created. For example: TwitterUpdate_REST
    Target Object
    Select update_json
  10. 7. Click Next.
  11. 8. Click Next.
  12. 9. On the Field Mapping page, map the TwitterStatus.txt source file to the URLPARAM_status field of the target object. If your POST call has a payload, define the payload in a flat file, and map the absolute path of the file to PAYLOAD_FileName in Field Mapping. The following image shows the field mapping for URLPARAM_status field:
  13. 10. Click Validate Mapping.
  14. 11. Save and run the Data Synchronization task.