REST API

What is a REST API?

REST API (Representational State Transfer Application Program Interface) is an architectural style that allows software to communicate with other software over a network or on the same device. Most commonly, developers use REST APIs to build web services. Often referred to as RESTful web services, REST uses HTTP methods to retrieve and post data between a client device and a server.

Using the HTTP protocol, REST APIs allow software on one device to talk to software on another device (or the same device) even if they use different operating systems and architectures. The client can ask for resources in a language the server understands, and the server responds with the resource in a language the client can consume. The server returns the resource in either JSON (JavaScript Object Notation), XML (Extensible Markup Language), or text formats, but many APIs support responses in additional languages.

What do we mean by REST architectural style?

REST is a set of governing principles that a developer must adhere to before considering their API “RESTful.” The principles say nothing about how they choose to implement the API.

  • Client-server architecture: The API‘s clients use HTTP calls to ask for a resource (a GET method) or send data to the server (a POST method), or any one of the other HTTP methods supported by the API. Although GET and POST are the most frequently used methods, other methods an API may support include HEAD, PUT, PATCH, DELETE, CONNECT, OPTIONS, AND TRACE. The API’s documentation shows the available methods supported by the API. Learn more at w3schools.com
  • Stateless: A stateless application does not maintain a connection or store information between requests from the same client. A client makes a request, the API performs the action defined in the request, and responds. Once the API responds, it drops the connection and doesn’t maintain any information about the client in active memory. The API treats each request as the first request.
  • Cacheable: A REST API should allow caching of frequently requested data. To reduce bandwidth, latency, and server load, an API should identify cacheable resources, who can cache them, and for how long they can remain in the cache.
  • Uniform interface: The defined way a client interacts with the server independent of the device or application.
  • Resource-Based: The API needs to have a specific URI (uniform resource identifier) for each resource, such as /monitor/{monitorGuid} from Uptrends API version 4.
  • Self-describing: Includes metadata such as Content-Type that describes how to process the response. Learn more about MIME types.
  • HATEOAS (hypermedia as the engine of application state): The server response includes the URI for additional methods the client can access using the response data. Learn more about HATEOAS.
  • Layered system: An API may have multiple layers such as proxy servers or load balancers, and the endpoint server may deploy additional servers to formulate a response. The client is unaware of which server responds to the request. A layered system makes an API more scalable.
  • Code on demand: Optionally, the API may send executable code such as Java applets or JavaScript.

What is a web resource?

A web resource is basically anything that a client can interact with on the web. The term may apply to a file such as a Word document, image, HTML, or video, but the resource may be more abstract and include actual things. A resource may also be a service such as Google Maps or financial services.

The API developer decides what formats they support for the response. For example, a server may respond with either JSON, XML, or text. The API should have the ability to format the response based on the needs of the client.

REST API examples

Just about everything that happens over the internet involves APIs. APIs work behind the scenes doing things like validating addresses, processing credit cards, making reservations, or scheduling appointments.

The United States Postal System publishes an API that allows businesses to manage their postal needs such as validating addresses, retrieving zip codes, calculating postage, getting tracking data, generating shipping labels, and scheduling mail pickup.

Macy’s department stores offer an API to partners to do things such as searching Macy’s inventory, interacting with gift registries, checking store events, and getting coupons.

AMC Theaters’ API enables developers of third-party apps to access their reservation system where the app can access showtimes, purchase tickets, and order concessions.

Facebook’s Graph API makes it possible for applications to interact with the Facebook application, including making posts, managing ads, and gathering data.

One thing to remember it isn’t uncommon for one API to use another API. For example, AMC Theaters’ API listed above uses another API for processing credit card payments.

Maintaining API availability and speed

API users depend on the APIs for their websites, apps, and devices to work correctly. Unavailable and slow APIs cause failures and frustrates users. Both API providers and consumers need to monitor for problems and act quickly in the event of an outage or a decline in performance.

REST API monitoring with dashboard with tiles displaying API availability

Monitoring for API uptime

Even a short outage can cause website, app, and device failures. API publishers need to take great care to ensure the system has the necessary redundancy to avoid downtime, but outages still happen. Publishers of an API have a responsibility to their users to make sure that the API responds uninterruptedly to those that use it. Those that rely on APIs should protect their business and users by monitoring APIs critical to their service. Synthetic API monitoring offers two solutions: Multi-Step API Monitoring and Web Service Uptime monitoring.

Checking for basic API availability and performance

To monitor for accurate uptime requires frequent tests. For maintaining high availability, tests should happen once per minute. A simple HTTPS/HTTP web service monitor is a perfect solution for checking availability.

  • Check every minute
  • Check externally from various worldwide locations
  • Check for basic authentication
  • Check for response time
  • Check response for content
  • Check for specific response codes

Uptime monitoring gives assurance that an API responds to request and how long the response takes. Using a content check and checking the response code reveals if the API responded with the expected result. In the case of an error, the alerting system notifies the team about the problem. Also, the monitor reports provide the data to back up any service level agreements.

Setting up web service monitors for every endpoint ensures they remain available, but endpoint checks may not be enough to prove an API functions properly. Multi-step API Monitoring can handle more complicated API checks.

Advanced API Monitoring

Thoroughly testing an API may require something that can handle more complicated scenarios such as those that require redirects, data validation, and data reuse. Multi-Step API Monitoring takes availability monitoring to the next level.

Multi-Step API monitoring allows for the checking of API transactions for full functionality, provides performance data for the entire transaction, and with added assertions, tracks speed for individual requests.

Key points

  • REST API is an architectural style that lets software talk to other software regardless of operating systems.
  • REST APIs support a client/server relationship by providing a uniform interface.
  • A REST API’s uniform interface is resourced-based, self-describing, and uses HATEOAS.
  • HATEOAS (hypermedia as the engine of application state) means the API response includes information about other available methods using the data received.
  • REST APIs are stateless, meaning the server doesn’t maintain connections or sessions between calls.
  • REST APIs are multi-layered systems to promote scalability.
  • Maintaining high availability and fast responses are critical for a REST API.
  • API Monitoring tracks uptime and performance and sends notifications when the API has problems.
  • Web Service HTTPS/HTTP monitors are excellent for monitoring uptime.
  • Multi-Step API Monitoring verifies complete API interactions for availability, function, and performance.

Try Uptrends for Free

See how Uptrends API Monitoring can help you monitor your APIs and more with a free 30-day trial. No credit card needed!

Let’s get started
By using the Uptrends website, you consent to the use of cookies in accordance with our Cookie Policy.