campaign.update

The campaign.update command is used to update an existing campaign.

TR50 Request


                            {
    "cmd": {
        "command": "campaign.update",
        "params": {
            "id":"5b081429fe2a13515877b452",
           "eventType": "campaign.thing",
            "firstAction": "1",
            "maxInProgress": 100,
            "name": "FOTA101",
            "actions": {
                "1": {
                    "params": {
                        "targetVersion": "30.00.006",
                        "thingKey": "$(event.thing.key)",
                        "waitForCompletion": true
                    },
                    "type": "thing.firmware.target_version_set"
                }
            }
           
        }
    }
}
      

Request Parameters

Name

Type

Required

Description

id

String

Yes

The unique identifier of the campaign to update.

name

String

 

The name of the campaign.

desc

String

 

The description of the campaign.

reportMode

String

 

The campaign reportModecontrols when a campaign report is generated and reported.

  • Off : The generation of the campaign reports is disabled

  • On : A campaign report is generated for each campaign execution of the campaign. When On is selected the all campaign events are reported for the next 30 days and later it automatically switches to the default On failure mode.

  • On failure (default): A campaign report is generated only when a campaign fails while executing.

event

Object

 

The event object. Parameters depend on the event type.

actions

Object

Yes

Object containing action objects indexed by non-zero integers cast as strings. Parameters depend on each action's type. Refer to the trigger.action.list call. The Actions Parameter table contains more information on each string or object in the action. Each trigger requires at least one action.

firstAction

Sting

Yes

The numeric string representing the first action to execute after the event.

canvas

Object

 

The canvas request object contains positioning information for the event and the success/failure ends. Default values are created if this information is missing and the campaign is loaded in the campaign GUI.

maxInProgress

Integer

 

The maximum number of campaign members that will be executed parallelly at a given point in time.

Actions Parameters

Name

Type

Required

Description

canvas

Object

 

JSON object consisting of top and left values. Positions the node on the drawing canvas. Units are in pixels. Values are relative to the last position of the node or the top left of the drawing canvas if the node has never been moved. With zooming and manual positioning, values can even become negative. Also, since there can be multiple success and failure ends, these are specified in the canvas object.

type

String

Yes

Action type.

params

Object

 

Parameters specific to each action object.

routes

Object

 

Positioning information for the action object.

TR50 Response

If the command is sent successfully a success message is returned. Otherwise, an error and error message will be returned.


                        {
  "cmd": {
    "success": true
  }
}