Repository navigation
Backend API User
Request format: Body not required. Authorization required.
Response status code and body format:
200
{
"id": "https://spongebook.herokuapp.com/author/41f7b891-e535-44ef-a795-b15f1dbab035",
"host": "https://spongebook.herokuapp.com/",
"username": "user1",
"displayName": "user1",
"url": "https://spongebook.herokuapp.com/author/41f7b891-e535-44ef-a795-b15f1dbab035",
"friends": [],
"github": null,
"email": "user1@email.com",
"bio": null
}
401 Unauthorized //when token not provided.
Request format:
{
"username":"user2",
"email": "user2@email.com",
"password1": "passqwer",
"password2": "passqwer"
}
Response status code and body format:
201 Created
{
"key": "cf0fef90f1ad4572e313df0fda01f00ca77be14f"
}
Request format:
{
"email":"user2@gmail.com",
"password":"passqwer"
}
Response status code and body format:
200 OK
{
"key": "cf0fef90f1ad4572e313df0fda01f00ca77be14f"
}
400 Bad Request
{
"non_field_errors": [
"Please wait for the approval of administrator"
]
}
400 Bad Request
{
"non_field_errors": [
"This email has not registered yet."
]
}
400 Bad Request
{
"username": [
"The email and the password are not matched."
]
}
Request format: Body not required.
Response status code and body format:
200 OK
[
{
"id": "https://spongebook.herokuapp.com/author/41f7b891-e535-44ef-a795-b15f1dbab035",
"host": "https://spongebook.herokuapp.com/",
"username": "user1",
"displayName": "user1",
"url": "https://spongebook.herokuapp.com/author/41f7b891-e535-44ef-a795-b15f1dbab035",
"friends": [],
"github": null,
"email": "user1@email.com",
"bio": null
},
{
"id": "https://spongebook.herokuapp.com/author/1d507e56-a6c6-42ca-be76-b6feb2cacfaa",
"host": "https://spongebook.herokuapp.com/",
"username": "user2",
"displayName": "user2",
"url": "https://spongebook.herokuapp.com/author/1d507e56-a6c6-42ca-be76-b6feb2cacfaa",
"friends": [],
"github": null,
"email": "user2@email.com",
"bio": ""
}
]
Example: {AUTHOR_ID} = 41f7b891-e535-44ef-a795-b15f1dbab03
http://127.0.0.1:8000/author/41f7b891-e535-44ef-a795-b15f1dbab035 GET
Request format: Body not required.
Response status code and body format:
200 OK
{
"id": "https://spongebook.herokuapp.com/author/41f7b891-e535-44ef-a795-b15f1dbab035",
"host": "https://spongebook.herokuapp.com/",
"username": "user2",
"displayName": "user1",
"url": "https://spongebook.herokuapp.com/author/41f7b891-e535-44ef-a795-b15f1dbab035",
"friends": [],
"github": null,
"email": "user1@email.com",
"bio": null
}
Request format: Authorization required
{
"github": "http://127.0.0.1:8000/",
"displayName": "user1 displayname",
"bio": "Hi, I am Jay"
}
Response status code and body format:
200 OK
{
"id": "https://spongebook.herokuapp.com/author/21276963-75a5-466a-8a8a-295584b00bc4",
"host": "https://spongebook.herokuapp.com/",
"username": "user1",
"displayName": "user1 displayname",
"url": "https://spongebook.herokuapp.com/author/21276963-75a5-466a-8a8a-295584b00bc4",
"friends": [],
"github": "http://127.0.0.1:8000/",
"email": "user1@email.com",
"bio": "Hi, I am Jay"
}
401 Unauthorized
{
"detail": "Authentication credentials were not provided."
}
403 Forbidden
{
"detail": "You must be the owner of the object."
}
400 Bad Request
{
"github": [
"Enter a valid URL."
]
}
Request format: Authorization required. Body not required.
Response status code and body format:
204 No Content
401 Unauthorized
{
"detail": "Authentication credentials were not provided."
}
401 Unauthorized
{
"detail": "Invalid token."
}
403 Forbidden
{
"detail": "You must be the owner of the object."
}
Request format: Authorization required. Body not required.
Response status code and body format:
200 OK
{
"GithubToken": "token"
}
401 Unauthorized
{
"detail": "Authentication credentials were not provided."
}
401 Unauthorized
{
"detail": "Invalid token."
}
403 Forbidden
{
"detail": "You must be the owner of the object."
}
Request format: Authorization required.
{
"GithubToken": "token"
}
Response status code and body format:
204 No Content
Social Distribution: Make post, Add friend, Enjoy life!
Copyright (C) 2020 Qiaoyan Zhang, Devin Dai, Zhonghao Lu, Yuan Wang, Isaac Zhang