6.4 REST-Based APIs

Key Takeaways

  • REST APIs use HTTP methods (GET, POST, PUT, PATCH, DELETE) to interact with network controllers and devices.
  • APIs return data in structured formats like JSON or XML, which can be processed by scripts and applications.
  • HTTP status codes indicate success (200), creation (201), client error (400), or server error (500).
  • REST is stateless — each request contains all the information needed; the server does not remember previous requests.
  • CRUD operations map to HTTP methods: Create=POST, Read=GET, Update=PUT/PATCH, Delete=DELETE.
Last updated: March 2026

REST-Based APIs

REST (Representational State Transfer) is an architectural style for building APIs (Application Programming Interfaces). REST APIs are the primary way applications interact with SDN controllers and network devices.

What Is a REST API?

A REST API allows software programs to communicate over HTTP/HTTPS. Instead of logging into a CLI and typing commands, you send HTTP requests to a URL endpoint and receive structured data (usually JSON) in return.

Example: Get a list of network devices from Cisco DNA Center

GET https://dnacenter.example.com/api/v1/network-device
Authorization: Bearer <token>
Content-Type: application/json

Response (JSON):

{
  "response": [
    {
      "hostname": "SW-Floor1",
      "managementIpAddress": "10.0.0.10",
      "platformId": "C9300-48T",
      "softwareVersion": "17.9.1",
      "reachabilityStatus": "Reachable"
    }
  ]
}

REST Characteristics

CharacteristicDescription
StatelessEach request is independent; server doesn't remember previous requests
Client-ServerClient sends requests, server processes and responds
Uniform InterfaceStandard HTTP methods and URL structure
CacheableResponses can be cached for performance
LayeredClient doesn't need to know if it's connected directly to the server or through intermediaries

HTTP Methods (CRUD Operations)

HTTP MethodCRUD OperationPurposeExample
GETReadRetrieve dataGet list of VLANs
POSTCreateCreate new resourceCreate a new VLAN
PUTUpdate (full)Replace entire resourceReplace a device's entire configuration
PATCHUpdate (partial)Modify part of a resourceChange a VLAN's name
DELETEDeleteRemove a resourceDelete a VLAN

HTTP Status Codes

CodeCategoryMeaning
200SuccessOK — request succeeded
201SuccessCreated — new resource created successfully
204SuccessNo Content — request succeeded, no data to return
400Client ErrorBad Request — malformed request syntax
401Client ErrorUnauthorized — authentication required
403Client ErrorForbidden — authenticated but not authorized
404Client ErrorNot Found — resource doesn't exist
500Server ErrorInternal Server Error — server encountered an error

Status Code Categories

RangeCategoryMeaning
1xxInformationalRequest received, processing
2xxSuccessRequest successfully processed
3xxRedirectionFurther action needed
4xxClient ErrorProblem with the request
5xxServer ErrorProblem with the server

REST API Authentication

APIs require authentication to prevent unauthorized access:

MethodHow It Works
Basic AuthUsername:password encoded in Base64 (weak)
API KeyUnique key included in header or URL parameter
Token-basedLogin with credentials → receive token → include token in subsequent requests
OAuth 2.0Industry standard for delegated authorization

REST APIs in Network Automation

PlatformAPI Use Case
Cisco DNA CenterGET devices, POST configurations, monitor network health
Cisco MerakiManage cloud-managed networks via REST API
Cisco ACIData center fabric management via REST API
Cisco SD-WANWAN management and policy deployment

On the Exam: Know the HTTP methods and their CRUD mappings. Understand that REST APIs are stateless and use JSON for data exchange. Be able to identify what a GET, POST, PUT, or DELETE request does in a networking context.

Test Your Knowledge

Which HTTP method is used to retrieve data from a REST API without modifying anything?

A
B
C
D
Test Your Knowledge

What does the HTTP status code 401 indicate?

A
B
C
D
Test Your Knowledge

Which characteristic of REST means that each API request must contain all information needed for the server to process it?

A
B
C
D