FORMAT: 1A HOST: http://waste-alert-api.herokuapp.com/
Waste Alert API is a simple REST API allowing users to upload the location and image of uncontrolled garbage piles.
User must create an account or login to their existing account to upload their data.
After creating or login to account an user can upload images of uncontrolled waste along with location.
You may create your own account using this action. It takes a JSON object containing users name, email and password.
-
Request (application/json)
{ "name": "Shahriar", "mail": "[email protected]", "password": "shahriar123!" }
-
Response 201 (application/json)
[ { "user": { "completed": false, "_id": "61024873c33f8b3758c7b43f", "name": "Shahriar", "email": "[email protected]", "createdAt": "2021-07-29T06:19:31.712Z", "updatedAt": "2021-07-29T06:19:31.934Z", "__v": 1 }, "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2MTAyNDg3M2MzM2Y4YjM3NThjN2I0M2YiLCJpYXQiOjE2Mjc1Mzk1NzF9.O3BC6pZ8mS8k1_-LZLmlYR4sOdtRGCONbzCZ5MdfP2M" } ]
You may login to your account using previously created gmail and password
-
Request (application/json)
{ "mail": "[email protected]", "password": "shahriar123!" }
-
Response 200 (application/json)
[ { "user": { "completed": false, "_id": "61024873c33f8b3758c7b43f", "name": "Shahriar", "email": "[email protected]", "createdAt": "2021-07-29T06:19:31.712Z", "updatedAt": "2021-07-29T06:19:31.934Z", "__v": 1 }, "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2MTAyNDg3M2MzM2Y4YjM3NThjN2I0M2YiLCJpYXQiOjE2Mjc1Mzk1NzF9.O3BC6pZ8mS8k1_-LZLmlYR4sOdtRGCONbzCZ5MdfP2M" } ]
You may logout from your account using /logout route
-
Response 200 (application/json)
[ { "message": "User logged out successfully" } ]
You may read, update and delete your account using this route
-
Response 200 (application/json)
[ { "_id": "61024873c33f8b3758c7b43f", "name": "Shahriar", "email": "[email protected]", "createdAt": "2021-07-29T06:19:31.712Z", "updatedAt": "2021-07-29T06:19:31.934Z", "__v": 1 } ]
-
Request (application/json)
{ "email": "[email protected]" }
-
Response 200 (application/json)
[ { "_id": "61024873c33f8b3758c7b43f", "name": "Shahriar", "email": "[email protected]", "createdAt": "2021-07-29T06:19:31.712Z", "updatedAt": "2021-07-29T06:19:31.934Z", "__v": 1 } ]
-
Response 200 (application/json)
[ { "_id": "61024873c33f8b3758c7b43f", "name": "Shahriar", "email": "[email protected]", "createdAt": "2021-07-29T06:19:31.712Z", "updatedAt": "2021-07-29T06:19:31.934Z", "__v": 1 } ]
-
Request (multipart/form-data; boundary=---BOUNDARY)
-----BOUNDARY Content-Disposition: form-data; name="image[file]"; filename="image.jpg" Content-Type: image/jpg -----BOUNDARY { "wasteType": "organic", "location" : { "lat": 46.987, "long": -54.345 } }
-
Response 200 (application/json)
[ { "_id": "61041a33d8e95d2878cf5fed", "wasteType": "organic", "location": { "lat": 46.987, "long": -54.345 }, "image": "http://localhost:3000/uploads/image.jpg-1627658803811.jpeg", "owner": "610406f502497d43b8b77cb9", "createdAt": "2021-07-30T15:26:43.828Z", "updatedAt": "2021-07-30T15:26:43.828Z", "__v": 0 } ]
Using this route, user will get all the data uploaded by users
-
Response 200 (application/json)
[ { "_id": "61024873c33f8b3758c7b43f", "name": "Shahriar", "email": "[email protected]", "createdAt": "2021-07-29T06:19:31.712Z", "updatedAt": "2021-07-29T06:19:31.934Z", "__v": 1 } ]
You may read, update and delete your account using this route
-
Response 200 (application/json)
[ { "_id": "61041a33d8e95d2878cf5fed", "wasteType": "organic", "location": { "lat": 46.987, "long": -54.345 }, "image": "http://localhost:3000/uploads/image.jpg-1627658803811.jpeg", "owner": "610406f502497d43b8b77cb9", "createdAt": "2021-07-30T15:26:43.828Z", "updatedAt": "2021-07-30T15:26:43.828Z", "__v": 0 } ]
-
Request (application/json)
{ "wasteType": "Toxic" }
-
Response 200 (application/json)
[ { "_id": "61041a33d8e95d2878cf5fed", "wasteType": "Toxic", "location": { "lat": 46.987, "long": -54.345 }, "image": "http://localhost:3000/uploads/image.jpg-1627658803811.jpeg", "owner": "610406f502497d43b8b77cb9", "createdAt": "2021-07-30T15:26:43.828Z", "updatedAt": "2021-07-30T15:26:43.828Z", "__v": 0 } ]
-
Response 200 (application/json)
[ { "_id": "61041a33d8e95d2878cf5fed", "wasteType": "Toxic", "location": { "lat": 46.987, "long": -54.345 }, "image": "http://localhost:3000/uploads/image.jpg-1627658803811.jpeg", "owner": "610406f502497d43b8b77cb9", "createdAt": "2021-07-30T15:26:43.828Z", "updatedAt": "2021-07-30T15:26:43.828Z", "__v": 0 } ]