0
0
Rest APIprogramming~20 mins

Endpoint documentation structure in Rest API - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Endpoint Documentation Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
1:30remaining
What is the output of this OpenAPI snippet?
Given this OpenAPI endpoint documentation snippet, what is the value of the summary field for the GET method?
Rest API
{
  "paths": {
    "/users": {
      "get": {
        "summary": "Retrieve list of users",
        "responses": {
          "200": {
            "description": "A JSON array of user names"
          }
        }
      }
    }
  }
}
ARetrieve list of users
BList all users
CGET /users endpoint
DA JSON array of user names
Attempts:
2 left
💡 Hint
Look for the summary key inside the GET method object.
🧠 Conceptual
intermediate
1:00remaining
Which field describes the expected response status code in REST API docs?
In REST API endpoint documentation, which field typically specifies the HTTP status code returned by the server?
Aresponses
Bparameters
CrequestBody
Dsummary
Attempts:
2 left
💡 Hint
Think about where the server tells what it sends back.
🔧 Debug
advanced
2:00remaining
Identify the error in this endpoint documentation snippet
What error will this OpenAPI snippet cause when validating the documentation?
Rest API
{
  "paths": {
    "/items/{itemId}": {
      "get": {
        "parameters": [
          {
            "name": "itemId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Item details"
          }
        }
      }
    }
  }
}
ASchema type should be 'integer' not 'string'
BMissing response status code 404 for not found
CParameter location should be 'path' not 'query' for path variables
DParameters array should be empty for GET requests
Attempts:
2 left
💡 Hint
Check the in field for the path parameter.
📝 Syntax
advanced
1:30remaining
Which option is the correct syntax for defining a POST request body in OpenAPI?
Select the correct JSON snippet that defines a POST request body with a JSON schema for a user object.
A"body": {"content": {"application/json": {"schema": {"type": "object", "properties": {"name": {"type": "string"}}}}}}
B"requestBody": {"content": {"application/json": {"schema": {"type": "object", "properties": {"name": {"type": "string"}}}}}}
C"requestBody": {"schema": {"type": "object", "properties": {"name": {"type": "string"}}}}
D"requestBody": {"content": {"application/xml": {"schema": {"type": "object", "properties": {"name": {"type": "string"}}}}}}
Attempts:
2 left
💡 Hint
Look for the correct key names and content type for JSON.
🚀 Application
expert
1:00remaining
How many parameters are defined in this endpoint documentation?
Count the total number of parameters defined for this endpoint, including path, query, and header parameters.
Rest API
{
  "paths": {
    "/search": {
      "get": {
        "parameters": [
          {"name": "q", "in": "query", "required": true, "schema": {"type": "string"}},
          {"name": "limit", "in": "query", "schema": {"type": "integer"}},
          {"name": "Authorization", "in": "header", "required": true, "schema": {"type": "string"}}
        ],
        "responses": {
          "200": {"description": "Search results"}
        }
      }
    }
  }
}
A2
B1
C4
D3
Attempts:
2 left
💡 Hint
Count all items inside the parameters array.