Send args to provision via API

Hi,

There are any way to create a preset and send arguments to provision script via API?

I’m reading the Wiki but is not explained about that:

query = {
  "weight": 0,
  "precondition": "{\"_tags\": \"test\"}"
  "configurations": [
    {
      "type": "value",
      "name": "InternetGatewayDevice.ManagementServer.PeriodicInformEnable",
      "value": "true"
    }
  ]
}

I can only create a preset, asign a name, channel, events, precondition and configurations, but no way to send arguments in configurations.

Thanks!

On the preset screen, select provision script under the configuration tab, then you have two additional text boxes. One for the provision name (must match the name on the provision screen), and one for args.

Here is the configurations section for two different presets:
This first one sends the argument “Scheduled” to the provision script.
image

And this one sends the argument “Boot” to the provision script.
image

The reason for this, is sometimes we only want to do firmware upgrades when the CPE has just booted up, and other times we only want to do them when scheduled (between 2am and 4am). In the Firmware_Upgrade script I have builtin the logic as to when a firmware for the given CPE gets upgraded.

1 Like

Hi akcoder and thanks by your support.

I need to do this using API. In GUI i can do it without problem, but i can’t do that over API.

Regards!

How can you add Event? I send “events”: “1 BOOT”, but it’s not working.

It’s works: “events”: {“0 BOOTSTRAP”: true}
fdavidcn, I can set like that: { “type”: “provision”, “name”: “YourProvisionName”, “args”: [“MyArg”] }

The easiest way is to create a preset via the GUI, then use the API to pull back the JSON for that preset.

@akcoder How do you use the arguments inside the provision script? I haven’t really found a good explanation of this.

you have a global variable args that can be used in the provision scripts. I pass only one argument and I access it by args[0]

1 Like