Here are a few more use case examples showing how the vCO HTTP-REST plug-in can interact with some popular APIs.
vCloud Director
You must run two workflows to configure a vCloud Director host.
First, you must register a vCloud Director host.
Then, you must run the “Set vCloud Director authentication to a REST host” workflow from the “HTTP-REST Samples” workflow category to set the correct authentication type.
This example uses “Per User Session” session mode. To use this type of session mode, each user must be registered in both the Orchestrator LDAP and vCloud Director. The login URL must be an absolute URL. You can consult the “vCloud API Programming Guide” for details about available resources. The authentication and login to the vCloud Director instance is handled automatically by the REST plug-in so you do not need to login manually. If the session expires, it is renewed by the REST plug-in. You can receive a “403 Forbidden” error when invoking requests, if the provided credentials are invalid.
You can also use “Shared Session” to create only one connection to the vCloud Director instance. You should provide the credentials of a user who is a vCloud Director administrator.
Next, you can create an operation to add an organization to vCloud Director.
After you add the operation, you can call it by running the “Invoke a REST operation” workflow.
Twitter has a very well documented REST API at http://dev.twitter.com/doc. Twitter uses the OAuth 1.0 protocol for authentication. Once you have registered an application with Twitter, you can use the access token and access token secret to configure a REST host by using the “Add a REST host” workflow.
Consumer key and consumer secret are mandatory fields. You should provide an access token and access token secret to access a specific Twitter profile.
You can access only one Twitter account from a REST host. You can create a Twitter host for every account you need to process by using the “Clone a REST host” workflow.
Next, you need to create REST operations. The most used actions are “update status” and “get home timeline”.
Create the "get home timeline" operation.
This operation is documented at http://dev.twitter.com/doc/get/statuses/home_timeline.
After you add the operation, you can call it by running the “Invoke a REST operation” workflow.
Create the "update status" operation.
This operation is documented at http://dev.twitter.com/doc/post/statuses/update.
After you add the operation, you can call it by running the “Invoke a REST operation” workflow.
Optionally, you can create workflows from the operations. In the examples above, the {format} parameter is not required and can be set to xml or json in the operation definition.
Yahoo
Yahoo uses a very simple authentication scheme for most of its APIs. When you register with http://developer.yahoo.com/, you are given a unique appid that you must pass as a request parameter to all the API calls. The example describes how to access the Yahoo Answers API. The documentation for this service is available at http://developer.yahoo.com/answers/.
The authentication must be set to “NONE”.
Create an operation to search for answers.
You have to replace the XXXXX with your own appKey that you received upon registration. You can further refine the search by adding other parameters as query parameters. The available parameters are documented at http://developer.yahoo.com/answers/V1/questionSearch.html.
After you add the operation, you can call it by running the “Invoke a REST operation” workflow.
Foursquare.com
Foursquare uses OAuth 2.0 for authentication. It is a simpler protocol than OAuth 1.0: it only requires a token that is passed as a query parameter, however using https is mandatory.
The foursquare server is located at https://api.foursquare.com/v2/. You must first add a host. The authentication must be set to OAuth 2.0 and you must provide a token.
Create an operation to retrieve the user’s profile.
The operation URL is users/self. The list of all available operations is described at https://developer.foursquare.com/docs/explore.html#req=users/self. If you are logged-in to your foursquare account, accessing this page also generates a token for use.
The request token is added as a query parameter by the plug-in, so the user doesn’t have to handle the low level authentication details.
After you add the operation, you can call it by running the “Invoke a REST operation” workflow.
