-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
73824bf
commit c1c2ab5
Showing
38 changed files
with
2,609 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 0 additions & 28 deletions
28
challenger/src/main/resources/content/apichallenges/howto.md
This file was deleted.
Oops, something went wrong.
124 changes: 124 additions & 0 deletions
124
challenger/src/main/resources/content/apichallenges/solutions.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
--- | ||
title: API Challenges Solution Index | ||
--- | ||
|
||
# API Challenge Solutions | ||
|
||
## Getting Started | ||
|
||
- [POST /challenger (201)](/apichallenges/solutions/create-session/post-challenger-201) | ||
|
||
## First Real Challenge | ||
|
||
- [GET /challenges (200)](/apichallenges/solutions/first-challenge/get-challenges-200) | ||
|
||
## GET Challenges | ||
|
||
- [GET /todos (200)](/apichallenges/solutions/get/get-todos-200) | ||
- [GET /todo (404)](/apichallenges/solutions/get/get-todo-404) | ||
- [GET /todos id (200)](/apichallenges/solutions/get/get-todos-id-200) | ||
- [GET /todos id (404)](/apichallenges/solutions/get/get-todos-id-404) | ||
- [GET /todos ?filter (200)](/apichallenges/solutions/get/get-todos-200-filter) | ||
|
||
## HEAD Challenges | ||
|
||
- [HEAD /todos id (200)](/apichallenges/solutions/head/head-todos-200) | ||
|
||
## Creation Challenges with POST | ||
|
||
- [POST /todos id (201)](/apichallenges/solutions/post-create/post-todos-201) | ||
- [POST /todos (400) doneStatus](/apichallenges/solutions/post-create/post-todos-400) | ||
- POST /todos (400) title too long | ||
- POST /todos (400) description too long | ||
- POST /todos (201) max out content | ||
- POST /todos (413) content too long | ||
- POST /todos (400) extra | ||
|
||
## Creation Challenges with PUT | ||
|
||
- PUT /todos/{id} (400) | ||
|
||
## Update Challenges with POST | ||
|
||
- [POST /todos id (200)](/apichallenges/solutions/post-update/post-todos-id-200) | ||
- POST /todos/{id} (404) | ||
|
||
## Update Challenges with PUT | ||
|
||
- PUT /todos/{id} full (200) | ||
- PUT /todos/{id} partial (200) | ||
- PUT /todos/{id} no title (400) | ||
- PUT /todos/{id} no amend id (400) | ||
|
||
## DELETE Challenges | ||
|
||
- [DELETE /todos id (200)](/apichallenges/solutions/delete/delete-todos-id-200) | ||
|
||
## OPTIONS Challenges | ||
|
||
- [OPTIONS /todos (200)](/apichallenges/solutions/options/options-todos-200) | ||
|
||
## Accept Header Challenges | ||
|
||
- [GET /todos (200) XML](/apichallenges/solutions/accept-header/get-todos-200-xml) | ||
- [GET /todos (200) JSON](/apichallenges/solutions/accept-header/get-todos-200-json) | ||
- [GET /todos (200) ANY](/apichallenges/solutions/accept-header/get-todos-200-any) | ||
- [GET /todos (200) XML pref](/apichallenges/solutions/accept-header/get-todos-200-xml-pref) | ||
- [GET /todos (200) no accept](/apichallenges/solutions/accept-header/get-todos-200-no-accept) | ||
- [GET /todos (406)](/apichallenges/solutions/accept-header/get-todos-406) | ||
|
||
## Content-Type Header Challenges | ||
|
||
- [POST /todos XML](/apichallenges/solutions/content-type-header/post-todos-xml) | ||
- [POST /todos JSON](/apichallenges/solutions/content-type-header/post-todos-json) | ||
- [POST /todos (415)](/apichallenges/solutions/content-type-header/post-todos-415) | ||
|
||
## Fancy a Break? Restore your session | ||
|
||
- GET /challenger/guid (existing X-CHALLENGER) | ||
- PUT /challenger/guid RESTORE | ||
- PUT /challenger/guid CREATE | ||
- GET /challenger/database/guid (200) | ||
- PUT /challenger/database/guid (Update) | ||
|
||
## Mix Accept and Content-Type Challenges | ||
|
||
- [POST /todos XML to JSON](/apichallenges/solutions/mix-accept-content/post-xml-accept-json) | ||
- [POST /todos JSON to XML](/apichallenges/solutions/mix-accept-content/post-json-accept-xml) | ||
|
||
## Status Code Challenges | ||
|
||
- [Solve the 405, 500, 501 and 204 Status Code Challenges](/apichallenges/solutions/status-codes/status-codes-405-500-501-204) | ||
- DELETE /heartbeat (405) | ||
- PATCH /heartbeat (500) | ||
- TRACE /heartbeat (501) | ||
- GET /heartbeat (204) | ||
|
||
## HTTP Method Override Challenges | ||
|
||
- POST /heartbeat as DELETE (405) | ||
- POST /heartbeat as PATCH (500) | ||
- POST /heartbeat as Trace (501) | ||
|
||
## Authentication Challenges | ||
|
||
- [POST /secret/token (401)](/apichallenges/solutions/authentication/post-secret-401) | ||
- [POST /secret/token (201)](/apichallenges/solutions/authentication/post-secret-201) | ||
|
||
## Authorization Challenges | ||
|
||
- [GET /secret/note (403)](/apichallenges/solutions/authorization/get-secret-note-403) | ||
- [GET /secret/note (401)](/apichallenges/solutions/authorization/get-secret-note-401) | ||
- [GET /secret/note (200)](/apichallenges/solutions/authorization/get-secret-note-200) | ||
- [POST /secret/note (200)](/apichallenges/solutions/authorization/post-secret-note-200) | ||
- [POST /secret/note (401) && (403)](/apichallenges/solutions/authorization/post-secret-note-401-403) | ||
- POST /secret/note (401) | ||
- POST /secret/note (403) | ||
- [GET && POST /secret/note (Bearer)](/apichallenges/solutions/authorization/get-post-secret-note-bearer) | ||
- GET /secret/note (Bearer) | ||
- POST /secret/note (Bearer) | ||
|
||
## Miscellaneous Challenges | ||
|
||
- DELETE /todos/{id} (200) all | ||
- POST /todos (201) all |
90 changes: 90 additions & 0 deletions
90
...in/resources/content/apichallenges/solutions/accept-header/get-todos-200-any.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
--- | ||
date: 2021-05-29T09:30:00Z | ||
title: API Challenges Solution For - GET todos any 200 | ||
description: How to solve API challenge GET todos any 200 to accept the todos in default format. | ||
--- | ||
|
||
# GET all the todos in default format | ||
|
||
How to complete the challenge `GET /todos ANY (200)` to successfully GET all the todos in default format. | ||
|
||
## GET /todos ANY (200) | ||
|
||
> Issue a GET request on the `/todos` end point with an `Accept` header of `*/*` to receive results in Default format | ||
- `GET` request will receive a response with all the todo items | ||
- e.g. `GET /todos` to get all the todo items | ||
- `200` is a success code, in this case it means the end point exists and the `todo items were returned | ||
- `Accept` means that an `Accept` header was added to specify that the todos should be returned in **ANY** format i.e. the default from the server | ||
- add the `X-CHALLENGER` header to track progress | ||
|
||
|
||
## Basic Instructions | ||
|
||
- Issue a `GET` request to end point "/todos" | ||
- if running locally that endpoint would be | ||
- `http://localhost:4567/todos` | ||
- if running in the cloud that endpoint would be | ||
- `https://apichallenges.herokuapp.com/todos` | ||
- The request should have an `Accept` header specifying ANY format by using a value of `*/*`, our application defaults to JSON | ||
- The request should have an `X-CHALLENGER` header to track challenge completion | ||
- The response status code should be `200` when all the details are valid. | ||
- Check the body of the message has JSON format data, which is the default from the server | ||
- Check the `content-type` header in the response has `application/json` | ||
|
||
|
||
## Example Request | ||
|
||
~~~~~~~~ | ||
> GET /todos HTTP/1.1 | ||
> Host: apichallenges.herokuapp.com | ||
> User-Agent: insomnia/2021.2.2 | ||
> X-CHALLENGER: x-challenger-guid | ||
> Accept: */* | ||
~~~~~~~~ | ||
|
||
## Example Response | ||
|
||
~~~~~~~~ | ||
< HTTP/1.1 200 OK | ||
< Connection: close | ||
< Date: Sat, 29 May 2021 09:06:15 GMT | ||
< Content-Type: application/json | ||
< Access-Control-Allow-Origin: * | ||
< Access-Control-Allow-Headers: * | ||
< X-Challenger: x-challenger-guid | ||
< Server: Jetty(9.4.z-SNAPSHOT) | ||
< Via: 1.1 vegur | ||
~~~~~~~~ | ||
|
||
Example Response body: | ||
|
||
```json | ||
{ | ||
"todos": [ | ||
{ | ||
"id": 235, | ||
"title": "pay invoices", | ||
"doneStatus": false, | ||
"description": "" | ||
}, | ||
{ | ||
"id": 239, | ||
"title": "tidy meeting room", | ||
"doneStatus": false, | ||
"description": "" | ||
} | ||
] | ||
} | ||
``` | ||
|
||
|
||
## Overview Video | ||
|
||
{{<youtube-embed key="O4DhJ8Ohkk8">}} | ||
|
||
[Patreon ad free version](https://www.patreon.com/posts/51830126) | ||
|
||
|
||
|
||
|
88 changes: 88 additions & 0 deletions
88
...n/resources/content/apichallenges/solutions/accept-header/get-todos-200-json.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
--- | ||
date: 2021-05-09T09:30:00Z | ||
title: API Challenges Solution For - GET todos json 200 | ||
description: How to solve API challenge GET todos json 200 to accept the todos in json format. | ||
--- | ||
|
||
# GET all the todos in JSON format | ||
|
||
How to complete the challenge `GET /todos JSON (200)` to successfully GET all the todos in JSON format. | ||
|
||
## GET /todos JSON (200) | ||
|
||
> Issue a GET request on the `/todos` end point with an `Accept` header of `application/json` to receive results in JSON format | ||
- `GET` request will receive a response with all the todo items | ||
- e.g. `GET /todos` to get all the todo items | ||
- `200` is a success code, in this case it means the end point exists and the `todo items were returned | ||
- `Accept` means that an `Accept` header was added to specify that the todos should be returned in **JSON** format | ||
- add the `X-CHALLENGER` header to track progress | ||
|
||
|
||
## Basic Instructions | ||
|
||
- Issue a `GET` request to end point "/todos" | ||
- if running locally that endpoint would be | ||
- `http://localhost:4567/todos` | ||
- if running in the cloud that endpoint would be | ||
- `https://apichallenges.herokuapp.com/todos` | ||
- The request should have an `Accept` header specifying JSON format by using a value of `application/json` | ||
- The request should have an `X-CHALLENGER` header to track challenge completion | ||
- The response status code should be `200` when all the details are valid. | ||
- Check the body of the message has JSON format data | ||
- Check the `content-type` header in the response has `application/json` | ||
|
||
|
||
## Example Request | ||
|
||
~~~~~~~~ | ||
> GET /todos HTTP/1.1 | ||
> Host: apichallenges.herokuapp.com | ||
> User-Agent: rest-client | ||
> X-CHALLENGER: x-challenger-guid | ||
> Accept: application/json | ||
~~~~~~~~ | ||
|
||
## Example Response | ||
|
||
~~~~~~~~ | ||
< HTTP/1.1 200 OK | ||
< Connection: close | ||
< Date: Sun, 09 May 2021 11:07:48 GMT | ||
< Content-Type: application/json | ||
< Access-Control-Allow-Origin: * | ||
< Access-Control-Allow-Headers: * | ||
< X-Challenger: x-challenger-guid | ||
< Server: Jetty(9.4.z-SNAPSHOT) | ||
< Via: 1.1 vegur | ||
~~~~~~~~ | ||
|
||
Example Response body: | ||
|
||
```json | ||
{ | ||
"todos": [ | ||
{ | ||
"id": 16, | ||
"title": "process payroll", | ||
"doneStatus": false, | ||
"description": "" | ||
}, | ||
{ | ||
"id": 15, | ||
"title": "pay invoices", | ||
"doneStatus": false, | ||
"description": "" | ||
} | ||
] | ||
} | ||
``` | ||
|
||
## Overview Video | ||
|
||
{{<youtube-embed key="79JTHiby2Qw">}} | ||
|
||
[Patreon ad free version](https://www.patreon.com/posts/51045284) | ||
|
||
|
||
|
Oops, something went wrong.