Course: All-in-One Cisco DevNet Associate DEVASC...


All-in-One Cisco DevNet Associate DEVASC 200-901 Certification Exam Prep Bundle (3-Month Access)

Cisco DevNet Associate Exam Cert Study Guide Download

Text lesson

Lesson 1: Construct a REST API request to accomplish a task given API documentation

Construct a REST API request to accomplish a task given API documentation

Application Programming Interface (or an API) is an interface mechanism and a protocol to carry out communication between a server and a client with the primary purpose of simplifying the software development of client-side software.

API determines the type of data, services, and functionality the application exposes to 3rd parties. Here are a few common use cases for the APIs.

  • Task automation
  • Data integration (between two applications)
  • Functionality (one application can integrate functionality from another application)

APIs have been around for decades, but their usage has grown exponentially over the past decade. Modern APIs are coded into the product from day one and very reliable to use. Another factor for the popularity is the ease of use, e.g. you can use APIs with simpler coding languages such as Python or even without writing a single line of code with tools such as Zapier.

APIs are broadly split into internal and external based on how they are used and shared in a system. Internal and external APIs are also known as private and public. Private APIs are exclusively meant to be used for building applications that are to be used within a company.

Public APIs, on the other hand, are for open use by all third parties who may be interested in building applications that use the company’s services. Outside organizations are expected to use these APIs to build or extend beyond the original intent.

All major operations systems such as macOS, Windows, iOS, and Android have both private and public APIs. The use of private APIs by anyone outside the organization is frowned upon, and for mobile development, it simply means that your app will be rejected by iOS or Android approval teams. However, there was one famous example, where late Steve Jobs personally intervened and approved an app then known as “Knocking Live Video”.

Let’s now use cURL to issue a REST API request, cURL is a “client for URLs”, or a command-line utility to transfer data using various protocols. Here we will use cURL to perform a GET operation (using the -I option tells it to only pull the HTTP headers or HEAD method). The response you see below is what is sent by the web server in response.