# Otii requests ## otii_create_project Create a new project. ### Request Key | Value --- | --- **cmd** | "otii_create_project" ### Response Key | Value --- | --- **cmd** | "otii_create_project" **data** | otii_create_project data #### Data Key | Type | Required | Description --- | --- | --- | --- **project_id** | Number | Yes | The project id. ```JSON { "project_id": 1 } ``` ## otii_get_active_project Returns the active project, if there is one. ### Request Key | Value --- | --- **cmd** | "otii_get_active_project" ### Response Key | Value --- | --- **cmd** | "otii_get_active_project" **data** | otii_get_active_project data #### Data Key | Type | Required | Description --- | --- | --- | --- **project_id** | Number | Yes | The project id if one exists, otherwise -1. ```JSON { "project_id": 1 } ``` ## otii_get_device_id Get device id from device name. ### Request Key | Value --- | --- **cmd** | "otii_get_device_id" **data** | otii_get_device_id data #### Data Key | Type | Required | Valid values --- | --- | --- |--- **device_name** | String | Yes | Device name. ```JSON { "device_name": "Arc" } ``` ### Response Key | Value --- | --- **cmd** | "otii_get_device_id" **data** | otii_get_device_id data #### Data Key | Type | Required | Description --- | --- | --- | --- **device_id** | String | Yes | Device id of the first device with the requested name. ```JSON { "device_id": "Arc512031204843494E3130393033313036" } ``` ## otii_get_devices List of connected devices. ### Request Key | Value --- | --- **cmd** | "otii_get_devices" **data** | otii_get_devices data #### Data Key | Type | Required | Valid values --- | --- | --- |--- **timeout** | int | No | Timeout in seconds (defaults to 0 seconds) ```JSON { "timeout": 5 } ``` ### Response Key | Value --- | --- **cmd** | "otii_get_devices" **data** | otii_get_devices data #### Data Key | Type | Required | Description --- | --- | --- | --- **devices** | Array | Yes | List of Device objects, empty array if no connected devices ```JSON { "devices": [] } ``` #### Device object Key | Type | Required | Description --- | --- | --- | --- **device_id** | String | Yes | Unique id for the device **name** | String | Yes | Name of the device **type** | String | Yes | Type of device (Arc/UART) ```JSON { "device_id": "Arc12345678912345678912345678900001", "name": "Arc", "type": "Arc" } ``` ## otii_get_licenses **Requires Otii 3** Get a list of licenses for the logged in user. ### Request Key | Value --- | --- **cmd** | "otii_get_licenses" ### Response Key | Value --- | --- **cmd** | "otii_get_licenses" **data** | otii_get_licenses data #### Data Key | Type | Required | Description --- | --- | --- | --- **licenses** | Array | Yes | List of License objects, empty array if no licenses are available. ```JSON { "licenses": [] } ``` #### License object Key | Type | Required | Description --- | --- | --- | --- **id** | Number | Yes | License id **type** | String | Yes | Type of license **reserved_to** | String | Yes | Name of user the license is reserved to or empty **hostname** | String | Yes | Hostname of machine the license is reserved to or empty **available** | Boolean | Yes | True if the license can be reserved by the logged in user, otherwise false **addons** | Array | Yes | List of addons for the license ```JSON { "id": 1234, "type": "Pro", "reserved_to": "joe", "hostname": "joes_pc", "available": true, "addons": ["Automation"] } ``` ## otii_login **Requires Otii 3** Login user to the license server. ### Request Key | Value --- | --- **cmd** | "otii_login" **data** | otii_login data #### Data Key | Type | Required | Valid values --- | --- | --- |--- **username** | String | Yes | The user id. **password** | String | Yes | The user password. ```JSON { "username": "joe", "password": "PASSWORD" } ``` ### Response Key | Value --- | --- **cmd** | "otii_login" ## otii_logout **Requires Otii 3** Logout user from the license server. ### Request Key | Value --- | --- **cmd** | "otii_logout" ### Response Key | Value --- | --- **cmd** | "otii_logout" ## otii_open_project Open an existing project. If the filename passed to this function is relative, it will be relative to the server setting 'Project save destination' in Otii. ### Request Key | Value --- | --- **cmd** | "otii_open_project" **data** | otii_open_project data #### Data Key | Type | Required | Valid values --- | --- | --- |--- **filename** | String | Yes | File name for the project. **force** | Boolean | No | Set to true to open a file even if unsaved data exists. (false by default) **progress** | Boolean | No | To receive progress notifications when opening long recordings set this to true. (false by default) ```JSON { "filename": "myMeasurement.otii", "force": true, "progress": false } ``` ### Response Key | Value --- | --- **cmd** | "otii_open_project" **data** | otii_open_project data #### Data Key | Type | Required | Descriptionjk --- | --- | --- | --- **project_id** | Number | Yes | The project id of the opened project. **filename** | String | Yes | Absolute path to opened project file. ```JSON { "project_id": 1, "filename": "/Users/qoitech/Documents/otii/myMeasurement.otii" } ``` ## otii_reserve_license **Requires Otii 3** Reserve a license. ### Request Key | Value --- | --- **cmd** | "otii_reserve_license" **data** | otii_reserve_license data #### Data Key | Type | Required | Valid values --- | --- | --- |--- **license_id** | Number | Yes | The license id to reserve. ```JSON { "license_id": 1234 } ``` ### Response Key | Value --- | --- **cmd** | "otii_reserve_license" ## otii_return_license **Requires Otii 3** Return a license. ### Request Key | Value --- | --- **cmd** | "otii_return_license" **data** | otii_return_license data #### Data Key | Type | Required | Valid values --- | --- | --- |--- **license_id** | Number | Yes | The license id to return. ```JSON { "license_id": 1234 } ``` ### Response Key | Value --- | --- **cmd** | "otii_return_license" ## otii_set_all_main Turn on or off the main power on all connected devices. ### Request Key | Value --- | --- **cmd** | "otii_set_all_main" **data** | otii_set_all_main data #### Data Key | Type | Required | Valid values --- | --- | --- |--- **enable** | Boolean | Yes | True turns on power, false turns off power. ```JSON { "enable": true } ``` ### Response Key | Value --- | --- **cmd** | "otii_set_all_main" ## otii_shutdown Shutdown TCP server. ### Request Key | Value --- | --- **cmd** | "otii_shutdown" ### Response Key | Value --- | --- **cmd** | "otii_shutdown"