This document provides a comprehensive reference for the API endpoints available in the PiConnect Ecosystem. Each endpoint includes details about the request method, URL, parameters, and response format.
All API endpoints are relative to the base URL:
http://localhost:5000/api
/users/login
POST
{
"username": "string",
"password": "string"
}
{
"token": "string",
"user": {
"id": "string",
"username": "string",
"email": "string"
}
}
{
"message": "Invalid credentials"
}
/users/register
POST
{
"username": "string",
"password": "string",
"email": "string"
}
{
"user": {
"id": "string",
"username": "string",
"email": "string"
}
}
{
"message": "User already exists"
}
/users/:userId
GET
{
"id": "string",
"username": "string",
"email": "string"
}
{
"message": "User not found"
}
/charities
GET
[
{
"id": "string",
"name": "string",
"description": "string"
}
]
/charities
POST
{
"name": "string",
"description": "string"
}
{
"charity": {
"id": "string",
"name": "string",
"description": "string"
}
}
/charities/:charityId
GET
{
"id": "string",
"name": "string",
"description": "string"
}
{
"message": "Charity not found"
}
/charities/:charityId/donate
POST
{
"amount": "number"
}
{
"message": "Thank you for your donation!",
"donation": {
"id": "string",
"charityId": "string",
"amount": "number",
"date": "string"
}
}
{
"message": "Invalid donation amount"
}
/notifications/:userId
GET
[
{
"id": "string",
"message": "string",
"read": "boolean",
"date": "string"
}
]
/notifications
POST
{
"userId": "string",
"message": "string"
}
{
"notification": {
"id": "string",
"message": "string",
"read": false,
"date": "string"
}
}
/analytics/overview
GET
{
"totalUsers": "number",
"totalDonations": "number",
"totalCharities": "number"
}
/analytics/donations
GET
{
"donations": [
{
"charityId": "string",
"totalAmount": "number",
"donationCount": "number"
}
]
}
All API responses will include appropriate HTTP status codes to indicate success or failure. In case of an error, the response will contain a message detailing the issue.
This API reference serves as a guide for developers to understand how to interact with the PiConnect Ecosystem’s backend services. By following the provided endpoints and formats, developers can effectively integrate and utilize the API in their applications. If you have any questions or need further clarification, please reach out to the project maintainers.