REST APIs: 6 attributes
Client/server architecture stateless operation clear statement of cacheable/uncacheable uniform interface layered code-on-demand
Client-server model steps:
1.
2.
3.
Stateless operation
REST does not record and use info about API exchanges to process subsequent API exchanges
Cacheable/uncacheable
save vs/ don’t save data for later retrieval (like for websites)
CRUD (REST APIs)- based of HTTP verbs C R U D
Create
Read
Update
Delete
CRUD:REST (HTTP) Create: Read: Update: Delete:
Create: Post
Get: Read
Update: Patch
Delete: Delete
URI structure:
https: //dnac.example.com/dna/intent/api/v1/network-device
1. https://
2. dnac.example.com
3. /dna/intent/api/v1/network-device
Resource & parameter
https://dnac.example.com/dna/intent/api/v1/network-device?parm1=10.1.1.1…
Resource- /dna/intent/api/v1/network-device
Parameter- ?parm=10.1.1.1…
JSON
Javascript object notation
RFC 8259.
General data modeling and serialization
Rest APIS
addl:
{} start and stop list
readable by human and machine.XML
eXtensible markup language. based off HTML.
World Wide Web Consortium
Data-focused text markup that allows data modeling
Rest APIs, web pages
addl:
Variables sit between tags. slightly harder to read than JSON
YAML
YAML Aint Markup Language.
YAML.org
General data modeling
Ansible
addl:
doesn't define markup details like XML. Focuses on data model details. Easiest to read. Starts with #. Denotes variables with {{ }}JSON
Key:value pair
each colon identifies pair
JSON
Key:
inside double “” before colon, used as the name that references a value
JSON
Value
represents value of key-
text, numeric, array, object
JSON
object
dictionary. list of Key:value pairs inside {}
JSON
array
series of values inside []
minified JSON
less spacing
beautified/prettified JSON
more spacing for readability