# Create new instance WAN (NBI)

**URL:** <https://forum.genieacs.com/t/create-new-instance-wan-nbi/4663>\
**Category:** Uncategorized\
**Created:** [November 1, 2023, 1:36pm UTC](https://forum.genieacs.com/t/create-new-instance-wan-nbi/4663 "2023-11-01T13:36:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rhuanyago](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/rhuanyago/32/425_2.png) [@rhuanyago](https://forum.genieacs.com/u/rhuanyago)\
**Post date:** [November 1, 2023, 1:36pm UTC](https://forum.genieacs.com/t/create-new-instance-wan-nbi/4663/1 "2023-11-01T13:36:53Z")

</div>

Good morning friends, I would like some help if possible, I need to create a new wan instance (voip) through the api (nbi) but through AddObject it does not work like in ACS Ex:

{“name”:“addObject”,“objectName”:“InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.[Key:Value,Key:Value]”}’

Do you know if there would be any other alternative?

---

<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:** [November 3, 2023, 4:35pm UTC](https://forum.genieacs.com/t/create-new-instance-wan-nbi/4663/2 "2023-11-03T16:35:18Z")

</div>

Using AddObject you are not guaranteed an instance ID. So I avoid this approach.

This is some pseudocode you can string together to accomplish your goal via a provision script. The paths in here are not valid. Thats for you to fill in:

```auto
  declare('InternetGatewayDevice.Voip.*', {value: now, path: now}); // Refresh everything
  declare('InternetGatewayDevice.Voip.[]', null, {path: 0}); // Remove all instance (no changes are actually made until the end of the provision script)

const sn = declare('Device.SerialNumber', {value: 1})[0];
const voipData = ext('myScript', 'voipSettingsFoSerialNumber', {serialNumber: sn});

declare(`InternetGatewayDevice.Voip.[PhoneNumber:${voipData.phone},AnotherParam:${voipData.anotherParam}]`, {path: 1}, {path: 1});

```

This will cause GenieACS to remove any existing voip information **if it does not** match the incoming voip data.

---

<div class="post-metadata">

**Author:** ![rhuanyago](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/rhuanyago/32/425_2.png) [@rhuanyago](https://forum.genieacs.com/u/rhuanyago)\
**Post date:** [November 6, 2023, 12:17pm UTC](https://forum.genieacs.com/t/create-new-instance-wan-nbi/4663/3 "2023-11-06T12:17:49Z")

</div>

That’s right, but is there no way for NBI to pass all the fields I need for creation?

Because I have a system with a screen that I wanted to create there without using provisioning.

---

<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:** [November 6, 2023, 7:10pm UTC](https://forum.genieacs.com/t/create-new-instance-wan-nbi/4663/4 "2023-11-06T19:10:59Z")

</div>

There is always ways to do this with the NBI. But right now its not a simple step. You have to first addObject, then refresh all the params in that tree. Then figure out whats new, then update the new instance.

The way I handle stuff like this is by adding a tag to the router I want to do something with. Example, if I want to update the port forwards on a router I add the tag `UpdatePortForwards` then I initiate a connection request to the CPE and let my provision script take over.
