List of available endpoints :
- POST /register
- POST /login
- POST /carbon/tobacco
- POST /carbon/vehicle
- GET /products
- POST /product/payment/:id
Description :
- Create a new user
Request :
- body :
{
"username": "string",
"email": "string",
}
Response(201 - Created)
{
"id": "integer",
"email": "string",
}
Resoponse(400 - Bad Request)
{
"messsage" : "Email address already in use!"
}
OR
{
"messsage" : "Email is required"
}
OR
{
"messsage" : "Email Format is required"
}
OR
{
"messsage" : "Password is required"
}
Description :
- Log in into website
Request :
- body :
{
"email": "string",
"password": "string",
}
Response(200 - OK)
{
"access_token"
}
Resoponse(404 - Bad Request)
{
"message" : "Bad Request"
}
Response(401 - Unauthorized)
{
"message": "Invalid email or password"
}
-Description: get result of carbon footprint from cigarretes price and time to plant a tree in month
Request :
- body :
{
"price": "integer",
}
Response(200 - OK)
{
"co2e":"integer",
"time" : "integer"
}
Resoponse(404 - Bad Request)
{
"message" : "Bad Request"
}
-Description: get result of carbon footprint from distance in km and time to plant a tree in month
Request :
- body :
{
"distance": "integer",
}
Response(200 - OK)
{
"co2e":"integer",
"time" : "integer"
}
Resoponse(404 - Bad Request)
{
"message" : "Bad Request"
}
Description :
- get all product
[
{
"id": 1,
"name": "Mahoni Tree",
"imgUrl": "https://i.pinimg.com/564x/25/24/3f/25243fea81803e0f376cdb9a20625520.jpg",
"description": "We are super excited to announce that starting in 1st of May 2023, we are planting trees when you shop from us!",
"price": 125000,
}
...,
]
Description : Create payment for buying products by id
Response(201 - OK)
{
"token" : "string",
"redicrect_url" : "string"
}
Resoponse(404 - Bad Request)
{
"message" : "Bad Request"
}
Response(401 - Unauthorized)
{
"message": "Invalid Token"
}
``
_Response (500 - Internal Server Error)_
```json
{
"message": "Internal server error"
}