Files
smargopolo/python_algorithms/RESTful/README.md
2019-12-04 13:41:30 +01:00

151 lines
1.5 KiB
Markdown

## RESTful APIs:
**http Methods:**
GET - get ressource
POST - create a new ressource
DELETE - deleting ressources
collection: /status
* GET -
* POST
* DELETE
# GETTING information
## Getting the state of NewGon:
**Definition**
`GET /status`
**Responses**
- `200 OK` - on success
```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
}
```
## Getting individual variables of NewGon:
**Definition**
`GET /status/<variable>`
**Response**
- `404 Not Found` if the variable does not exist
- `200 OK` on success
# SETTING INFORMATION
## Setting the 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
}
```
```
GET /status
{
"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
}
GET /params
{
"l1':1,
"l2':1,
"l3':1,
"l4':1,
"l5':1,
"l6':1,
}
PUT /set
{
"SHX":1
}
or
{
"SHX":2.2,
"SHY":1.1
}
returns
{
"SHX":2.2
"message":"SHX->2.2."
}
```