# SetParameterValues - Using Multiple Requests

**URL:** https://forum.genieacs.com/t/setparametervalues-using-multiple-requests/2482
**Category:** Uncategorized
**Created:** [March 16, 2022, 9:50am UTC](https://forum.genieacs.com/t/setparametervalues-using-multiple-requests/2482 "2022-03-16T09:50:43Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![washcroft](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/washcroft/32/809_2.png) [@washcroft](https://forum.genieacs.com/u/washcroft)
#### Post date: [March 16, 2022, 9:50am UTC](https://forum.genieacs.com/t/setparametervalues-using-multiple-requests/2482/1 "2022-03-16T09:50:43Z")

</div>

Hello,  
I have created a bunch of provisioning scripts which are working well, and I am now just going through the final process of optimizing them.

In the access log I see this:

```auto
2022-03-16T02:54:11.613Z [INFO] ::ffff:46.102.196.2 9c65ee-H660GM-DSNW2692fc78: ACS request; acsRequestId="17f90a49db1010a" acsRequestName="SetParameterValues"
2022-03-16T02:54:11.992Z [INFO] ::ffff:46.102.196.2 9c65ee-H660GM-DSNW2692fc78: ACS request; acsRequestId="17f90a49db1010b" acsRequestName="SetParameterValues"
2022-03-16T02:54:12.704Z [INFO] ::ffff:46.102.196.2 9c65ee-H660GM-DSNW2692fc78: ACS request; acsRequestId="17f90a49db1010c" acsRequestName="SetParameterValues"
2022-03-16T02:54:13.082Z [INFO] ::ffff:46.102.196.2 9c65ee-H660GM-DSNW2692fc78: ACS request; acsRequestId="17f90a49db1010d" acsRequestName="SetParameterValues"
2022-03-16T02:54:13.483Z [INFO] ::ffff:46.102.196.2 9c65ee-H660GM-DSNW2692fc78: ACS request; acsRequestId="17f90a49db1010e" acsRequestName="SetParameterValues"

```

…which is caused by this part of the script:

```auto
// Configure the WAN1 IP connection
  const values = {
    Add: true,
    Enable: true,
    NATEnabled: true,
    Name: "INTERNET_VOIP",
    AddressingType: "DHCP",
    ConnectionType: "IP_Dynamic"
  };
  
  for (let key of Object.keys(values))
  {
    let valuePath = "InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1." + key;
    declare(valuePath, null, {value: values[key]});
  }

```

Why is this using multiple requests to set the values one at a time rather than batching them up into a single request?

I have also tried setting the 2nd param of the declare call to both of these:

`{value: Date.now()}`  
`{value: 1}`

I have also tried prereading the parameters on the object before setting them:

`declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.*", {path: Date.now(), value: Date.now()});`

Thanks!

---

<div class="post-metadata">

### Author: ![rudymartin](https://avatars.discourse-cdn.com/v4/letter/r/919ad9/32.png) [@rudymartin](https://forum.genieacs.com/u/rudymartin)
#### Post date: [March 17, 2022, 5:06pm UTC](https://forum.genieacs.com/t/setparametervalues-using-multiple-requests/2482/2 "2022-03-17T17:06:47Z")

</div>

as is, I do not think the number of requests is important as long as all the parameters reach the device and are properly set. This issue might only be important when a high number of cpe connect to the ACS after a blackout (happened to me during the past year, had to hack a lot to get around it).

and I’m not sure if this can help and might have no effect on what you want, but: have you read this?

[https://docs.genieacs.com/en/latest/provisions.html#creating-deleting-object-instances](https://docs.genieacs.com/en/latest/provisions.html#creating-deleting-object-instances)

please do read the code example, specifically the declare with parameters between square brackets. You will have to tweak your code to generate a string and then use it on the declare() function.

if you try it let us know if there was a difference.

rm

---

<div class="post-metadata">

### Author: ![washcroft](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/washcroft/32/809_2.png) [@washcroft](https://forum.genieacs.com/u/washcroft)
#### Post date: [March 17, 2022, 5:20pm UTC](https://forum.genieacs.com/t/setparametervalues-using-multiple-requests/2482/3 "2022-03-17T17:20:05Z")

</div>

@rudymartin Thank you. It is all working, it was more of a want to understand that scripts are being written correctly and efficiently.

I do use the square bracket method when creating new instances, but this is updating several values of an existing instance.

---

<div class="post-metadata">

### Author: ![rudymartin](https://avatars.discourse-cdn.com/v4/letter/r/919ad9/32.png) [@rudymartin](https://forum.genieacs.com/u/rudymartin)
#### Post date: [March 17, 2022, 5:27pm UTC](https://forum.genieacs.com/t/setparametervalues-using-multiple-requests/2482/4 "2022-03-17T17:27:19Z")

</div>

the mention I did about the square brackets was about using them **inside** the parameter key.

like this:

```auto
declare("InternetGatewayDevice.X_BROADCOM_COM_IPAddrAccCtrl.X_BROADCOM_COM_IPAddrAccCtrlListCfg.[SourceIPAddress:192.168.1.0,SourceNetMask:255.255.255.0]", {path: now}, {path: 1});

```

---

<div class="post-metadata">

### Author: ![washcroft](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/washcroft/32/809_2.png) [@washcroft](https://forum.genieacs.com/u/washcroft)
#### Post date: [March 17, 2022, 5:30pm UTC](https://forum.genieacs.com/t/setparametervalues-using-multiple-requests/2482/5 "2022-03-17T17:30:26Z")

</div>

I know, but that will always create a new instance (unless an instance with those two params set to those two values already exists).

That syntax doesn’t work for changing a bunch of values on an instance that already exists.
