Volume 2 - Chapter 23: Understanding REST and JSON Flashcards
(41 cards)
What are the 6 attributes of a REST-Based (RESTful) API?
- Client/Server architecture
- Stateless operation
- Client statement of cacheable/uncacheable
- Uniform interface
- Layered
- Code-on-demand
True or False:
HTTP is required for an API to be considered RESTful.
False; while HTTP/HTTPS is common, it is not a requirement for an API to be considered RESTful.
Describe how the client/server model functions with a RESTful API.
- A REST client makes an API REST call to the REST server
- The REST server returns a response to the client
Describe how a stateless operation works with a RESTful API.
APIs that are considered RESTful are stateless; they do not track or keep information about previous API calls or request.
REST servers do not make decisions based on previous requests.
How does the function of “cacheable/uncacheable” content fit in with RESTful APIs?
- REST APIs must clearly mark content as cacheable or uncacheable
- If cacheable, a clear timer must be established for when the content needs to be downloaded again
In regards to Python and other scripting languages, describe the difference between a list and a dictionary.
A list is a list of multiple values
A dictionary is a list of matching key:value pairs
The following diagram is an example of a ____.
Dictionary, that contains multiple key:value pairs.
The following diagram is an example of a ____.
List
What are the 4 primary functions that can be performed by an application?
CRUD:
* Create: Create new variables and data structures on a server
* Read: Read existing varialbes and data structures on a server
* Update: Update existing variables and data structures on a server
* Delete: Delete existing varialbes and data structures on a server
What is the REST HTTP equivilent to a CRUD “Create” function?
POST
What is the REST HTTP equivilent to a CRUD “Read” function?
GET
What is the REST HTTP equivilent to a CRUD “Update” function?
PATCH, or PUT
What is the REST HTTP equivilent to a CRUD “Delete” function?
DELETE
What term best describes the following?
A resource that an HTTP request will act on.
A Uniform Resource Indicator (URI).
In regards to a REST GET Request, what part of a URI structure indicates the transport protocol used to transfer the requested data?
The Scheme (Protocol)
For example: https:// or http://
In regards to a REST GET Request, what part of a URI structure indicates the destination device that is hosting the requested data?
The Authority (Host:Port)
For example: 192.168.50.2:875
In regards to a REST GET Request, what part of a URI structure identifies the data, and its location on the device that is hosting it?
The Path (Resource)
For example: /root/etc/myfiles/notes.txt
In regards to a REST GET Request, what part of a URI structure identifies optional parameters for the request used for identifying variables?
The Query (Parameter)
For example: ?parm1=192.168.30.2
The following image is an example of a?
JSON output from a REST API call.
What term best describes the following?
A technique used to represent variables as text, send them over a network, or store them in a file.
Data Serialization Languages
JSON Stands for?
JavaScript Object Notation.
XML stands for?
eXtensible Markup Language.
The following image is an example of a?
XML output from a REST API call.
A technician uses a rest API to request information from a wireless controller. The technician expects to get the following key-value pairs for a dictionary called “statistics”:
* Number of Errors: 482
* Controller Uptime in Days: 399
* Device Hostname: CNTRL-WLC
How would the format of the output of this dictionary be if using XML? (Roughly)
<root> <statistics> <errornum>482</errornum> <uptime>399</uptime> <hostname>CNTRL-WLC</hostname> </statistics> </root>