How to complete the challenge PATCH /todos/id (200) merge-patch
Use PATCH with Content-Type: application/merge-patch+json when you want to send a JSON Merge Patch document.
The merge-patch may look similar to the
application/jsonpatch. But the main difference is the standard handling. Any API can use whatever conventions it wants to handle anapplication/jsonpatch. The API Challenges app ignores your request if you try to set a mandatory field tonull. But in amerge-patch+jsonstandard, anullis a delete and you can't delete a mandatory field so you would see an error. Feel free to experiment with this after you complete the challenge.
PATCH /todos/id (200) merge-patch
Issue a PATCH request to update an existing todo using JSON Merge Patch.
- Use
PATCH /todos/{id}where{id}is an existing todo id. - Add
Content-Type: application/merge-patch+jsonfor the JSON Merge Patch standard. - Send a JSON object containing the fields to add, replace, or remove.
- The response should be
200. - Fields that are not in the merge patch document should keep their existing values.
- You can learn more about PATCH in the HTTP verbs tutorial.
Basic Instructions
- Issue a
PATCHrequest to:https://apichallenges.eviltester.com/todos/{{firstTodoId}}
- The request should have an
X-CHALLENGERheader so the challenge is tracked. - The request body can be a JSON Merge Patch object:
{
"description": "patched with merge patch"
}
Try it now
Example Request
> PATCH /todos/3 HTTP/1.1
> Host: apichallenges.eviltester.com
> User-Agent: rest-client
> X-CHALLENGER: x-challenger-guid
> Content-Type: application/merge-patch+json
> Accept: application/json
>
> {"description":"patched with merge patch"}
Example Response
< HTTP/1.1 200 OK
< Content-Type: application/json
< Accept-Patch: application/json, application/merge-patch+json, application/json-patch+json
< X-Challenger: x-challenger-guid
Returned body:
{
"id": 3,
"title": "existing title",
"doneStatus": false,
"description": "patched with merge patch"
}