RESTful API

API for Automated Test Equipment

Note

The web app is mounted to /ate. Be sure to use http://<ipaddress:port>/ate when using this RESTful API.

GET /

Affirms ExplorerHAT is physically present.

Example request:

GET /ate HTTP/1.1
Host: 192.168.1.87:8080
Accept: */*

Example response:

HTTP/1.0 200 OK
Server: WSGIServer/0.1 Python/2.7.9
Content-Length: 23
Content-Type: application/json

{"isexplorerpro": true}
Status Codes
Response JSON Object
  • isexplorerpro (string) – True if Explorer Pro HAT is present

GET /input

Status of all digital input on ExplorerHAT.

Example request:

GET /ate/input HTTP/1.1
Host: 192.168.1.87:8080
Accept: */*

Example response:

HTTP/1.0 200 OK
Server: WSGIServer/0.1 Python/2.7.9
Content-Length: 43
Content-Type: application/json

{"four": 0, "three": 0, "two": 0, "one": 0}
Status Codes
Response JSON Object
  • four (int) – status of relay four

  • three (int) – status of relay three

  • two (int) – status of relay two

  • one (int) – status of relay one

API for Device Under Test

Note

The web app is mounted to /dut. Be sure to use http://<ipaddress:port>/dut when using this RESTful API.

GET /

Affirms AutomationHAT is physically present.

Example request:

GET /dut HTTP/1.1
Host: 192.168.1.87:8080
Accept: */*

Example response:

HTTP/1.0 200 OK
Server: WSGIServer/0.1 Python/2.7.9
Content-Length: 25
Content-Type: application/json

{"isautomationhat": true}
Status Codes
Response JSON Object
  • isautomationhat (string) – True if AutomationHAT is present

GET /relay

Status of all three relays as reported by AutomationHAT software.

Example request:

GET /dut/relay HTTP/1.1
Host: 192.168.1.88:8080
Accept: */*

Example response:

HTTP/1.0 200 OK
Server: WSGIServer/0.1 Python/2.7.9
Content-Length: 44
Content-Type: application/json

{"three": false, "two": false, "one": false}
Status Codes
Response JSON Object
  • three (boolean) – application state of relay three

  • two (boolean) – application state of relay two

  • one (boolean) – application state of relay one

POST /relay

Toggle of all three relays on AutomationHAT.

Example request:

POST /dut/relay HTTP/1.1
Host: 192.168.1.88:8080
Accept: */*

Example response:

HTTP/1.0 200 OK
Server: WSGIServer/0.1 Python/2.7.9
Content-Length: 41
Content-Type: application/json

{"three": true, "two": true, "one": true}
Status Codes
Response JSON Object
  • three (boolean) – application state of relay three

  • two (boolean) – application state of relay two

  • one (boolean) – application state of relay one

GET /relay/(relay)

Status of specified relay as reported by AutomationHAT software.

Example request:

GET /dut/relay/one HTTP/1.1
Host: 192.168.1.88:8080
Accept: */*

Example response:

HTTP/1.0 200 OK
Server: WSGIServer/0.1 Python/2.7.9
Content-Length: 13
Content-Type: application/json

{"relay": "one", "state": true}
Status Codes
Response JSON Object
  • relay (boolean) – relay identifier, e.g. one, two, three

  • state (boolean) – application state of relay

POST /relay/(relay)

Control the state of an individual relay.

Example request:

POST /dut/relay/one HTTP/1.1
Host: 192.168.1.88:8080
Accept: */*
Content-Type: application/json
Content-Length: 12

Example response:

HTTP/1.0 200 OK
Server: WSGIServer/0.1 Python/2.7.9
Content-Length: 14
Content-Type: application/json

{"relay": "one", "state": true}
Status Codes
Request JSON Object
  • state (int) – 1 to turn ON, 0 to turn OFF

Response JSON Object
  • relay (boolean) – relay identifier, e.g. one, two, three

  • state (boolean) – application state of relay