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

2.3 KiB

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
{
   "MODE":1,
   "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,
    "status":"Ready"
}

Getting target values of NewGon:

Definition

GET /newgon/target

Response

  • 200 OK on success
{
    "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
    }
}

Getting readback values of NewGon:

Definition

GET /newgon/readback

Response

  • 200 OK on success
{
    "readback": {
       "s1":12,
       "s2":13,
       "s3":14,
       "s4":15,
       "phimotor":11,
       "omegamotor":180
       "timestamp": "102020200"
   }
}

SETTING INFORMATION

Setting the operation MODE NewGon

Definition

POST /newgon/MODE POST /newgon/mode

Arguments mode=1

or

{ 
   "MODE":1,
}

Responses

  • 200 OK - on success
  • 404 Not Found if the variable does not exist

Setting target values to NewGon

Definition

POST /newgon/target

Arguments

{ 
  "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
    }
}

Responses

  • 200 OK - on success
  • 404 Not Found if the variable does not exist

Setting individual varibles to NewGon

Definition

POST /newgon/target

Arguments

{
   "MODE":1,
   "SHX":2
}

{ "SHX":2.2 "message":"SHX->2.2." }