mirror of
https://github.com/synthetos/g2.git
synced 2026-03-25 04:04:58 +08:00
Page:
g2core REST Swagger
Pages
9 Axis UVW Operation
Adding and Revising Configurations and Settings
Adding and Revising Motate Pinouts
Alarm Processing
Arduino DUE Pinout for g2core
Branching and Release
Compatibility Axioms
Compiling G2 on Linux and OS X (command line)
Compiling G2 on OS X (with Xcode)
Compiling G2 on Windows 10 and Atmel Studio 6.2
Compiling G2 on Windows 10 and Atmel Studio 7
Compiling G2 on Windows 7 and Atmel Studio 6.2
Compiling and configuring G2 on Windows
Compiling g2core on Linux and OS X (command line)
Compiling g2core on OS X (with Xcode)
Configuration for Firmware Version 0.98
Configuring 0.99 3D Printing Extensions
Configuring 0.99 Actions and Reports
Configuring 0.99 Axes
Configuring 0.99 Motors
Configuring 0.99 Other Groups
Configuring 0.99 System Groups
Configuring Version 0.99
Connecting to g2core
Coordinate Systems
Debugging G2 on OSX with GDB and Atmel ICE
Developer Notes
Development Process
Diagnostics
Digital DRO
Digital IO 0.98
Digital IO
Dual Endpoint USB Internals
Dual Endpoint USB Operation
Feed Rate Override
Feedhold, Resume, and Other Simple Commands
Flashing G2core with wsl
Flashing g2core with Atmel Studio and Atmel ICE
Flashing g2core with Linux
Flashing g2core with OSX
Flashing g2core with Windows
Flashing g2core
Flashing with Node SAM Ba Utility in OSX
G2 G3 Arc At Feed Rate
G2 Licensing
G2 Project Status Page
G2 in Git: cloning and updating procedures
G2core License
G2core on DUE External Interfaces
GPIO 1.x
GPIO Design Goals
GPIO Implementation
GPIO Objects and Binding
GPIO Primitives
Gcode Coordinate Offsets
Gcode Probes
Gcode Support
Gcodes
Getting Started with g2core
Home
Homing g2core
JSON Active Comments
JSON Cheat Sheet
JSON Details
JSON Operation
Jerk Controlled Motion Explained
Job Exception Handling
Licensing
Makefile Notes
Marlin Compatibility
Mcodes
Outline
Overview of Motion Processing
Persistence Functions
Power Management
Pressurizer Ventilator
Project Structure and Motate
Raster Streaming Protocol Notes
Raster Streaming Protocol
Roadmap
Status Codes
Status Reports
Text Mode
TinyG v9 Hardware
TinyG v9 Testing
Tool Offsets and Selection
Tool Types Beyond Spindle
Toolheads
Useful Stuff
Using Atom
Using Pin Changes for Timing (and light debugging)
VSCode Setup
Walk through, using a Due and lower power stepper motor drivers
What is g2core
Windows, VMware, Atmel Studio Notes
Windows 10 VMware Fusion 8 Issues
ZZZ DEPRECATED Adding a new G2 board (or revision) to G2
ZZZ DEPRECATED Changelog for Edge Branches
g2.axis
g2core Communications
g2core REST Examples
g2core REST Interface
g2core REST Resources
g2core REST Swagger
g2core in use
g2dialect 3D Printing Codes
g2dialect Consensus Gcode
g2dialect Consensus Mcodes
g2dialect Operating Model
g2dialect
gQuintic Specs
zzz(DEPRECATED) Uploading TinyG2 to a DUE gShield or TinyG v9
zzzSafety Interlock Behaviors
Clone
10
g2core REST Swagger
Alden Hart edited this page 2016-11-16 08:32:12 -05:00
Table of Contents
PRELIMINARY - FOR DISCUSSION
These preliminary design pages are for discussion of the g2core REST interface:
Example Swagger
Until we have a proper repo for this:
- You can see the yaml via this gist
- Launch it in the swagger editor
- Cut and paste this into the Swagger Editor
#
# Test swagger for g2core-server
#
# HTTP status codes - https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
#
swagger: '2.0'
info:
version: '0.99.0'
title: g2core REST API
description:
The g2core REST API is a minimalist API that mostly just passes keys through to the g2core firmware and returns the firmware responses and some status information. The resource model also includes provisions for retrieving status, launching long running operations, and launching and managing CNC jobs.
See top-level decription of the resource model
https://github.com/synthetos/g2/wiki/g2core-REST-Resources
Reference for g2core JSON keys and semantics
https://github.com/synthetos/g2/wiki/Configuring-Version-0.99
termsOfService: http://helloreverb.com/terms/
contact:
name: Synthetos.com
email: alden.hart@synthetos.com #, rob.giseburt@synthetos.com, riley.porter@synthetos.com
url: https://github.com/synthetos/g2/wiki/g2core-REST-Resources
license:
name: MIT
url: http://opensource.org/licenses/MIT
host: 127.0.0.0
basePath: /api
schemes:
- http
consumes:
- application/json
produces:
- application/json
paths:
/version:
get:
description: Return API and machine identification, version and other information
operationId: getVersion
produces:
- application/json
responses:
'200':
description: getVersion response
schema:
required:
- fv
- fb
- fbs
- fbc
- hp
- hv
- id
properties:
fv:
description: firmware version
type: number
fb:
description: firmware build
type: number
fbs:
description: firmware build string
type: string
fbc:
description: firmware build configuration
type: string
hp:
description: hardware platform
type: string
hv:
description: hardware version
type: string
id:
description: machine ID
type: string
msg:
description: startup message
type: string
default:
description: unexpected error
schema:
$ref: '#/definitions/genericError'
/machine:
get:
description: Return or inspect machine resources. Omit body to get full machine.
operationId: getMachineByJSON
produces:
- application/json
parameters:
- name: key
in: body
description: JSON describing values to get. Omit to get full machine.
required: false
schema:
$ref: '#/definitions/jsonObject'
- name: nodes_only
in: query
description: return top-level objects only
required: false
type: boolean
# - name: return_URI
# in: query
# description: return nodes as URIs
# required: false
# type: boolean
responses:
'200':
description: getMachineByJSON response
schema:
$ref: '#/definitions/genericResponse' # only need generic response for URI return, otherwise jsonResponse
default:
description: unexpected error
schema:
$ref: '#/definitions/genericError'
put:
description: Update machine resources by path
operationId: setMachineByJSON
parameters:
- name: key
in: body
description: JSON describing values to set
required: false
schema:
$ref: '#/definitions/jsonObject'
responses:
'200':
description: setKey response
schema:
$ref: '#/definitions/genericResponse'
default:
description: unexpected error
schema:
$ref: '#/definitions/genericError'
/machine/{path}:
get:
description: Return or inspect machine resources by path
operationId: getMachineByPath
produces:
- application/json
parameters:
- name: path
in: path
description: path to object or attribute to get
required: true
type: string
- name: nodes_only
in: query
description: return top-level objects only
required: false
type: boolean
# - name: return_URI
# in: query
# description: return nodes as URIs
# required: false
# type: boolean
responses:
'200':
description: getMachineByPath response
schema:
$ref: '#/definitions/genericResponse'
default:
description: unexpected error
schema:
$ref: '#/definitions/genericError'
put:
description: Update machine resources by path
operationId: setMachineByPath
parameters:
- name: path
in: path
description: path to object or attribute to set
required: true
type: string
- name: value
in: body
description: JSON to set one or more values
required: true
schema:
$ref: '#/definitions/jsonObject'
responses:
'200':
description: setKey response
schema:
$ref: '#/definitions/genericResponse'
default:
description: unexpected error
schema:
$ref: '#/definitions/genericError'
/status_report:
get:
description: Return a g2core status report. (1) Call with no filter to retrieve complete status report, (2) Call with a JSON filter with null attribute values to retrieve specific attributes from a status report, (3) Call with a JSON filter with non-null attribute values to return only changed values.
See https://github.com/synthetos/g2_private/wiki/g2core-REST-Resources#status_report-resource
operationId: getState
produces:
- application/json
parameters:
- name: filter
in: body
description: return status report (SR)
required: false
schema:
$ref: '#/definitions/jsonObject'
responses:
'200':
description: getStatus response
schema:
$ref: '#/definitions/genericResponse'
default:
description: unexpected error
schema:
$ref: '#/definitions/genericError'
/operation:
post:
description: Start a new operation context
operationId: newOperation
produces:
- application/json
parameters:
- name: op
in: body
description: Start a new operation
required: true
schema:
$ref: '#/definitions/operationRequest'
responses:
'201': # 201 RESOURCE HAS BEEN CREATED
description: operation created
schema:
type: integer
format: uint32
default:
description: unexpected error
schema:
$ref: '#/definitions/genericError'
/operation/{id}:
get:
description: Return operation context by operation ID
operationId: getOperation
produces:
- application/json
parameters:
- name: id
in: path
description: id of operation to retrieve
required: true
type: string
responses:
'200':
description: getStatus response
schema:
$ref: '#/definitions/operationResponse'
default:
description: unexpected error
schema:
$ref: '#/definitions/genericError'
definitions:
jsonObject: # describes an arbitrary JSON object
type: object
responseStatus: # Note, this object breaks from the g2core naming conventions
type: object
properties:
code:
description: g2core status_code (error.h)
type: integer
format: uint8
description:
description: g2core Status message strings (error.h)
type: string
additional_description:
description: g2core 'msg' additional text
type: string
genericResponse:
type: object
required:
- value # response value JSON object
properties:
value:
type:
- object
- number
- string
- boolean
- "null"
msg: # message string, error or exception text if present in response
type: string
status:
$ref: '#/definitions/responseStatus'
genericError:
type: object
properties:
status:
$ref: '#/definitions/responseStatus'
operationRequest:
type: object
required:
- optype
- value # text or JSON of request
properties:
optype:
type: string
value:
type: string
operationResponse:
type: object
required:
- opstate
- value # JSON response
properties:
id:
type: integer
format: uint32
opstate: # state of operation, e.g. pend, run, done, error
type: string
value:
$ref: '#/definitions/jsonObject'
status:
$ref: '#/definitions/responseStatus'
# anyTypeValue:
# type: object
# required:
# - value # value can be any native JSON type or a JSON object
# properties:
# value:
# type:
# - object # JSON object
# - number
# - string
# - boolean
# - "null" # Quotes reqwuired becuase nu.. is a reserved word
# jsonResponse:
# type: object
# required:
# - value # response value JSON object
# properties:
# value:
# $ref: '#/definitions/jsonObject'
# msg: # message string, error or exception text if present in response
# type: string
# status:
# $ref: '#/definitions/responseStatus'
Getting Started Pages
- Home
- What is g2core?
- Who uses g2core?
- Jerk-Controlled Motion
- Getting Started with g2core
- Connecting to g2core
- Configuring g2core
- Flashing g2core
- Troubleshooting
Reference Pages
- Gcodes
- Mcodes
- Text Mode
- JSON Communications
- GPIO Digital IO
- Alarms & Exceptions
- Power Management
- Coordinate Systems
- Status Reports
- Status Codes
- G2 Communications
- Tool Offsets and Selection
- Probing
- Feedhold, Resume, Job Kill
- Marlin Compatibility
- 9 Axis UVW Operation
- gQuintic Specs
Discussion Topics
- Roadmap
- GPIO for 1.X Releases
- Toolheads
- Raster Streaming Prototol
- g2core REST Interface
- Gcode Parsing
- G2 3DP Dialect
- Consensus Gcode
- Digital DRO
- Overview of Motion Processing
Developer Pages
- Development & Contribution
- Branching and Release - DRAFT
- Getting Started with g2core Development
- Project Structure & Motate
- Compiling G2
- OSX w/Xcode
- OSX/Linux Command Line
- Windows10 w/AtmelStudio7
- Debugging G2 on OSX
- Board and Machine Profiles
- Arduino Due Pinout
- Arduino DUE External Interfaces
- Diagnostics
- Debugging w/Motate Pins
- Development Troubleshooting
- g2core Communications
- Git Procedures
- Windows 10 / VMware 8 Issues
- Dual Endpoint USB Internals
- G2core License
- VSCode Setup
- Compatibility Axioms
- Wiki History