-
Notifications
You must be signed in to change notification settings - Fork 2
RESTful API P5
annypanny edited this page Nov 29, 2016
·
10 revisions
/posts/[post_id]/update
- It used to let the authenticate author edit their own post.
- It send a JSON file to the server.
- JSON file contains:
- "id"
- "title"
- "description"
- "content_type"
- "content"
- "image"
- "visibility"
Method:
PUT
Example:
GET /posts/95875f36-9dc0-4672-b733-6c9bf84c2eba/update
HTTP 405 Method Not Allowed
Allow: PUT, PATCH, OPTIONS
Content-Type: application/json
Vary: Accept
{
"detail": "Method \"GET\" not allowed."
}
After the author enter the edited text, it will show:
PUT /posts/95875f36-9dc0-4672-b733-6c9bf84c2eba/update
HTTP 200 OK
Allow: PUT, PATCH, OPTIONS
Content-Type: application/json
Vary: Accept
{
"id": "95875f36-9dc0-4672-b733-6c9bf84c2eba",
"title": "Annnnnny",
"description": "xmas",
"contentType": "text/plain",
"content": "Merrrrrrrrrry Christmas!!!!!!!!",
"image": "",
"visibility": "PUBLIC"
}