4.9.3 Module 4: Understanding and Using APIs Quiz (Answers)

DevNet Associate 4.9.3 Module 4: Understanding and Using APIs Quiz (Answers)

1. What is REST?

  • It is a protocol that allows administrators to manage nodes on an IP network.
  • It is a way to store and interchange data in a structured format.
  • It is a human readable data structure that is used by applications for storing, transforming, and reading data.
  • It is an architecture style for designing web service applications.

Explanation: REST is not a protocol or service, but rather a style of software architecture for designing web service applications.

2. Which HTTP response status code indicates that the request to update the database is completed?

  • 403
  • 200
  • 201
  • 401
  • 404
  • 400

Explanation: The most common HTTP status codes include the following:

  • 200 – OK (using GET or POST to exchange data with an API successfully)
  • 201 – Created (creating resources by using a REST API call successfully)
  • 400 – Bad Request (The request from the client is failed due to client-side issue.)
  • 401 – Unauthorized (The client is not authenticated to access site or API call.)
  • 403 – Forbidden (The access request is not granted based on the supplied credentials.)
  • 404 – Not Found (The page requested at HTTP URL location does not exist or is hidden.)

3. How many elements does a SOAP message contain?

  • 5
  • 3
  • 2
  • 4

Explanation: A SOAP message is an XML document that can contain four elements, namely, Envelope, Header, Body, and Fault.

4. Refer to the exhibit. A network administrator is using a Python script to test a REST API request. The traceback message indicates there is an error in the URI. What is the error?

4.9.3 Module 4: Understanding and Using APIs Quiz (Answers) 1

  • The query component is missing.
  • The destination web host address is invalid.
  • The protocol is missing.
  • The path in the URI is invalid.

Explanation: The error message indicates “MissingSchema”. A REST API request URI needs the URI to use the proper HTTP protocol, HTTP or HTTPS.

5. Which type of encoding is used in basic authentication for REST APIs?

  • Base64
  • UTF-16
  • Base32
  • UTF-8

Explanation: REST APIs use Base64 encoding for the basic authentication. Base64 is a binary-to-text encoding scheme.

6. What is an architectural constraint to which a true RESTful API web service must adhere?

  • It must support the XML data format.
  • It uses HTTPS to transport data.
  • It operates as a cloud service.
  • It runs as client/server model.

Explanation: Conforming to the constraints of the REST architecture is generally referred to as being “RESTful”. An API can be considered “RESTful” if it has the following features:

  • Client/server – The client handles the front end and the server handles the back end.
  • Stateless – No client data is stored on the server between requests. The session state is stored on the client.
  • Cacheable – Clients can cache responses locally to improve performance.

7. What is a reason that a network engineer would use APIs?

  • to automate configuration or data collection tasks
  • to provide a more robust security architecture
  • to facilitate features across network devices that operate at different layers
  • to provide upper management with information about network performance

Explanation: Application programming interfaces or APIs interact with one or more applications. APIs are commonly used to automate tasks, to facilitate data integration, and to increase the functionality of another application. Non-software engineers can now use APIs to automate configuration or data collection from network devices.

8. What is a webhook for REST APIs?

  • It is an HTTP redirect to forward the API request to another web service.
  • It is an HTTP PUT message to update information on a website.
  • It is an HTTP UPDATE message to notify the user that an API request is successfully completed.
  • It is an HTTP callback to a URL to notify the client application that an event has occurred.

Explanation: A webhook is an HTTP callback, or an HTTP POST, to a specified URL that notifies the client application when a particular activity or event has occurred in one of the resources on the platform.

9. As part of creating an API request using Python, the following commands are entered. What is the purpose of this step?

ipaddr =
interface = Ethernet1/1
hostname = R1

  • to import Python modules
  • to request JSON data
  • to create functions to test the code
  • to create variables

Explanation: When a script is being coded or created, a variable can be used to store information. The variable name is to the left and the value is to the right.

10. A web service uses a rate limit algorithm that puts all incoming REST API requests into a queue in the order in which they arrive. The algorithm allows incoming requests to arrive at any rate, but the server processes the requests from the queue at a fixed rate. Which rate limit algorithm is used by the web service?

  • token bucket
  • fixed window counter
  • sliding window counter
  • leaky bucket

Explanation: Common rate limit algorithms include the following:

  • Leaky bucket
  • Token bucket
  • Fixed window counter
  • Sliding window counter

The leaky bucket algorithm puts all incoming requests into a request queue in the order in which they were received. The incoming requests can come in at any rate, but the server will process the requests from the queue at a fixed rate. If the request queue is full, the request is rejected.

11. What is an application requirement in order to receive a notification from a webhook provider?

  • The application must provide a syslog service.
  • The application must accept HTTP UPDATE messages from the webhook provider.
  • The application must register a unique domain name from a certificate authority.
  • The application must always be running to receive HTTP POST requests.

Explanation: In order to receive a notification from a webhook provider, the client application must meet certain requirements:

  • The application must always be running to receive HTTP POST requests.
  • The application must register a URI on the webhook provider, so that the provider knows where to send a notification when target events occur.
  • The application must handle the incoming notifications from the webhook server.

12. Which RESTful operation corresponds to the HTTP GET method?

  • update
  • patch
  • read
  • post

Explanation: RESTful operations correspond to the following HTTP methods (shown to the left with the RESTful operation on the right):

  • POST > Create
  • GET > Read
  • PUT/PATCH > Update
  • DELETE > Delete

Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x