OSCAR API Server
This project contains the API server for the OSCAR assistant.
Requirements
- Node.js or similar runtime
- PostgreSQL, MySQL, SQLite, or MSSQL database
Installation & Usage
- Install the software using npm (
npm install oscar-assistant-api
). - Configure the software for your database. Create a configuration file in the
config
folder for your environment, such asproduction.yaml
orlocal.yaml
(see the configuration file documentation). The Sequelize documentation contains the available options. - Run
npm start
to start the server.
API Reference
All endpoints receive and return JSON data.
Timestamps are in ISO 8601 format.
GET /collectors
Returns all collectors, and the number of errors that occurred during the most recent collection.
GET /collectors/:collectorId
Returns the details for a collector.
GET /collectors/:collectorId/logs
Returns the most recent logs for a collector. By default it returns the logs in chronologically descending order.
GET /types
Returns all types.
GET /types/:typeId?start&limit
Returns the collected items for the given type. Deleted items are excluded.
By default it returns the items in descending ranked order.
The offset and number of items returned can be changed with the (zero-based) start
and limit
parameters.
GET /types/:typeId/:itemId
Return the item details.
PATCH /types/:typeId/:itemId
Changes an item. At this time the only changeable property is expectedRank
:
Returns the changed item.
DELETE /types/:typeId/:itemId
Marks an item as deleted. Returns the changed item with the deleted
time.
Development
If you want to make changes to the software, the following npm scripts are available:
npm run clean # deletes the build folder
npm run lint # checks the code for errors
npm run build # compiles the source code and saves it into the "build" folder
npm test # runs the test suite