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/loginPOST {
"username": "string",
"password": "string"
}
{
"token": "string",
"user": {
"id": "string",
"username": "string",
"email": "string"
}
}
{
"message": "Invalid credentials"
}
/users/registerPOST {
"username": "string",
"password": "string",
"email": "string"
}
{
"user": {
"id": "string",
"username": "string",
"email": "string"
}
}
{
"message": "User already exists"
}
/users/:userIdGET {
"id": "string",
"username": "string",
"email": "string"
}
{
"message": "User not found"
}
/charitiesGET [
{
"id": "string",
"name": "string",
"description": "string"
}
]
/charitiesPOST {
"name": "string",
"description": "string"
}
{
"charity": {
"id": "string",
"name": "string",
"description": "string"
}
}
/charities/:charityIdGET {
"id": "string",
"name": "string",
"description": "string"
}
{
"message": "Charity not found"
}
/charities/:charityId/donatePOST {
"amount": "number"
}
{
"message": "Thank you for your donation!",
"donation": {
"id": "string",
"charityId": "string",
"amount": "number",
"date": "string"
}
}
{
"message": "Invalid donation amount"
}
/notifications/:userIdGET [
{
"id": "string",
"message": "string",
"read": "boolean",
"date": "string"
}
]
/notificationsPOST {
"userId": "string",
"message": "string"
}
{
"notification": {
"id": "string",
"message": "string",
"read": false,
"date": "string"
}
}
/analytics/overviewGET {
"totalUsers": "number",
"totalDonations": "number",
"totalCharities": "number"
}
/analytics/donationsGET {
"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.