Application Programming Interfaces (APIs) provide a communication-oriented cross-platform mechanism to connect computers inside your company, mobile phones, or partner computers to access your data by way of method or subroutine calls, regardless of language. An API is the definition of a method call. The API 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 the REST variety.
The Hypertext Transfer Protocol (HTTP) and Representational State Transfer (REST) underlying technologies are core to connecting otherwise disconnected computers.
This article explains HTTP, APIs, REST, and how your API's URLs are constructed.
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. This request is 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. This request is contained in the URL.
You can make other forms of request in HTTP, including the CRUD functions. All languages understand HTTP. An HTTP call is made up of the following elements:
- Resource identifier.Most commonly a URL, Uniform Resource Locator, or web address. The URL specifies the location of the desired resource.
- Verb.For example, GET (retrieve data), PUT (alter an existing resource), POST (create a resource), and DELETE.
- Request/Response.The request is data sent to the server (the data for update). The response is data that is returned (the query result).
- Header.Comprised of name-value pairs, commonly used for the auth token.
- Arguments.The values the caller supplies, passed in the URL.
Use the REST Lab in API Creator to get familiar with these concepts. Use it to experiment with your own REST server without first writing a program. The following image illustrates the anatomy of a REST call in the REST Lab: