Lesson 52: Understanding APIs and REST
APIs (Application Programming Interfaces) are critical components of network programmability, enabling software applications to interact with network devices.
REST APIs
Representational State Transfer (REST) is an architectural style for designing networked applications. It relies on standard HTTP methods to interact with network resources.
Key Characteristics of REST:
- Stateless: Each request from client to server contains all the information needed to understand the request.
- Resource-Based: Network elements are treated as resources, identified by URLs (e.g.,
/api/v1/interfaces/GigabitEthernet0/1).
HTTP Methods (Verbs)
These verbs define the type of action to be performed on a resource:
| Method | Purpose |
|---|---|
| GET | Retrieve data (Read) |
| POST | Create new data (Create) |
| PUT | Update existing data (Update/Replace) |
| DELETE | Remove data (Delete) |
YANG and NETCONF/RESTCONF
Cisco uses data models to define how configuration data should look.
- YANG: A data modeling language used to define the structure of the configuration and state data.
- NETCONF/RESTCONF: Protocols that use YANG models to interact with devices programmatically, offering reliable, structured alternatives to screen-scraping CLI outputs.