Write Robots

In the following procedure, you will write a robot that accesses a REST API that uses OAuth as its authentication mechanism. As an example, you use the Twitter REST API to obtain the most recent statuses by the authenticating user and the users he or she follows.

  1. Start Design Studio and create a new robot.

    Do not enter a URL in the wizard. You will not be able to access the REST API before authentication.

  2. Add a new input variable of type OAuthCredentials.
  3. In the serviceProvider field, type Twitter.
  4. Enter the access token and access token secret that was obtained when you went through the user authorization process in the Management Console wizard. Also enter the consumer key and consumer secret of the Twitter application.


  5. Click OK.
  6. Click Configure Robot .

    The robot configuration window appears.

  7. On the Basic tab, click Configure.
  8. On the All Loading tab, locate Credentials and switch it from standard username/password authentication to OAuth.
  9. Select the input variable you just added.


    You should now see the XML that has been returned, containing the most recent statuses in the user's timeline, as above.

  10. Click OK in both dialogs.

    The robot is now configured to use OAuth and using the specified credentials when running in Design Studio. You can now start accessing Twitter's API. For instance, to see a collection of the most recent Tweets posted by the user, you can access the URL https://api.twitter.com/1.1/statuses/user_timeline.json.