A back-end API using Flask framework built at IMIE/Caen
What follows will help you to build this API on your own computer
Python 2.7 :
Pip :
- Build dependancies
All pip's dependances are located in requirements.txt
- Acessing our app
Using a console, move to the project folder then execute server.py with Python 2 >= 2.7
- URL: /tokens
- Description: Request a session token to uses other api endpoints.
- Method: POST
- headers: Content-type: application/json
- Returns: 200 (OK) with token as payload 401(UNAUTHORIZED)
- URL: /tokens
- Description: Destroys a session identified by a session token.
- Method: DELETE
- headers: Content-type: application/json \n Authorization : given valid webtoken
- Returns: 204 (no content) 410 (Gone)
- URL: /posts/list
- Description: Return the list of existing posts.
- Method: GET
- headers: Content-type: application/json \n Authorization : given valid webtoken
- Returns: 200 (ok) payload: TODO
- URL: /posts/:id
- Description: Return the post datas identified by the given id
- Method: GET
- headers: Content-type: application/json \n Authorization : given valid webtoken
- Returns: 200 (ok) payload: TODO
- URL: /posts/
- Description: Create a post with the datas sent as payload
- Method: POST
- headers: Content-type: application/json \n Authorization : given valid webtoken
- body *:
{
"title" : "A fancy title",
"corpus" : "Some Lorem Ipsum",
"imageLink" : "some direct link to an hosted image",
"tags" : "Il,est,grand,temps,de,rallumer,les,etoiles",
"isActive" : True
}
- Returns: 200 (ok)
- URL: /posts/:id
- Description: Delete the post identified by the given id
- Method: DELETE
- headers: Content-type: application/json \n Authorization : given valid webtoken
- Returns: 204 (no content) 410 (gone) payload: TODO
Login user to our API
{
"username" : " Username",
"password" : " Your password "
}
200 (OK) | 302 (FOUND)
200 (OK)
{
"token": " JWT Token"
}
Add a user to our API
{
"username": " Username",
"email" : " Mail",
"password" : " Your password "
}
Add a given user to the database
Return a list of all users
{
User
{
email: " mail of a given user",
username: "username of a given user"
},
...
}
Send an email to a given username/email combo
{
"username" : " Username",
"email" : " Email"
}
reset password of a given user
{
"pass": "new password"
"confirm": "new password again"
}
- Clément T
- Martin M
- Quentin T