Update Tap-to-Run

Last Updated on : 2023-07-06 08:27:40download

Update a specified tap-to-run scene based on the tap-to-run ID. The maximum number of actions is 50.

API address

PUT: /v2.0/iot-03/scenes/{scene_id}

Request parameter

Parameter nameTypeINRequiredDescription
scene_idStringuritrueThe ID of a tap-to-run scene.

Description of body

Parameter nameTypeINRequiredDescription
nameString trueThe name of a specified tap-to-run scene.
dslSceneDsl trueThe language of tap-to-run rules.

Description of dsl

Parameter nameTypeINRequiredDescription
actionsList trueThe list of tap-to-run actions.

Description of actions

Parameter nameTypeINRequiredDescription
execution_typeString trueThe execution type.
  • deviceIssue: sent by a device.
  • deviceGroupIssue: sent by a device group.
  • delay: delay action.
execution_ruleObject trueThe execution rule. See the details of execution_rule.

Return parameter

Parameter nameTypeDescription
resultBooleanThe returned result. Valid values:
  • true: Updated successfully.
  • false: Failed to update it.

Request example

PUT: /v2.0/iot-03/scenes/wukW5YYf561r****
{
  "name": "This is a tap-to-run",
  "dsl": {
    "actions": [
      {
        "execution_type": "delay",
        "execution_rule": {
          "delay_seconds": 60
        }
      },
      {
        "execution_type": "deviceIssue",
        "execution_rule": {
          "execution_id": "vdevo16292691746****",
          "function_code": "bright_value",
          "function_value": 20
        }
      },
      {
        "execution_type": "deviceGroupIssue",
        "execution_rule": {
          "execution_id": "144790134147200****",
          "function_code": "switch_1",
          "function_value": true
        }
      }
    ]
  }
}

Return example

{
    "result": true,
    "t": 1635844703309,
    "success": true
}

Error code

For more information, see error code.

Details of execution_rule

  • When execution_type is delay:

    Parameter nameTypeDescriptionRequired
    delay_secondsLongThe delay time. The value range is 1 to 5 × 60 × 60. Unit: second.Yes
  • When execution_type is deviceIssue or deviceGroupIssue:

    Parameter nameTypeDescriptionRequired
    execution_idStringThe ID of a specified device or device group.Yes
    function_codeStringThe instruction code of a device or device group.Yes
    function_valueObjectThe instruction value of a device or device group.Yes