Edit Post - AmFlint/SI-Hybrid-Api GitHub Wiki
Update a post
URL
http://212.47.231.5/posts/{id}
Http Method
PUT
Headers
X-Access-Token: json-web-token for authenticated user.
Http Status Codes
- 400: Bad Request
- 401: Authentication required
- 404: Post not found for current user
Query Parameters
title: string - The title of the postcontent: string - The content of the postdifficulty: integer - the difficulty level for the place to discoverlocation: string - the location of the place
Request
- Request with Valid Informations
curl -X -H "X-Access-Token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1MTYxMzc5MDcsInVzZXJuYW1lIjoiYW1hc3NlbG90IiwidXNlcklkIjoxLCJpYXQiOjE1MTYxMzQzMDd9.789Uwt-IRWxtgRBxLtpnIifz4PQ54HcMqz7T188Wfi4" -H "Content-Type: application/json" -X PUT -d '{"title":"test", "location": "Paris 75013", "difficulty": "5", "content":"this is the content"}' http://localhost:3000/posts/9
- Response
{
"id": 9,
"title": "test",
"location": "Paris 75013",
"difficulty": "5",
"content": "this is the content",
"userId": 26,
"updatedAt": "2018-01-17T10:27:05.016Z",
"createdAt": "2018-01-17T10:27:05.016Z"
}