Automation and Programmability Flashcards
What does REST stand for?
Representational State Transfer
What are the 6 guidelines of a REST API? (The top 3 are most important to network developers)
1.) Client/Server Separation
2.) Stateless
3.) Cacheable
4.) Uniform Interface
5.) Layered System (separation of concerns)
6.) Code On Demand
Given the following URL, identify the Protocol, the Server, the Resource and the Parameter: https://domain.com/api/v1/servers?=windows
protocol = “https”
server = “domain.com”
resource = “/api/v1/servers”
parameter = “?=windows”
What are the HTTP verbs to Create, Read, Update, and Delete (CRUD)?
Create - POST
Read - GET
Update - PATCH (or PUT)
Delete - DELETE
What is the meaning of the following HTTP response codes:
- 1xx (100)
- 2xx (200)
- 3xx (300)
- 4xx (400)
- 5xx (500)
1xx - Informational
2xx - Successful
3xx - Redirect
4xx - Client error
5xx - Server Error
What is the difference between HTTP 401 and 403 codes?
401 (Unauthorized) - Not authenticated
403 (Forbidden) - Authenticated, but not permitted to access the resource
What is the HTTP response code of 201?
Created (Success) - Note the response BODY may not include any content
What are the three most popular data serialization languages?
XML
JSON
YAML
What is one security issue related to a well documented API?
Reverse Engineering
What are some common methods to secure a REST API?
- Use SSL for connection
- Maintain Statelessness (do not keep sessions open)
- Use authentication
- Use authorization
- Rate limits (Brute Force Protection)
What are the most common methods to authenticate to an API?
- Basic Authentication (Username : Password)
- API Key
- Token-Based (token refresh)
What is YANG?
Industry Standard for how data models are structured in Netconf payloads - a data modeling Language
What are the 4 primary elements to a YANG model?
Module > Container > List > Leaf
What is the URL to fetch capabilities from a Cisco IOS-XE device using RESTconf?
https://DEVICENAME/restconf/data/netconf-state/capabilities
What is it called when a network vendor creates their own YANG data models for their hardware?
Native (Data Models)
Using Python, define a string called name with the value of Bob.
name = “bob”
Using Python, define an integer named quantity with the value of 100
quantity = 100
Using Python, define a boolean called isEnabled with the value of true.
isEnabled = True
Using Python, define a list called ip_addresses with any three IP addresses in the list.
ip_addresses = [“10.10.10.1”, “192.168,44,12”, “172.16.21.9”]
Using Python, define a tuple called ip_addresses with any three IP addresses in the tuple.
ip_addresses = (“10.10.10.1”, “192.168,44,12”, “172.16.21.9”)