Files
smargopolo/python_algorithms/RESTful/RESTAPI.md
2020-02-28 14:20:57 +01:00

120 lines
1.4 KiB
Markdown

# RESTful API for NewGon:
**http Methods:**
- `GET` - get ressource
- `POST` - create a new ressource
- `DELETE` - deleting ressources
# GETTING information
## Getting the full status of NewGon:
**Definition**
`GET /newgon
**Responses**
- `200 OK` - on success
```json
{
"MODE":1,
"STATUS":"Ready",
"target": {
"SHX":0,
"SHY":0,
"SHZ":18,
"CHI":10,
"PHI":0,
"OMEGA":0,
"OX":0,
"OY":0,
"OZ":0,
"s1":12,
"s2":13,
"s3":14,
"s4":15,
"phimotor":11,
"omegamotor":180
}
"readback": {
"s1":12,
"s2":13,
"s3":14,
"s4":15,
"phimotor":11,
"omegamotor":180
}
"cyclecount":123456789
}
```
## Getting individual variables of NewGon:
**Definition**
`GET /newgon/target`
**Response**
- `404 Not Found` if the variable does not exist
- `200 OK` on success
```json
{
"MODE":1
}
```
# SETTING INFORMATION
## Setting many variables to NewGon
**Definition**
`POST /status`
**Arguments**
```json
{
"MODE":1,
"STATUS":"Ready",
"SHX":0,
"SHY":0,
"SHZ":18,
"CHI":10,
"PHI":0,
"OMEGA":0,
"OX":0,
"OY":0,
"OZ":0,
"s1":12,
"s2":13,
"s3":14,
"s4":15,
"phimotor":11,
"cyclecount":123456789
}
```
## Setting individual varibles to NewGon
**Definition**
`POST /status`
**Arguments**
```json
{
"MODE":1,
"SHX":2
}
```
{
"SHX":2.2
"message":"SHX->2.2."
}