Require python3
python3 -m pip install -r requirements.txt
You can launch the app via command line :
python3 app.py
or you can use your integrated python extension in your IDE.
Go to your-domain/cleanwalks or your-domain/users
https://www.usebruno.com/downloads
- open collection --> "api-client" folder in cleanwalk repo
- select environement and add secrets variables like email token api-key ... . https://docs.usebruno.com/secrets-management/secret-variables
- Route:
/users/login
-
Description: Log in by providing a valid email and password.
-
Example:
{
"email": "[email protected]",
"password": "azerty"
}
- Route:
/users/token-login
- Description: Log in using a valid JWT token (obtained from the login route).
- Note: Requires adding the JWT token to the request headers (bearer token).
- Route:
/users/:user_id
- Description: Retrieve details of a specific user by providing their ID.
- Note: Requires adding the JWT token to the request headers to access this route.
- Route:
/users
- Description: Retrieve all registered users.
- Note: Requires adding the JWT token to the request headers to access this route.
- Route:
/users
- Description: Create a new user by providing the required information.
- Example:
- Note: role_id: 1 == user | 2 == organisation
{
"firstname": "Arthur",
"lastname": "Frin",
"email": "[email protected]",
"password": "azerty",
"profile_picture": "image_url",
"role_id": 1
}
- Route:
/users/:user_id
- Description: Delete a specific user by providing their ID.
- Note: Requires adding the JWT token to the request headers to access this route.
- Route:
/users/:user_id
- Description: Update information for a specific user by providing their ID.
- Example:
{
"firstname": "New first name",
"lastname": "New last name",
"email": "[email protected]",
"profile_picture": "new_image_url"
}
-
Route:
/cleanwalks/<int:cleanwalk_id>
-
Description: Retrieve details of a specific Cleanwalk by providing its ID.
-
Note: Requires adding a valid API key to the request headers.
-
Route:
/cleanwalks
-
Description: Retrieve information for all registered Cleanwalks.
-
Note: Requires adding a valid API key to the request headers.
-
Route:
/cleanwalks
-
Description: Create a new Cleanwalk by providing the required information.
-
Example:
{ "name": "City Cleanup", "pos_lat": 40.7128, "pos_long": -74.0060, "date_begin": "2024-01-15", "duration": 2, "description": "Community cleanup event", "city_id": 1, "address": "123 Main St" }
-
Route:
/cleanwalks/<int:cleanwalk_id>
-
Description: Update information for a specific Cleanwalk by providing its ID.
-
Example:
{ "name": "Updated Cleanup", "pos_lat": 40.7128, "pos_long": -74.0060, "date_begin": "2024-01-20", "duration": 3, "description": "Updated community cleanup event", "city_id": 1, "address": "456 Main St" }
Requires adding a valid API key to the request headers.
-
Route:
/cleanwalks/<int:cleanwalk_id>
-
Description: Delete a specific Cleanwalk by providing its ID.
-
Note: Requires adding a valid API key to the request headers.
-
Route:
/cities/<int:city_id>
-
Description: Retrieve details of a specific city by providing its ID.
-
Note: Requires adding a valid API key to the request headers.
-
Route:
/cities
-
Description: Retrieve information for all registered cities.
-
Note: Requires adding a valid API key to the request headers.
-
Route:
/cities
-
Description: Create a new city by providing the required information.
-
Example:
{ "name": "New City" }
-
Route:
/cities/<int:city_id>
-
Description: Update information for a specific city by providing its ID.
-
Example:
{ "name": "Updated City" }
Requires adding a valid API key to the request headers.
-
Route:
/cities/<int:city_id>
-
Description: Delete a specific city by providing its ID.
-
Note: Requires adding a valid API key to the request headers.
-
Route:
/articles/<int:article_id>
-
Description: Retrieve details of a specific article by providing its ID.
-
Note: Requires adding a valid API key to the request headers.
-
Route:
/articles
-
Description: Retrieve information for all registered articles.
-
Note: Requires adding a valid API key to the request headers.
-
Route:
/articles
-
Description: Create a new article by providing the required information.
-
Example:
{ "title": "New Article", "author_id": 1, "description": "Article description", "content": "Article content" }
-
Route:
/articles/<int:article_id>
-
Description: Update information for a specific article by providing its ID.
-
Example:
{ "title": "Updated Article", "description": "Updated article description", "content": "Updated article content" }
Requires adding a valid API key to the request headers.
-
Route:
/articles/<int:article_id>
-
Description: Delete a specific article by providing its ID.
-
Note: Requires adding a valid API key to the request headers.
Note: Make sure to include a valid API key in the request headers for routes that require authentication. The API key can be obtained and validated through the X-API-Key
header.