Automation via HTTP

The Studio SDK native library implements a tiny in-game HTTP server on port 8080 (overridable in Config) that accepts POST requests to perform various actions.

Important!

  1. The HTTP server only exists while the game is foregrounded.

  2. Only HTTP is supported, not HTTPS.

A GET request returns a very small webpage with buttons for the available actions. This is useful for testing connectivity.

webcontrol

Some example HTTP POST requests are shown below. Note that Unity script executes in-game and so requests are made to localhost, whereas Curl is presumed to run on an attached host computer and therefore needs to know the Android/iOS device’s IP address.

Session Start

Unity

UnityWebRequest.Post("http://localhost:8080/", "session_start", 
    "application/x-www-form-urlencoded").SendWebRequest();

Curl

curl -X POST -d "session_start" http://DEVICE_IP_ADDR:8080/

Raw

POST / HTTP/1.1
Content-Type: application/x-www-form-urlencoded

session_start


Session Stop

Unity

UnityWebRequest.Post("http://localhost:8080/", "session_start", 
    "application/x-www-form-urlencoded").SendWebRequest();`

Curl

curl -X POST -d "session_stop" http://DEVICE_IP_ADDR:8080/

Raw

POST / HTTP/1.1
Content-Type: application/x-www-form-urlencoded

session_stop


Marker Start

This request takes a single parameter, the marker name, whose placeholder here is MARKER_NAME.

Unity

UnityWebRequest.Post("http://localhost:8080/", "marker_start&name=MARKER_NAME", 
    "application/x-www-form-urlencoded").SendWebRequest();`

Curl

curl -X POST -d "marker_start&name=MARKER_NAME" http://DEVICE_IP_ADDR:8080/

Raw

POST / HTTP/1.1
Content-Type: application/x-www-form-urlencoded

marker_start&name=MARKER_NAME


Marker Stop

This request takes a single parameter, the marker name, whose placeholder here is MARKER_NAME.

Unity

UnityWebRequest.Post("http://localhost:8080/", "marker_stop&name=MARKER_NAME", 
    "application/x-www-form-urlencoded").SendWebRequest();`

Curl

curl -X POST -d "marker_stop&name=MARKER_NAME" http://DEVICE_IP_ADDR:8080/

Raw

POST / HTTP/1.1
Content-Type: application/x-www-form-urlencoded

marker_stop&name=MARKER_NAME


Upload

Requests uploading of any completed sessions.

Precisely when upload starts and completes is largely up to the OS. Scripts should allow time for upload completion before tearing down the process under test.

Unity

UnityWebRequest.Post("http://localhost:8080/", "upload", 
    "application/x-www-form-urlencoded").SendWebRequest();`

Curl

curl -X POST -d "upload" http://DEVICE_IP_ADDR:8080/

Raw

POST / HTTP/1.1
Content-Type: application/x-www-form-urlencoded

upload


Launch Complete

Records the special marker that marks the point at which app launch is considered completed.

Unity

UnityWebRequest.Post("http://localhost:8080/", "record_launch", 
    "application/x-www-form-urlencoded").SendWebRequest();`

Curl

curl -X POST -d "record_launch" http://DEVICE_IP_ADDR:8080/

Raw

POST / HTTP/1.1
Content-Type: application/x-www-form-urlencoded

record_launch
Last updated on