Integration Cloud 6.1.0 | Applications | REST Applications
 
REST Applications
 
Creating and updating REST Applications
REST Applications - Account Configuration Details
Tweet the status on Twitter using the REST Application
REST (Representational State Transfer) is an architectural style that requires web applications to support the HTTP GET, POST, PUT, and DELETE methods and to use a consistent, application-independent interface.
Endpoint URL
The endpoint of an API is an unique URL, which represents an object or collection of objects. The endpoint is a reference to a URI that accepts web requests. It is the login endpoint URL to initiate communication with the SaaS provider. To get the endpoint, go through the SaaS provider documentation available on the internet. For example, https://api.twitter.com/1.1/ is the Twitter endpoint.
Authentication Type
Every back end provides its own Authentication mechanism to provide authorized access to its APIs. You need to get the authentication details from the SaaS provider documentation. For example, for Twitter, go to https://apps.twitter.com, create a new application, and then get the credentials. For Twitter, the authentication is OAuth V1.0a, which you can get from https://apps.twitter.com.
Resource
A resource refers to some object or set of objects that are exposed at an API end point. It is a representation of a thing (a noun) on which the REST APIs (verbs) operate. A resource has a type, one or more parameters, and some standard operations that allow you to manipulate or retrieve it from a remote location if you know its endpoint URL. Each resource derives its path from the namespace of the resource. For example, if the REST resource is named myREST.myRESTResource, the path is “/myREST.myRESTResource”.
Action
Actions are tasks that act on a Resource. You must create at least one Action for a Resource after you have created the Resource. You can add a Method, Request Parameters, Request and Response Headers, and a Request and Response body to an Action.
HTTP Method
The primary or most-commonly-used HTTP verbs (or methods, as they are properly called) are POST, GET, PUT, and DELETE. These correspond to create, read/retrieve, update, and delete (or CRUD) operations, respectively. You use the following HTTP methods to map the CRUD operations to HTTP requests. In a REST request, the resource that you are working with is specified in the URL – Uniform Resource Locator. The URL is a special case of the URI – Uniform Resource Identifier.
*GET - Used to read or retrieve a representation of a resource. For example, GET <endpointurl>/addresses/2 will retrieve an address with an ID of 2.
*POST - Creates a resource. For example, POST <endpointurl>/addresses will create a new address.
*PUT - Updates an existing resource. For example, PUT <endpointurl>/addresses/3 will modify the address with an ID of 3.
*DELETE - Used to delete a resource identified by a URI. For example, DELETE <endpointurl>/addresses/4 will delete an address with an ID of 4.
Resource
GET
PUT
POST
DELETE
http://example.com/
api/resource/
Lists details and perhaps URIs of the resources in this collection.
Replaces the entire collection.
Creates a new item in the collection.
Deletes a collection.
http://example.com/
api/resource/123/
Retrieves a specific item in the collection.
Updates the item in the collection and possibly creates an item if it does not exist.
Creates a new item in the collection.
Deletes an item from the collection.
Headers and Parameters
REST is not a standard in itself but instead makes use of the HTTP standard. HTTP headers allow the client and the server to pass additional information with the request or the response. For example, the Accept and Content-Type HTTP headers can be used to describe the content being sent or requested within an HTTP request. The client may set Accept to application/json if it is requesting a response in JSON or application/xml if it is requesting a response in XML, that is, when sending data, setting the Content-Type to application/xml tells the client that the data being sent in the request is XML.
REST calls (requests) and responses are sent over the HTTP protocol, hence REST requests are in the form of URLs that point to the resource(s) on the server. Required parameters are attached to the end of the URL. For example, in the resource URL http://<name>.com/user/789, user is the resource and 789 is the parameter that is passed to the URL of the resource. You can use any REST client to make REST calls.
REST parameters specify the variable parts of your resources, that is, the data that you are working with. QUERY parameters are the most common type of parameters, which is appended to the path of the URI when submitting a request. For example, https://api.twitter.com/1.1/users/show.json?screen_name=twitterdev is an example of a QUERY parameter URI where screen_name is the name of the parameter and twitterdev is the value of the parameter.
HTTP Status Codes
HTTP Status Codes indicate the status of the HTTP response:
*1XX - Informational
*2XX - Success
*3XX - Redirection
*4XX - Client error
*5XX - Server error