.. include:: /atkeywords.rst .. _Contract_RestApiModule_Outputs: ######################################### RestApiModule - Outputs Api ######################################### .. _Contract_RestApiModule_Outputs_GetAllOutputsOrByOutputName: Get all or one or more outputs by outputName ******************************************** Returns all available outputs and their (logical) state or one or more outputs by passing their outputName. See :ref:`SupportedDevices ` to learn more about what outputs are available. **Authorization level** * :red:`30 (RestApiModuleGetData )` **URL parameters** * **endcustomerId**: Endcustomer Id. * **assetId**: Asset Id. * **deviceId**: Device Id of peripheral linked to the asset. * **outputName1 / outputName2**: (optional) See :ref:`SupportedDevices ` to learn more about what outputs are available. .. http:get:: /endcustomers/{endcustomerId}/assets/{assetId}/restapi/hal/devices/{deviceId}/outputs?outputName={outputName1}&outputName={outputName2} **Example request**: .. sourcecode:: http GET /endcustomers/edfd1133-88ec-4f2d-abb8-16238c6ad926/assets/10401990013-123455789/restapi/hal/devices/WTIO1/outputs HTTP/1.1 Accept: application/json Authorization: Bearer eyJhbGciOiJS... X-API-Version: 1.0 **Example response**: .. sourcecode:: http HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8 Api-Supported-Versions: 1.0 [ { "name": "OUTD1", "value": 0 }, { "name": "OUTD2", "value": 0 }, //...more outputs... { "name": "OUTD8", "value": 0 } ] :statuscode 200: OK :statuscode 400: Bad Request, parameters validation failed :statuscode 401: Unauthorized. Something is wrong with the :mailheader:`Authorization` header of the request :statuscode 403: Forbidden. :statuscode 429: Too Many Requests. :statuscode 500: Internal Server Error :resheader Content-Type: application/json; charset=utf-8 :resheader Api-Supported-Versions: supported api versions :>json array outputs: array with outputs and their logical values (0 or 1) .. _Contract_RestApiModule_Outputs_GetAllOutputsOrByOutputName: Set one or more outputs *********************** Sets one or more outputs to a desired (logical) state. See :ref:`SupportedDevices ` to learn more about what outputs are available. **Authorization level** * :red:`31 (RestApiModuleExecuteCommand )` **URL parameters** * **endcustomerId**: Endcustomer Id. * **assetId**: Asset Id. * **deviceId**: Device Id of peripheral linked to the asset. **URL body** Array with outputs, each with their desired action and logical value(s). To be able to support all action types on a specific output, the following generic parameters are used for each output: * **state** (integer) : possible values : 1,2,3 or 4 - 1 : Set / Set Pulse : persistent set to a value or set to a value for a certain time - 2 : Reset : persistent set to value 0 - 3 : Toggle: persistent set to previous value - 4 : Interval: repetitively set to either value1 or value2 for a certain time - **value1** (integer) : 0 or >0 (always 1 for digital output) - **time1** (integer) : time in ms. Value may be 0 or >100 [100,65635] - **value2** (integer) : 0 or >0 (always 1 for digital output) - **time2** (integer) : time in ms. Value may be 0 or >100 [100,65635] .. image:: /content/Images/Interval.png :width: 10% The table below specifies the values for Value1, Time1, Value2, Time2 related to the State property .. table:: +-------------+-----------+----------+-----------+----------+-----------------------------------------------------------------------+ | | | | | | | | State | Value1 | Time1 | Value2 | Time2 | Result | +-------------+-----------+----------+-----------+----------+-----------------------------------------------------------------------+ | Reset | x | x | x | x | Persistent set to value 0 | +-------------+-----------+----------+-----------+----------+-----------------------------------------------------------------------+ | Toggle | x | x | x | x | Persistent set to previous value | +-------------+-----------+----------+-----------+----------+-----------------------------------------------------------------------+ | Set | >0 | 0 | 0 | 0 | Set persistently to Value1 | +-------------+-----------+----------+-----------+----------+-----------------------------------------------------------------------+ | Set | >0 | 1000 | 0 | 0 | Set to Value1 for 1000ms, then persistent set to value 0 (Set Pulse) | +-------------+-----------+----------+-----------+----------+-----------------------------------------------------------------------+ | Set | 0 | 0 | >0 | >0 | Not supported | +-------------+-----------+----------+-----------+----------+-----------------------------------------------------------------------+ | Interval | >0 | 1000 | >0 | 1000 | Set to Value1 for 1 second, then set to Value2 for | | | | | | | 1 second and repeat this endlessly. | +-------------+-----------+----------+-----------+----------+-----------------------------------------------------------------------+ .. http:post:: /endcustomers/{endcustomerId}/assets/{assetId}/restapi/hal/devices/{deviceId}/outputs **Example request**: .. sourcecode:: http POST /endcustomers/edfd1133-88ec-4f2d-abb8-16238c6ad926/assets/10401990013-123455789/restapi/hal/devices/WTIO1/outputs HTTP/1.1 Content-Type: application/json Accept: application/json Authorization: Bearer eyJhbGciOiJS... X-API-Version: 1.0 [ { "name": "OUTD1", "state" : 1, "value1" : 1, "time1" : 0, "value2" : 0, "time2" : 0 }, //more outputs... { "name": "OUTDX", "state" : 1, "value1" : 1, "time1" : 1000, "value2" : 0, "time2" : 0 } ] **Example response**: .. sourcecode:: http HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8 Api-Supported-Versions: 1.0 :statuscode 200: OK :statuscode 400: Bad Request, parameters validation failed :statuscode 401: Unauthorized. Something is wrong with the :mailheader:`Authorization` header of the request :statuscode 403: Forbidden. :statuscode 429: Too Many Requests. :statuscode 500: Internal Server Error :resheader Content-Type: application/json; charset=utf-8 :resheader Api-Supported-Versions: supported api versions