Skip to content

API Reference

Martin Konopka edited this page Mar 6, 2019 · 10 revisions

UXC allows external application to control session recording, stimuli timeline, access gaze data during and after recording. UXC expose this functionality through REST services and websockets implemented with Microsoft SignalR. The local API are by default hosted on this endpoint:

http://localhost:55555/

Before calling the API, ensure:

  • UXC has a reservation for the port in the firewall. See Firewall Setup guide.
  • REST services accepts and returns data in JSON format, use content-type: application/jsonin request header.
  • If your web application is hosted on different domain, enable CORS for POST calls.
  • If your web application is secured, enable HTTPS for UXC. See Enabling HTTPS guide.

REST API services

SignalR hubs

TBA

Entities

REST Service definition template

Each REST API service is described with this template:

  • Title
  • HTTP Method, API route
  • Description
  • (optional) Request definition - parameters list and accepted request body for POST requests
  • Reponse definition - response type and possible values
  • Example CURL calls with sample responses

Session Definition used in API examples

For example CURL calls we use this sample session definition.

{
    "project": "News reading experiment",
    "name": "Pilot session",
    "devices": [
        { "device": "ET" }, 
        { "device": "EXTEV" },
        { "device": "KB" }, 
        { "device": "ME" },
        { "device": "WCV" }, 
        { "device": "SC" }
    ],
    "welcome": {
        "description": "In this experiment you will read news articles.\nTry to identify public opinion about the recent events.",
        "id": "User",
        "questions": [
            {
                "actionType": "WriteAnswerQuestion",
                "id": "Name",
                "isRequired": true
            }
        ]
    },
    "preSessionSteps": [
        { 
            "action": { "actionType": "EyeTrackerCalibration" } 
        } 
    ],
    "sessionSteps": [
        {
            "action": { "actionType": "EyeTrackerValidation" } 
        },
        { 
            "action": {
                "actionType": "LaunchProgram",
                "path": "c:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe",
                "arguments": "https://www.google.com/ --kiosk",
            },
            "completion": { "hotkeys": [ "F10" ] } 
        },
        {
            "action": { 
                "actionType": "Questionary",
                "questions": [
                    {
                        "actionType": "WriteAnswerQuestion",
                        "question": "What is the public opinion about the recent events?",
                        "isRequired": true
                    }
                ]
            }
        }
    ],
    "postSessionSteps": [
        {
            "action": {
                "actionType": "Instructions",
                "instructions": "Thank you for participating in the experiment." 
            },
            "completion": { "duration": "00:00:10" }
        }
    ]
}
Clone this wiki locally