Getty Images/iStockphoto

Tip

A guide to network APIs and their use cases

An API enables communication between two applications, while a network API provides communication between the network infrastructure -- and its protocols -- and applications.

An application programming interface, or API, is an interface that enables different applications to talk to each other using a set of mechanisms and protocols. Similarly, a network API enables communication between the network and applications, web browsers and databases.

An API that uses representational state transfer (REST) architecture is often recognized as a RESTful API. These APIs are commonly used in networking. RESTful APIs use HTTP methods to gather and manipulate data, while HTTP uses RESTful APIs to interact with data.

Frameworks, such as the OSI model, bring standardization to the way applications and devices from different vendors communicate with each other in a network. APIs from various vendors can interact because they follow the methods and frameworks for different stack layers.

APIs and databases can also use create, read, update and delete (CRUD) functions to store and modify data. CRUD functions share similarities with HTTP functions, as seen here.

CRUD function HTTP function Action Use case

CREATE

POST

Configure a network remotely

Add a virtual LAN (VLAN)

READ

GET

List network devices through telemetry

List devices in a network remotely

UPDATE

PUT/PATCH

Modify a network config

Change a VLAN's name

DELETE

DELETE

Delete unused VLANs

Delete a VLAN


Use cases for network APIs

For decades, the de facto standard in networking was the command-line interface (CLI). With the proliferation of smart devices and big data, networks became bigger and more complex to manage on a global scale. But the CLI wasn't made to support that scale, often resulting in tedious tasks and human errors.

Network APIs can help network engineers manage networks more easily with fewer errors. They also support programmable networks, which introduce concepts like automation and scripting.

Common use cases for network APIs are the following:

  • action batches
  • telemetry
  • provisioning
Use case When to use APIs Why

Action batches

You need to deploy a software update to 1,000 network devices. Use a single API request to do everything at once.

It's tedious to configure or update devices one by one, and APIs can help.

Telemetry

You need to see active devices remotely.

Using an API provides an easy way to view the devices, and you can filter the results with advanced features compared to the CLI.

Provisioning

You need to automate manual tasks, like configuring ports or load-balancing policies.

Avoid tedious CLI tasks for complex configs.

Best practices for using network APIs

APIs are changing the way network engineers work. Unfortunately, in a world where networks are programmable, APIs are vulnerable to cyber attacks from threat actors.

Network and security teams can use resources, such as the Open Web Application Security Project (OWASP) Top 10 list, to understand common threats and enable better API practices, like secure coding.

Other API best practices include the following:

  • send and receive data using JSON format;
  • do not use verbs in URLs;
  • think about Uniform Resource Identifier versioning;
  • consider data filtering options; and
  • review the OWASP Top 10 vulnerabilities.

API examples

Users often don't notice what happens when they use devices, apps and platforms, but APIs are essential for those interactions.

Here are some well-known multivendor APIs.

API Definition Use case

RESTCONF

An HTTP-based protocol that provides a programmatic interface to access data defined in Yang

Enables a network admin to access different network devices

OpenFlow

A multivendor standard for implementing software-defined networking in networking equipment

Helps with load balancing, routing, topology discovery and other tasks

NETCONF and YANG API

A management network protocol used to manage network devices

Modifies configs and deletes and obtains the status of network devices

The best way for admins to understand APIs is to evaluate how they can improve the way they manage networks and innovate through the different challenges that emerge. Admins can use different tools to interact with network APIs, such as the following:

  • cURL. A command-line tool developers use to transfer data to and from a server.
  • Postman. An API platform for building and using APIs.
  • Visual Studio Code (VS Code). One of the most advanced code editors in the world -- network engineers can use the VS Code tool to write code to automate daily routine tasks or build advanced custom scripts to interact with network APIs.

Programmability changes networking

The network is now programmable, and the ability to code is a helpful skill for network engineers. Network APIs have become the new CLI. Those who embrace the change to automation will thrive in the changing tech industry. Neglecting the opportunity could make engineers irrelevant in some companies.

Automation is not a substitute for networking, but it is an opportunity to do things better and quickly in a world where agility is the key to success.

Next Steps

A glimpse into Python network automation and APIs

The 5 essential HTTP methods in RESTful API development

Dig Deeper on Network infrastructure

Unified Communications
Mobile Computing
Data Center
ITChannel
Close