
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
### Install node and update to latest version As of May 4, 2016, the latest version is 6.0.0. ``` nvm install v6.0.0 nvm alias default v6.0.0 ```
As of May 4, 2016, the latest version is 6.0.0.
nvm install v6.0.0
nvm alias default v6.0.0
git clone https://github.com/sdurbin1/safe-rest.git
cd /path/to/safe-rest
npm install
Run in separate terminal, or in background
mongod --smallfiles
npm run-script db-fill
Edit the appropriate line in config.js
exports.host = 'https://safe-app-<username>.c9users.io'
node app.js
Create an analytic
curl localhost:8080/analytics/ -H "Content-Type: application/json" --data '{"name": "Normal Distribution"}'
Return all analytics
curl localhost:8080/analytics
Return an analytic
curl localhost:8080/analytics/56e816d8abda61a618bfccd5
Update an analytic
curl localhost:8080/analytics/56ea975aec9cc0f3098ae316 -H "Content-Type: application/json" -X PUT --data '{"name":"New Name"}'
Delete an analytic
curl -X DELETE http://localhost:8080/analytics/56ea975aec9cc0f3098ae316
Add an existing visualization-type to an analytic
curl localhost:8080/analytics/56eac298ee121e4b18d92259/visualization-types -X PUT --data 'visualizationTypes=56eaa1eae319c5af0c8dfc4d&visualizationTypes=56eaa1f1e319c5af0c8dfc4f'
Return a list of visualizationTypes associated with an analytic
curl localhost:8080/analytics/56e816d2abda61a618bfccd4/visualization-types
Remove a visualizationType from an analytic (does not delete the visualizationType)
curl -X DELETE http://localhost:8080/analytics/56eac298ee121e4b18d92259/visualization-types/56eaa1eae319c5af0c8dfc4d
Return all visualizationTypes
curl localhost:8080/visualization-types
Create a visualizationType
curl http://localhost:8080/visualization-types -H "Content-Type: application/json" -X POST --data '{"name":"Area"}'
Return a visualizationType
curl localhost:8080/visualization-types/56e8178dabda61a618bfccd9
Update a visualizationType
curl -X PUT http://localhost:8080/visualization-types/56eaa1eae319c5af0c8dfc4d/ --data 'name=Area'
Delete a visualizationType
curl -X DELETE http://localhost:8080/visualization-types/56eaa1eae319c5af0c8dfc4d/
Create a source
curl localhost:8080/sources -H "Content-Type: application/json" -X POST --data '{"name": "CSV_01222016", "fields": [{"name":"Age","dataType":"Number"},{"name":"County","dataType":"String"},{"name":"Height","dataType":"Number"},{"name":"Latitude","dataType":"Number"},{"name":"Longitude","dataType":"Number"},{"name":"Street Address","dataType":"String"},{"name":"Weight","dataType":"Number"}]}'
Return all sources
curl localhost:8080/sources
Return a source
curl localhost:8080/sources/56e85075cbe2b94312e95daf
Update a source
curl localhost:8080/sources/56eaec7a2308db1b1c6f795f -H "Content-Type: application/json" -X PUT --data '{"fields": [{"name":"Age","dataType":"Number"},{"name":"County","dataType":"String"},{"name":"Height","dataType":"Number"},{"name":"Latitude","dataType":"Number"},{"name":"Longitude","dataType":"Number"},{"name":"Street Address","dataType":"String"},{"name":"Weight","dataType":"Number"}]}'
Delete a source
curl -X DELETE http://localhost:8080/sources/56eaec7a2308db1b1c6f795f/
curl localhost:8080/sources/56eaec7a2308db1b1c6f795f/analytics -X PUT --data 'analytics=56eaa9fc51ed186110af1a80&analytics=56eac298ee121e4b18d92259'
Return all analytics associated with a source
curl localhost:8080/sources/56e865818c792b4f18f64f24/analytics
Remove an analytic from a source (does not delete the analytic)
curl -X DELETE http://localhost:8080/sources/56eaec7a2308db1b1c6f795f/analytics/56eaa9fc51ed186110af1a80
Return all fields associated with a source
curl localhost:8080/sources/56eaec7a2308db1b1c6f795f/fields
Upload a csv document. Creates a new collection with name "sourceId", and inserts document, "document"
curl localhost:8080/sources/56eaec7a2308db1b1c6f795f/data -H "Content-Type: application/json" --data '{"document":[{"Age":21,"County":"Anne Arundel","Height":61,"Latitude":31.33,"Longitude":33.00,"Street Address":"123 Main St.","Weight":133},{"Age":33,"County":"Howard","Height":67,"Latitude":31.33,"Longitude":33.00,"Street Address":"456 Main St.","Weight":188},{"Age":29,"County":"Anne Arundel","Height":63,"Latitude":31.33,"Longitude":33.00,"Street Address":"789 Main St.","Weight":142}]}'
Optionally include a list of fields
curl localhost:8080/sources/56eaec892308db1b1c6f7960/data -H "Content-Type: application/json" --data '{"fields": [{"name":"Age","dataType":"Number"},{"name":"County","dataType":"String"},{"name":"Height","dataType":"Number"},{"name":"Latitude","dataType":"Number"},{"name":"Longitude","dataType":"Number"},{"name":"Street Address","dataType":"String"},{"name":"Weight","dataType":"Number"}],"document":[{"Age":21,"County":"Anne Arundel","Height":61,"Latitude":31.33,"Longitude":33.00,"Street Address":"123 Main St.","Weight":133},{"Age":33,"County":"Howard","Height":67,"Latitude":31.33,"Longitude":33.00,"Street Address":"456 Main St.","Weight":188},{"Age":29,"County":"Anne Arundel","Height":63,"Latitude":31.33,"Longitude":33.00,"Street Address":"789 Main St.","Weight":142}]}'
Upload a csv document and create source.
curl localhost:8080/sources/data -H "Content-Type: application/json" --data '{"source": {"name":"TEST","fields": [{"name":"Age","dataType":"Number"},{"name":"County","dataType":"String"},{"name":"Height","dataType":"Number"},{"name":"Latitude","dataType":"Number"},{"name":"Longitude","dataType":"Number"},{"name":"Street Address","dataType":"String"},{"name":"Weight","dataType":"Number"}]},"document":[{"Age":21,"County":"Anne Arundel","Height":61,"Latitude":31.33,"Longitude":33.00,"Street Address":"123 Main St.","Weight":133},{"Age":33,"County":"Howard","Height":67,"Latitude":31.33,"Longitude":33.00,"Street Address":"456 Main St.","Weight":188},{"Age":29,"County":"Anne Arundel","Height":63,"Latitude":31.33,"Longitude":33.00,"Street Address":"789 Main St.","Weight":142}]}'
Delete csv document associated with source
curl localhost:8080/sources/5720ade7587a45660a46cdcb/data -X DELETE
Queries a data source based on a set of filters. Note: "id" field in filters data is not needed.
curl localhost:8080/sources/56eaec7a2308db1b1c6f795f/query -H "Content-Type: application/json" --data '{"filters": [{"id": "1","field": "Age","operator": ">","value": 25},{"id": "2","field": "County","operator": "=","value": "Howard"}]}'
Create a new visualization
curl http://localhost:8080/visualizations -H "Content-Type: application/json" -X POST --data '{"name":"Visualization1", "source":"56eaec7a2308db1b1c6f795f", "visualizationType":"57055c4c43176c9118cffc95", "analytic":"56eac298ee121e4b18d92259", "visualizationParams":{"title": {"text": "Monthly Average Temperature"},"subtitle": {"text": "Source: WorldClimate.com"}}, "analyticParams": [{"groupBy": ["Age"]}], "filters":[{ "id": 1,"field": "Age","operator": ">","value": 35},{"id": 2,"field": "County","operator": "=","value": "Howard"}], "analyticParams":[{"groupBy":"Age"}]}'
Return all visualizations
curl http://localhost:8080/visualizations
Return a visualization
curl localhost:8080/visualizations/570b93b007b51d710c748fb1
Update a visualization
curl http://localhost:8080/visualizations/570b93b007b51d710c748fb1 -H "Content-Type: application/json" -X PUT --data '{"analyticParams":[{"groupBy":"AGE"}]}'
Delete a visualization
curl -X DELETE http://localhost:8080/visualizations/570b93b007b51d710c748fb1
Create a dashboard
curl http://localhost:8080/dashboards -X POST --data 'title=Dashboard&visualizations=570b968507b51d710c748fb2&visualizations=570b9e54ddef419e0fda43a9'
Return all dashboards
curl http://localhost:8080/dashboards
curl http://localhost:8080/dashboards/570b9f8a877d26ac10c3b4f1
Update a dashboard
curl http://localhost:8080/dashboards/570b9f8a877d26ac10c3b4f1 -X PUT --data 'title=Dashboard1'
Delete a dashboard
curl http://localhost:8080/dashboards/570b9f8a877d26ac10c3b4f1 -X DELETE
Return a list of visualizations associated with a dashboard
curl localhost:8080/dashboards/570ba706a4cc946212bdaa42/visualizations
Add an existing visualization to a dashboard
curl localhost:8080/dashboards/570ba706a4cc946212bdaa42/visualizations -X PUT --data 'visualizations=570b9e54ddef419e0fda43a9'
Remove a visualization from a dashboard (does not delete the visualization)
curl -X DELETE localhost:8080/dashboards/570ba706a4cc946212bdaa42/visualizations/570b968507b51d710c748fb2
Authenticate user
curl localhost:8080/authentication/authenticate
Run analytic based on parameters of the provided visualization id and return json results.
curl localhost:8080/execute/572a1c11fbdcac91218b9a1f
Accept an optional list of filters
curl localhost:8080/execute/572a1c11fbdcac91218b9a1f -H 'Content-Type: application/json' --data '{"filters": [{"field": "Gender","operator": "=","value": "M"}]}'
FAQs
### Install node and update to latest version As of May 4, 2016, the latest version is 6.0.0. ``` nvm install v6.0.0 nvm alias default v6.0.0 ```
We found that safe-rest demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.