# 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_battery_profile_info **Note: This request requires a battery toolbox license.** Get info about a battery profile. ### Request Key | Value -------- | --- **cmd** | "otii_get_battery_profile_info" **data** | otii_get_battery_profile_info data #### Data Key | Type | Required | Valid values ---------------------- | ------ | -------- | ------------ **battery_profile_id** | String | Yes | Id of the battery profile ```JSON { "battery_profile_id": "6ef4a003-22c6-44d1-9e37-21de0526f5f2" } ``` ### Response Key | Value -------- | --- **cmd** | "otii_get_battery_profile_info" **data** | otii_get_battery_profile_info data #### Data Key | Type | Required | Description ---------------------- | ------ | -------- | ----------- **battery_profile_id** | String | Yes | The battery profile id **name** | String | Yes | Name **battery** | Object | Yes | Battery information **discharge_tables** | Array | Yes | Discharge table information ```json { "battery_profile_id":"6ef4a003-22c6-44d1-9e37-21de0526f5f2" "name":"AAA Super Charged", "battery": { "capacity":207.07, "capacityunit":"mAh", "cutoffvoltage":3, "manufacturer":"MikroE", "maxtemperature":60, "mintemperature":-20, "model":"190mAh_LiPo", "size":"", "sizeunit":"mm", "temperatureunit":"°C", "voltage":3.6, "voltageunit":"V", "weight":0, "weightunit":"g", "worktemperature":20 } "discharge_tables": [{ "dischargetable_id":"22dbed46-1b83-4e04-8964-aa4e5187f3cc" }] } ``` #### Battery information object Key | Type | Required | Description ------------------- | ------ | -------- | ----------- **capacity** | Number | No | **capacityunit** | String | No | **cutoffvoltage** | Number | No | **manufacturer** | String | No | **maxtemperature** | Number | No | **mintemperature** | Number | No | **model** | String | No | **size** | String | No | **sizeunit** | String | No | **voltage** | Number | No | **voltageunit** | String | No | #### Discharge tabble information object Key | Type | Required | Description --------------------- | ------------------------ | -------- | ----------- **dischargetable_id** | String | Yes | **current** | Number | No | **currentunit** | String | No | **device** | Device Object | No | **dischargeprofile** | Discharge Profile Object | No | **softwareVersion** | String | No | **temperature** | Number | No | **temperatureunit** | String | No | #### Device object Key | Type | Required | Description ------------------- | ---------------------- | -------- | ----------- **type** | "Arc" or "Ace" | Yes | **id** | String | Yes | **hardwareId** | string | Yes | **firmwareVersion** | String | No | #### Discharge profile object Key | Type | Required | Description ---------------- | -------------------------- | -------- | ----------- **low** | Discharge Step Info Ibject | Yes | **high** | Discharge Step Info Object | Yes | **exitConditions | Exit Conditions Object | Yes | ### Discharge step info object Key | Type | Required | Description --------- | ---------------------------------- | -------- | ----------- **mode** | "current", "power" or "resistance" | Yes | **value** | Number | Yes | **time** | Number | Yes | ### Exit conditions object Key | Type | Required | Description -------------- | ------ | -------- | ----------- **voltage** | Number | Yes | **ocv** | Number | Yes | **iterations** | Number | Yes | ## otii_get_battery_profiles **Note: This request requires a battery toolbox license.** Get a list of all available battery profiles. ### Request Key | Value -------- | ----- **cmd** | "otii_get_battery_profiles" ### Response Key | Value -------- | --- **cmd** | "otii_get_battery_profiles" **data** | otii_get_battery_profiles data #### Data Key | Type | Required | Description -------------------- | ----- | -------- | -------------------------------------- **battery_profiles** | Array | Yes | List of all available battery profiles ```JSON { "battery_profiles": [{ "battery_profile_id": "1ce61608-9164-41a9-affb-221f1ea9f187", "name": "CR2032-NoName", "manufacturer": "NoName", "model": "CR2032" }, { "battery_profile_id": "b2ce2796-80f7-4386-8759-be31466927b8", "name": "CR2450-NoName", "manufacturer": "NoName", "model": "CR2450" }] } ``` #### Battery profile object Key | Type | Required | Description ---------------------- | ------ | -------- | ----------- **battery_profile_id** | String | Yes | Supply id **name** | String | Yes | Name **manufacturer** | String | No | Battery manufacturer. **model** | String | No | Battery model. ## 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"