Product Database API - [internal source], [external source]
User Database API - [internal source], [external source]
Plastic Karma's REST API is a scaleable, quick, and efficent program. Using MongoDB and their Atlas service for scalable servers, Heroku for scalable Node.js servers, and Express for quick responses and maximum efficiency. The API allows all of our platforms (IOS, Andriod, Websites), to communicate on one centeral database servers. This allows us to just change the one server instead of all of our platforms, allowing increased reliability and ease of use.
Our Product Database is responsible for storing a collection of universal product codes and the corresponding environmental impact data.
Some sample with Postman can be found here.
- Clone (
git clone https://github.com/tokyojack/Plastic-Karma-Product-Rest-API
CD
into the folder- Run
npm install
for the packages - Add your MongoDB atlas URL into the
config.js
file - Run
node index.js
to start the server - Start testing it out at
localhost:8080
UPC
- Stringplastic_score
- Integeraction_desc
- Stringname
- Stringrecyling_score
- Integerwaste_score
- Integer
Example successful response
{
"message": "Product created successfully"
}
Example successful response
{
"_id": "5ba7dd97c7763b001544a16b",
"upc": "732619602003",
"plastic_score": 3,
"action_desc": "refundable",
"name": "laundry detergent bottle",
"recycling_score": 2,
"waste_score": 1,
"transactions": []
}
Example successful response
[
{
"_id": "5ba7db6ec7763b001544a157",
"upc": "379941575228",
"plastic_score": 18,
"action_desc": "recyclable",
"name": "pizza tray",
"recycling_score": 17,
"waste_score": 0,
"transactions": []
},
{
"_id": "5ba7dc58c7763b001544a15f",
"upc": "616087993400",
"plastic_score": 18,
"action_desc": "recyclable",
"name": "phone case package",
"recycling_score": 16,
"waste_score": 0,
"transactions": [
{
"amount": 2,
"user_email": "[email protected]",
"date": "2018-09-23T19:27:55.081Z"
}
]
}
]
UPC
- Stringemail
- String
Example successful response
{
"message": "Transaction added successfully",
"score": 1
}
Example successful response
[
{
"amount": 34,
"user_email": "[email protected]",
"date": "2018-09-23T19:27:55.081Z"
},
{
"amount": 229,
"user_email": "[email protected]",
"date": "2018-03-23T13:51:55.081Z"
}
]
Plastic Karma's REST API is a scaleable, quick, and efficent program. Using MongoDB and their Atlas service for scalable servers, Heroku for scalable Node.js servers, and Express for quick responses and maximum efficiency. The API allows all of our platforms (IOS, Andriod, Websites), to communicate on one centeral database servers. This allows us to just change the one server instead of all of our platforms, allowing increased reliability and ease of use.
Our User Database is responsible for storing a collection of user data and their karma score.
Some sample with Postman can be found here.
- Clone (
git clone https://github.com/tokyojack/Plastic-Karma-User-Rest-API
CD
into the folder- Run
npm install
for the packages - Add your MongoDB atlas URL into the
config.js
file - Run
node index.js
to start the server - Start testing it out at
localhost:8080
email
- Stringpassword
- Integercurrent_score
- Stringwaste_score
- Stringprior_month_score
- Integer
Example successful response
{
"message": "User created successfully"
}
Example successful response
{
"_id": "5ba7b8102071244568b9b126",
"email": "[email protected]",
"password": "asd123",
"current_score": 0,
"waste_score": 0,
"prior_month_score": 0
}
email
- Stringamount
- Integer
Example successful response
{
"message": "Score added successfully",
"score": 30
}
For support, simply just email us at [email protected]