REST API stands for Representational State Transfer Application Programming Interface.
It’s a standard way for two systems to communicate over the web (HTTP/HTTPS) — often between a client (like Python script or Ansible) and a server (like a network device or SDN controller).

In simple terms:
👉 A REST API allows you to interact with a system (get data, configure, update, or delete something) using HTTP requests — just like how your browser communicates with websites.


⚙️ Why REST APIs Matter in Networking

In modern networks:

  • Devices (Cisco, Juniper, Fortinet, etc.) and controllers (like OpenDaylight, Cisco DNA Center, VMware NSX) expose REST APIs.
  • Engineers can automate tasks (like getting interface status, pushing configurations, or monitoring health) using API calls instead of manual CLI.

Example:
Instead of logging into 50 routers to check interface status,
you can run one Python script that uses REST APIs to fetch all interface data.


🧩 Key Concepts of REST API

ConceptDescription
ClientThe system or application making the API request (e.g., Python script, Postman, Ansible)
ServerThe system that provides the API (e.g., router, firewall, controller)
ResourceThe object you’re working with (e.g., interface, VLAN, route, policy)
URI (Uniform Resource Identifier)The address to access a resource (e.g., /api/v1/interfaces)
HTTP MethodsDefine what action to perform on a resource

🔠 Common HTTP Methods

MethodPurposeExample
GETRetrieve informationGet interface status
POSTCreate new data/configurationAdd a new VLAN
PUTUpdate/replace dataChange an interface IP
PATCHModify part of a resourceUpdate interface description
DELETERemove data/configurationDelete a VLAN

🧾 Typical REST API Request Structure

A REST API request looks like this:

Method: GET
URL: https://192.168.1.1/api/v1/interfaces
Headers:
    Content-Type: application/json
    Authorization: Bearer <token>

Response (from device or server):

{
  "interfaces": [
    {"name": "GigabitEthernet0/0", "status": "up"},
    {"name": "GigabitEthernet0/1", "status": "down"}
  ]
}


💡 Key Characteristics of REST APIs

  • Stateless: Each request is independent; the server doesn’t remember previous ones.
  • Uses HTTP verbs: GET, POST, PUT, DELETE, etc.
  • Uses URIs to identify resources.
  • Supports multiple data formats: Commonly JSON, sometimes XML.
  • Client-Server separation: Clear boundary between what requests and what responds.
  • Cacheable: Responses can be cached for performance.

🧰 Common Tools to Work with REST APIs

ToolUse
PostmanGUI-based tool to test and visualize API calls
cURLCommand-line tool for sending HTTP requests
Python (Requests library)Programmatically interact with APIs
Ansible / TerraformUse APIs for automation/infrastructure as code

🐍 Example: Python Script Using REST API

import requests
import json

url = "https://192.168.1.1/api/v1/interfaces"
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer your_token_here"
}

response = requests.get(url, headers=headers, verify=False)
data = response.json()

for interface in data["interfaces"]:
    print(interface["name"], "-", interface["status"])

✅ This script retrieves interface status from a network device that supports REST APIs.


🌐 Example REST API Endpoints (Networking)

VendorAPI ExampleDescription
Cisco DNA Center/dna/intent/api/v1/network-deviceGet all devices
Fortinet FortiGate/api/v2/monitor/system/interface/Get interface list
Juniper Junos/rpc/get-interface-informationGet interface info
OpenDaylight/restconf/operational/network-topology:network-topologyGet network topology
Arista eAPI/command-apiSend CLI commands via JSON-RPC

Benefits of Using REST APIs

  • Automation: Eliminate manual configuration
  • Integration: Connect network, cloud, and monitoring systems
  • Speed: Fast configuration and data collection
  • Consistency: Apply uniform settings across devices
  • Scalability: Manage hundreds of devices easily

🧭 Summary

ConceptDescription
Full FormRepresentational State Transfer API
PurposeCommunication between client and server using HTTP
Data FormatJSON / XML
Common MethodsGET, POST, PUT, DELETE
Use in NetworkingAutomate configuration, monitoring, and integration
ToolsPostman, Python Requests, Ansible

Leave a comment

Hey there, fellow nerds and net-surfers!

Welcome to my corner of the internet where I talk about the holy trinity of tech: NetworkingLinux, and Security — or as I like to call it, “Ctrl+Alt+Fix-It”. If you’re into packet sniffing (the legal kind), hardening Linux boxes, or figuring out why your network is being as moody as a teenager, you’re in the right place.

This blog is where I dump useful knowledge, random tech rants, and occasional troubleshooting victories so future me (and hopefully you) can benefit. Expect bash scripts, firewall rules, sarcastic comments, and the occasional meme — because what’s IT without a little command-line chaos and caffeine?

Whether you’re a curious beginner or a battle-hardened sysadmin, I hope you’ll find something here to learn, laugh at, or copy-paste in desperation.

Welcome aboard — and may your logs always be verbose.

Let’s connect