How to request 50 GPV in provision

I need to get approx 50 GPV in the provisioning script, but it is giving the error ‘Too many commit iterations.’ Also I’m calling declare() in a loop? Is there another approach to use declare for a list?

// Define an object to store the paths and their corresponding values
const paths = {};

// Define an array of parameters you want to declare
const parametersToDeclare = [
'Device.WiFi.SSID.1.SSID',
'Device.WiFi.SSID.2.SSID',
'Device.WiFi.AccessPoint.1.Security.KeyPassphrase',
'Device.WiFi.AccessPoint.2.Security.KeyPassphrase',
'Device.WiFi.AccessPoint.1.Security.ModeEnabled',
'Device.WiFi.AccessPoint.2.Security.ModeEnabled',
'Device.IP.Interface.2.IPv4Address.1.SubnetMask',
'Device.DeviceInfo.SoftwareVersion',
'Device.IP.Interface.2.IPv4Address.1.IPAddress',
'Device.Users.User.1.Password',
'Device.Users.User.1.Username',
'Device.Ethernet.Interface.2.MACAddress',
'Device.DeviceInfo.MemoryStatus.Free',
'Device.DeviceInfo.ModelName',
'Device.DeviceInfo.MemoryStatus.Total',
'Device.Time.LocalTimeZone',
'Device.DeviceInfo.ManufacturerOUI',
'Device.DeviceInfo.ProductClass',
'Device.DeviceInfo.SoftwareVersion',
'Device.DeviceInfo.UpTime',
'Device.IP.Interface.3.IPv4Address.1.IPAddress',
'Device.Ethernet.Interface.1.MACAddress',
'Device.DeviceInfo.TemperatureStatus.TemperatureSensor.2.Value',
'Device.DeviceInfo.TemperatureStatus.TemperatureSensor.3.Value',
'Device.DeviceInfo.HardwareVersion',
'Device.WiFi.SSID.4.SSID',
'Device.WiFi.SSID.5.SSID',
'Device.WiFi.AccessPoint.1.SSIDAdvertisementEnabled',
'Device.WiFi.AccessPoint.2.SSIDAdvertisementEnabled',
'Device.WiFi.SSID.4.Enable',
'Device.WiFi.SSID.5.Enable',
  /*
'Device.WiFi.AccessPoint.4.Security.KeyPassphrase',
'Device.WiFi.AccessPoint.5.Security.KeyPassphrase',
'Device.WiFi.AccessPoint.4.Security.ModeEnabled',
'Device.WiFi.AccessPoint.5.Security.ModeEnabled',
'Device.WiFi.Radio.1.Channel',
'Device.WiFi.Radio.2.Channel',
'Device.WiFi.Radio.1.OperatingChannelBandwidth',
'Device.WiFi.Radio.2.OperatingChannelBandwidth',
'Device.WiFi.AccessPoint.1.IsolationEnable',
'Device.WiFi.AccessPoint.2.IsolationEnable',
'Device.IP.Interface.3.IPv4Address.1.AddressingType',
'Device.Ethernet.Interface.1.Stats.BytesReceived',
'Device.Ethernet.Interface.1.Stats.BytesSent',
*/
];

// Declare the specified parameters and store their values
for (let parameter of parametersToDeclare) {
  let s = declare(parameter, { path: Date.now(), value: Date.now() });

  if (s.size) {
    for (let p of s) {
      if (p.path && p.value) {
        paths[p.path] = p.value[0]; // Assign the value to the corresponding path in the paths object
      }
    }
  }
}

const postData = JSON.stringify({
  parameterValues: paths // Use the paths object in the JSON object
});

const res = ext("http-request", "sendHttpPost", postData);

if (res) {
  // Check the HTTP response status code
  log("Response from server:", JSON.stringify(res));
} else {
  log("Error sending HTTP request.");
}

Try changing this line: let s = declare(parameter, { path: Date.now(), value: Date.now() });
to this:

    let s = declare(parameter, { value: Date.now() });

There is no need to refresh the path all the time.

1 Like