nerdexam
Cisco

350-901 · Question #89

Refer to the exhibit. An application's REST API GET call is tested to the inventory database. Which missing code must be included to limit the number of values that are returned from the query to 20?

The correct answer is D. inventory?limit=20. REST API query parameters are appended to the resource path using a '?' delimiter followed by key=value pairs, so limiting results to 20 uses the format 'inventory?limit=20'.

Understanding and Using APIs

Question

Refer to the exhibit. An application's REST API GET call is tested to the inventory database. Which missing code must be included to limit the number of values that are returned from the query to 20?

Options

  • A?inventory=20
  • Blimit=2Q
  • Cinventory=limit?20
  • Dinventory?limit=20

How the community answered

(23 responses)
  • A
    4% (1)
  • C
    4% (1)
  • D
    91% (21)

Why each option

REST API query parameters are appended to the resource path using a '?' delimiter followed by key=value pairs, so limiting results to 20 uses the format 'inventory?limit=20'.

A?inventory=20

The format '?inventory=20' sets a query parameter named 'inventory' to the value 20 rather than setting a 'limit' parameter, so it would not constrain the number of returned records.

Blimit=2Q

The string 'limit=2Q' contains a typographic error ('Q' instead of '0') and is also missing the required '?' delimiter between the resource path and the query string.

Cinventory=limit?20

The format 'inventory=limit?20' places the '?' in the wrong position and inverts the key-value relationship, making it syntactically invalid as a URL query parameter.

Dinventory?limit=20Correct

REST API query parameters are separated from the resource path by a '?' character, and each parameter is expressed as a key=value pair. The correct syntax 'inventory?limit=20' targets the inventory endpoint and passes 'limit' as a query parameter with a value of 20, which the server uses to restrict the number of records returned. This follows standard URL query string formatting defined in RFC 3986.

Concept tested: REST API query parameter syntax for pagination

Source: https://developer.cisco.com/learning/tracks/devnet-beginner/rest-api-fundamentals/

Topics

#REST API#Query Parameters#URL Syntax#Data Limiting

Community Discussion

No community discussion yet for this question.

Full 350-901 Practice