A problem occurred while creating rules. Please let me know what is the problem!

{
 "name": "every7AM. turn on light",
 "actions": [
   {
     "every": {
       "specific": {
         "daysOfWeek": [
           "Sun",
           "Mon",
           "Tue",
           "Wed",
           "Thu",
           "Fri",
           "Sat"
         ],
         "reference": "Midnight",
         "offset": {
           "value": {
             "integer": 420,
             "type": "integer"
           },
           "unit": "Minute"
         }
       },
       "actions": [
         {
           "command": {
             "devices": [
               "<deviceID>"
             ],
             "commands": [
               {
                 "component": "main",
                 "capability": "switch",
                 "command": "on"
               }
             ]
           },
           "type": "command"
         },
         {
           "command": {
             "devices": [
               "<deviceID>"
             ],
             "commands": [
               {
                 "component": "main",
                 "capability": "switch",
                 "command": "on"
               },
               {
                 "component": "main",
                 "capability": "airConditionerMode",
                 "command": "setAirConditionerMode",
                 "arguments": [
                   {
                     "string": "cool",
                     "type": "string"
                   }
                 ]
               },
               {
                 "component": "main",
                 "capability": "thermostatCoolingSetpoint",
                 "command": "setCoolingSetpoint",
                 "arguments": [
                   {
                     "integer": 23,
                     "type": "integer"
                   }
                 ]
               }
             ]
           },
           "type": "command"
         }
       ],
       "sequence": {
         "actions": "Parallel"
       }
     },
     "type": "every"
   }
 ]
}

when i tried to create rule, the error message below is output.

{
    "error": {
        "code": "ConstraintViolationError",
        "message": "The request is malformed.",
        "details": [
            {
                "code": "BodyMalformedError",
                "target": "type",
                "message": "Unrecognized field \"type\" (class v20190122.internal.st.behaviors.Operand), not marked as ignorable",
                "details": []
            }
        ]
    }
}

I know the approximate cause, but I don’t know what part to fix specifically. help please!

I found out why!
rules api doesn’t support “type”.
so i removed all “type” elements, then i receive “200 OK”! :slight_smile:

1 Like