API is supplied for educational purposes only.
It isn't intended for general public use and may change or be removed without notice.
Information
This API supports a student exercise utilizing Postman and the National Park Service API.
Throughout the documentation curly braces are used to indicate values that must be substituted.
All requests to this API must use the following base URL:
https://teapi.netlify.app/api/national-park-exercise/{endpoint}
Get the challenges
To get the exercises challenges, use the following endpoints:
- GET
/api/national-park-exercise/challenges/
- returns all challenges - GET
/api/national-park-exercise/challenges/{id}
- returns a single challenge
Example
GET https://teapi.netlify.app/api/national-park-exercise/challenges/1
{
"id": 1,
"question": "How many parks does the National Parks API provide data on?",
"hint": "Use /parks to retrieve data about national parks.",
"answer": ""
}
Response
Name | Description | Type |
id | The id for this challenge. | number |
question | The question to be answered for this challenge. | string |
hint | A hint for how to solve the challenge. | string |
answer | A JSON template for the challenge solution. This JSON format is required by the POST endpoint to verify this challenge. If template is an empty string, only a single answer is required. | string or JSON |
Verify a challenge
To check the solution for a challenge, use the following endpoint:
POST /api/national-park-exercise/challenges/{id}/verify
If the challenge was answered correctly, a 200 status is returned. If the answer is incorrect, a 4xx status code is returned. Check the response for a message.
The request body must contain the following:
apiKey
- the API key to use for access to the National Park Service APIanswer
- the challenge answer using the JSON format supplied in the challenge
Example
POST https://teapi.netlify.app/api/national-park-exercise/challenges/1/verify
Request Body
{
"apiKey": "1a2b3c4d5e6f7g8h9i0j1k2l3m4n5o6p7q8r9s0t", // your NPS API key
"answer": "23"
}