The Projecto API is a RESTful API that allows users to manage projects, tasks, team members, and technical documents. It provides endpoints for creating, retrieving, updating, and deleting these resources.
- Installation
- Usage
- Authentication
- Endpoints
- Permissions
- Error Handling
- Management Commands
- Contributing
To run the Projecto API locally, follow these steps:
- Clone the repository:
git clone https://github.com/your-repo.git
- Navigate to the project directory:
cd projets
- Install the dependencies:
pip install -r requirements.txt
- Set up the database:
python manage.py migrate
- Start the development server:
python manage.py runserver
The API will be accessible at http://localhost:8000/
.
To use the Projecto API, you can make HTTP requests to the provided endpoints using a tool like cURL or an API testing tool like Postman.
Before making requests, make sure to authenticate yourself and obtain an access token (see Authentication section).
The Projecto API uses token-based authentication. To authenticate yourself and obtain an access token, follow these steps:
- Send a POST request to
/api/login/
with your username and password in the request body. - If the credentials are valid, you will receive a response with an access token.
- Include the access token in the
Authorization
header of subsequent requests asBearer {access_token}
.
The Projecto API provides the following endpoints:
GET /api/projects/
: Retrieve a list of projects.POST /api/projects/
: Create a new project.GET /api/projects/{project_id}/
: Retrieve a specific project.PUT /api/projects/{project_id}/
: Update a specific project.DELETE /api/projects/{project_id}/
: Delete a specific project.
GET /api/projects/{project_id}/tasks/
: Retrieve a list of tasks in a project.POST /api/projects/{project_id}/tasks/
: Create a new task in a project.GET /api/projects/{project_id}/tasks/{task_id}/
: Retrieve a specific task in a project.PUT /api/projects/{project_id}/tasks/{task_id}/
: Update a specific task in a project.DELETE /api/projects/{project_id}/tasks/{task_id}/
: Delete a specific task in a project.
GET /api/projects/{project_id}/team-members/
: Retrieve a list of team members in a project.POST /api/projects/{project_id}/team-members/
: Add a new team member to a project.GET /api/projects/{project_id}/team-members/{team_member_id}/
: Retrieve a specific team member in a project.PUT /api/projects/{project_id}/team-members/{team_member_id}/
: Update a specific team member in a project.DELETE /api/projects/{project_id}/team-members/{team_member_id}/
: Remove a specific team member from a project.
GET /api/projects/{project_id}/tasks/{task_id}/technical-documents/
: Retrieve a list of technical documents for a task.POST /api/projects/{project_id}/tasks/{task_id}/technical-documents/
: Create a new technical document for a task.GET /api/projects/{project_id}/tasks/{task_id}/technical-documents/{document_id}/
: Retrieve a specific technical document for a task.PUT /api/projects/{project_id}/tasks/{task_id}/technical-documents/{document_id}/
: Update a specific technical document for a task.DELETE /api/projects/{project_id}/tasks/{task_id}/technical-documents/{document_id}/
: Delete a specific technical document for a task.
POST /api/register/
: Register a user.
POST /api/login/
: Log in and obtain an access token.POST /api/logout/
: Log out.
- Checks if the user is authenticated and belongs to the 'project_managers' group.
- For object-level permission, allows PUT, PATCH, DELETE requests only if the user is a project manager and is the owner of the project.
- Checks if the user is authenticated and belongs to the 'engineers' group.
- For object-level permission, allows PUT, PATCH, DELETE requests only if the user is an engineer and is the owner of the task.
The admin can manage user groups ('project_managers', 'engineers') assigning the corresponding permissions to enable users to access endpoints based on their roles.
The Projecto API follows standard HTTP status codes for indicating the success or failure of a request. In case of an error, the response will include an error message in the body.
Common error codes and their meanings:
- 400 Bad Request: The request was invalid or missing required parameters.
- 401 Unauthorized: The request requires authentication or the provided credentials are invalid.
- 403 Forbidden: The authenticated user does not have permission to access the requested resource.
- 404 Not Found: The requested resource was not found.
- 500 Internal Server Error: An unexpected error the server.
- Use this command to populate the database with sample data.
- Run:
python manage.py populate_sample_data
- Use this command to clear the database and remove all existing data.
- Run:
python manage.py clear_data
If you would like to contribute to the development of the projecto API, follow these steps:
- Fork the repository on GitHub.
- Create a new branch for your feature or bug fix:
git checkout -b feature/your-feature-name
orgit checkout -b bugfix/your-bug-fix-name
. - Make your changes and commit them:
git commit -m "Your commit message"
. - Push your changes to your forked repository:
git push origin feature/your-feature-name
orgit push origin bugfix/your-bug-fix-name
. - Submit a pull request on GitHub.
Please make sure to follow the existing code style and include tests for your changes.
If you have any questions or need further assistance, please contact us at [[email protected]].
Thank you for using the Projecto API!