-
-
Notifications
You must be signed in to change notification settings - Fork 562
Server API
Thomas Friebel edited this page Oct 11, 2021
·
2 revisions
The cncjs server is an Express web server running on Node.js. The server defines an HTTP API.
POST endpoint for making authentication requests.
This is the only endpoint in the API that allows public access.
Method: POST
Arguments:
- token: JWT token
- name: name
- password: password
Response
-
HTTP 200,
{ enabled: true, token: <JWT>, name, <name> }
Sent if the request succeeds by either JWT or name-password authentication. If no JWT is present in the request the name and password are assessed for authentication.
-
HTTP 401,
{ msg: 'Authentication failed' }
Sent if authentication fails.
-
HTTP 500,
{ msg: 'Internal server error' }
Sent if an error occurs while processing the JWT.
Most of the categories follow a (F)CRUD pattern: fetch, create, read, update, delete.
Category | endpoint | HTTP method | operation | arguments |
---|---|---|---|---|
Version | api/version/latest | GET | get | none |
State | api/state | GET | get | key |
api/state | POST | set | key | |
api/state | delete | unset | key | |
G-code | api/gcode | GET | fetch | port |
api/gcode | POST | upload | port, name, gcode, context | |
api/gcode/download | GET/POST | download | port | |
Controllers | api/controllers | GET | get | none |
Commands | api/commands | GET | fetch | paging, page, pageLength |
api/commands | POST | create | enabled, title, commands | |
api/commands/:id | GET | read | none | |
api/commands/:id | PUT | update | enable, title, commands | |
api/commands/:id | DELETE | delete | none | |
api/commands/run/:id | POST | run | none | |
Events | api/events | GET | fetch | paging, page, pageLength |
api/events | POST | create | enabled, event, trigger, commands | |
api/events/:id | GET | read | none | |
api/events/:id | PUT | update | enabled, event, trigger, commands | |
api/events/:id | DELETE | delete | none | |
Machines | api/machines | GET | fetch | paging, page, pageLength |
api/machines | POST | create | {id, name, limits: {xmin, xmax, ymin, ymax, zmin, zmax}} | |
api/machines/:id | GET | read | none | |
api/machines/:id | PUT | update | {name, limits: {xmin, xmax, ymin, ymax, zmin, zmax}} | |
api/machines/:id | DELETE | delete | none | |
Macros | api/macros | GET | fetch | paging, page, pageLength |
api/macros | POST | create | name, content | |
api/macros/:id | GET | read | none | |
api/macros/:id | PUT | update | name, content | |
api/macros/:id | DELETE | delete | none | |
MDI | api/mdi | GET | fetch | paging, page, pageLength |
api/mdi | POST | create | name, command, grid | |
api/mdi | PUT | bulkUpdate | Array({name, command, grid}, ...) | |
api/mdi/:id | GET | read | none | |
api/mdi/:id | PUT | update | name, command, grid | |
api/mdi/:id | DELETE | delete | none | |
Users | api/users | GET | fetch | paging, page, pageLength |
api/users | POST | create | enabled, name, password | |
api/users/:id | GET | read | none | |
api/users/:id | PUT | update | enabled, name, oldPassword, newPassword | |
api/users/:id | DELETE | delete | none | |
Watch | api/watch/files | GET/POST | getFiles | path |
api/watch/file | GET/POST | readFile | file |
Join CNCjs Users Group on Facebook to share your experiences with other people.
Site: https://cnc.js.org
- Introduction
- Installation
- Using Pendants
-
Raspberry Pi Setup Guide
- System Setup & Preparation
- Install Node.js & CNCjs
- Install Node.js via Package Manager (Recommended)
- Install Node.js via Node Version Manager (NVM) (Alternative)
- Install Node.js Manually (Alternative)
- Use PM2 to auto-start CNCjs (Optional)
- Use Port 80 (Optional)
- Maintain
- Additional Setup Options:
- CNCjs UI on Pi - Adventures in PiLand
- Pi with Arduino Due
- Electron App
- User Guide
- Tool Change
- Troubleshooting
-
FAQ
- Forgot your password?
- How can I enable WebGL in my browser?
- Raspberry Pi: Error opening serial port "ttyAMA0"
- Webcam Streaming with Raspberry Pi
- Restream RTSP to M-JPEG
- Connect to an Arduino using WiFi
- Install Native Addons with Node.js v4
- Install Serialport on OS X El Capitan
- Kernel panic issue on macOS Sierra for devices using the CH340G, CH34G or CH34X chipset
- Testing without Arduino board
- Development
- API
- Wiki History
- Resources
- About