# Send args to provision via API

**URL:** <https://forum.genieacs.com/t/send-args-to-provision-via-api/914>\
**Category:** Uncategorized\
**Created:** [July 23, 2020, 3:15pm UTC](https://forum.genieacs.com/t/send-args-to-provision-via-api/914 "2020-07-23T15:15:40Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![fdavidcn](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/fdavidcn/32/594_2.png) [@fdavidcn](https://forum.genieacs.com/u/fdavidcn)\
**Post date:** [July 23, 2020, 3:15pm UTC](https://forum.genieacs.com/t/send-args-to-provision-via-api/914/1 "2020-07-23T15:15:40Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![akcoder](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/akcoder/32/11_2.png) [@akcoder](https://forum.genieacs.com/u/akcoder)\
**Post date:** [July 23, 2020, 4:59pm UTC](https://forum.genieacs.com/t/send-args-to-provision-via-api/914/2 "2020-07-23T16:59:48Z")

</div>

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](https://canada1.discourse-cdn.com/flex035/uploads/genieacs/original/1X/0fe47c2977cca17f18595b42d830b41e72750621.png)

And this one sends the argument “Boot” to the provision script.  
 ![image](https://canada1.discourse-cdn.com/flex035/uploads/genieacs/original/1X/c600af428ae4ff65463ae7d1e96d39b1a5e92632.png)

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.

---

<div class="post-metadata">

**Author:** ![fdavidcn](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/fdavidcn/32/594_2.png) [@fdavidcn](https://forum.genieacs.com/u/fdavidcn)\
**Post date:** [July 23, 2020, 8:35pm UTC](https://forum.genieacs.com/t/send-args-to-provision-via-api/914/3 "2020-07-23T20:35:18Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![wariator](https://avatars.discourse-cdn.com/v4/letter/w/ac8455/32.png) [@wariator](https://forum.genieacs.com/u/wariator)\
**Post date:** [July 27, 2020, 8:21am UTC](https://forum.genieacs.com/t/send-args-to-provision-via-api/914/4 "2020-07-27T08:21:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![wariator](https://avatars.discourse-cdn.com/v4/letter/w/ac8455/32.png) [@wariator](https://forum.genieacs.com/u/wariator)\
**Post date:** [July 27, 2020, 9:58am UTC](https://forum.genieacs.com/t/send-args-to-provision-via-api/914/5 "2020-07-27T09:58:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![akcoder](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/akcoder/32/11_2.png) [@akcoder](https://forum.genieacs.com/u/akcoder)\
**Post date:** [July 27, 2020, 4:35pm UTC](https://forum.genieacs.com/t/send-args-to-provision-via-api/914/6 "2020-07-27T16:35:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mjducharme](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/mjducharme/32/59_2.png) [@mjducharme](https://forum.genieacs.com/u/mjducharme)\
**Post date:** [January 11, 2021, 2:18am UTC](https://forum.genieacs.com/t/send-args-to-provision-via-api/914/7 "2021-01-11T02:18:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![lavira](https://avatars.discourse-cdn.com/v4/letter/l/87869e/32.png) [@lavira](https://forum.genieacs.com/u/lavira)\
**Post date:** [January 11, 2021, 12:09pm UTC](https://forum.genieacs.com/t/send-args-to-provision-via-api/914/8 "2021-01-11T12:09:02Z")

</div>

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]`
