-
Notifications
You must be signed in to change notification settings - Fork 2
RESTful API A4
annypanny edited this page Nov 29, 2016
·
5 revisions
/author/[author_id]/update
- It used to update the current author's own info on the server.
- It returned a JSON.
- JSON file contains:
- "uid"
- "password"
- "email"
- "first_name"
- "last_name"
- "avatar"
- "github"
Method:
PUT
Example:
GET /authors/ae89f5ec-2502-4244-a579-cee6c83a9c17/update
HTTP 405 Method Not Allowed
Allow: POST, OPTIONS
Content-Type: application/json
Vary: Accept
{
"detail": "Method \"GET\" not allowed."
}
if you try to modify the info, but not the user, it would return:
PUT /authors/ae89f5ec-2502-4244-a579-cee6c83a9c17/update
HTTP 403 Forbidden
Allow: PUT, PATCH, OPTIONS
Content-Type: application/json
Vary: Accept
{
"detail": "You cant modify an author that is not you"
}
if you are the author, it would return:
PUT /authors/ae89f5ec-2502-4244-a579-cee6c83a9c17/update
HTTP 200 OK
Allow: PUT, PATCH, OPTIONS
Content-Type: application/json
Vary: Accept
{
"uid": "5",
"password": "pbkdf2_sha256$30000$ECi8rhdXVWgL$7kGgXAb52ERe3x8Kd5faUqh0wtFxcW4I2mPRp85PYk0=",
"email": "[email protected]",
"first_name": "Annnny",
"last_name": "P",
"github": "zxcn.com",
"avatar": ""
}