SOOM api
RESTful API endpoints
/api/web/items
GET Get all Web dust items.
- Method:
GET
- URL:
/api/web/items
/api/web/items
POST Create a new item.
- Method:
POST
- URL:
/api/web/items
- Body:
{
"timestamp" : Date.now()
"location": "1",
"latitude": "37",
"longitude": "127.1",
"date": new Date().toDateString(),
"pm10_value": "41",
"pm10_grade": "good",
"apiURL": "http://www.google.com",
"show": true,
}
/api/items/:loc
GET Get item with specific id.
- Method:
GET
- URL:
/api/items/1
/api/items/:loc
PUT Update entire item with specific id.
- Method:
PUT
- URL:
/api/web/items/seoul
- Body:
{
"timestamp" : 1424000
"location": "1",
"latitude": "37",
"longitude": "127.1",
"date": "2017",
"pm10_value": "41",
"pm10_grade": "good",
"pm25_value": "41",
"pm25_grade": "good",
}
/api/items/:loc
PATCH Update part of the item with specific id.
- Method:
PATCH
- URL:
/api/web/items/seoul
- Body:
{
"pm10_value": "30"
}
/api/items/:loc
DELETE Delete item with specific id.
- Method:
DELETE
- URL:
/api/items/seoul
Install
npm install
Run
- Make sure MongoDB is running, if not:
sudo ~/mongodb/bin/mongod
(assuming you have~/mongodb
directory). npm run start