Commonly, you want to provide data access to other computers inside your company, a mobile phone or a partner’s computer. Unfortunately, you cannot easily make a method call (also called a subroutine call, the most basic element of programming), to a different computer in a different language. You need a communication-oriented mechanism to connect these computers together.
APIs provide this cross-computer, cross-platform connectivity. HTTP and REST are two underlying technologies that are core to connecting otherwise disconnected computers. The following will explain HTTP, APIs and REST.
You may not know it, but you are already very familiar with HTTP, Hypertext Transfer Protocol. Hypertext is text with links, and comprises the bulk of the content on the Internet. A protocol is a set of rules that frame interactions in telecommunications.
When you submit a URL to your browser, you are making an HTTP GET request, asking for a representation of the data at the URL location to be displayed on your own screen. The view of a web page that you see in your browser is the response to the GET request contained in the URL.
There are other forms of request that can be made in HTTP, including the CRUD functions. See the table below.
All languages understand HTTP.
An HTTP call is made up of four elements:
An API, Application Programming Interface, is the definition of a subroutine/method call: it identifies what parameters you supply and what you get in return. More recently, APIs are presumed to happen over a network, rather than locally. Most often, if a network is involved, the API is of a variety called REST.
REST, Representational State Transfer, is an architectural pattern, a reusable solution to a common occurrence. REST uses HTTP, making REST also language independent. REST builds upon the foundations laid by HTTP.
REST focuses on resources. A resource is analogous to a table, having a type, data, and relationships to other resources. The resource is identified in the last node of the URL.
Nesting allows you to send a request that will return, in one batch, all the subsets of data required by your request, reducing the effects of latency.
The REST Lab in CA Technologies API Creator is the best way to become familiar with these concepts, giving you a chance to experiment with your own REST server without first writing a program.
The following screen shot illustrates the anatomy of a REST call.