# DeleteObject api call not working

**URL:** <https://forum.genieacs.com/t/deleteobject-api-call-not-working/3261>\
**Category:** Uncategorized\
**Created:** [December 1, 2022, 3:13pm UTC](https://forum.genieacs.com/t/deleteobject-api-call-not-working/3261 "2022-12-01T15:13:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![RIsset](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/risset/32/1075_2.png) [@RIsset](https://forum.genieacs.com/u/RIsset)\
**Post date:** [December 1, 2022, 3:13pm UTC](https://forum.genieacs.com/t/deleteobject-api-call-not-working/3261/1 "2022-12-01T15:13:12Z")

</div>

I am trying to work with the object instances in genieACS. When following the documentation I found the following calls:

AddObject: [API Reference — GenieACS Documentation 1.2.9 documentation](https://docs.genieacs.com/en/latest/api-reference.html#addobject)  
DeleteObject: [API Reference — GenieACS Documentation 1.2.9 documentation](https://docs.genieacs.com/en/latest/api-reference.html#deleteobject)

While the call for addObject works. The call for deleting that new object doesn’t. I don’t get a fault, it simply does not work.

The object I am trying to delete is “InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.3”

With the post body being:  
{“name”: “deleteObject”, “objectName”: “InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.3”}

Any one have an idea what I might be doing wrong?

---

<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:** [December 1, 2022, 7:05pm UTC](https://forum.genieacs.com/t/deleteobject-api-call-not-working/3261/2 "2022-12-01T19:05:33Z")

</div>

If you are on a development/testing instance of GenieACS, then go into the UI and create a new config entry for cwmp.debug = true (Admin → Config → New Config). Repeat your testing. What is shown in the logs? That will help to narrow down where the issue is.

Why are you managing object instances directly? I’ve found it much easier to use provision scripts to manage the number of instances needed. If you are trying to test out switching a CPE from routed to bridge mode, unless your CPE throws faults, I’ve found it easier to disable the wan ppp instance and enable the bridge mode instance.

Here is a short provision which will switch a CPE from routed to bridge mode.

```auto
const now = Date.now();

disableRoutedInterfaces();

//Ensure we have a WANIPConnection instances
addBridgedInterface(1, 1, 'Bridged-ATM');
addBridgedInterface(2, 2, 'Bridged-PTM', {
    NATEnabled: false
});

log('Rebooting, because the CPE is dumb');
declare('Reboot', null, {value: Date.now()});

return;

function disableRoutedInterfaces() {
    declare('InternetGatewayDevice.WANDevice.*.WANConnectionDevice.*.WANPPPConnection.[ConnectionType:IP_Routed].Enable', {path: now, value: now}, {value: false});
}

function addBridgedInterface(wanDeviceInstance, connectionInstance, name, params) {
    let basePath = 'InternetGatewayDevice.WANDevice.' + wanDeviceInstance + '.WANConnectionDevice.' + connectionInstance + '.WANIPConnection';

    let defaults = {
        ConnectionType: 'IP_Bridged',
        Enable: true,
        Name: name
    };

    const vals = Object.assign({}, defaults, params);

    /*
     * Gets rid of all exising Bridged instances. If there are no actual changes at the end of this, then the instance
     * won't actually be deleted. This insures we don't have multiple IP_Bridged instances per
     * WANDevice/WANConnectionDevice.
     */
    declare(basePath + '.[ConnectionType:IP_Bridged]', null, {path: 0});

    log('Creating WANIPConnection instance ' + wanDeviceInstance + ' (if necessary)');

    const path = basePath + '.[' + Object.keys(vals).map((key) => { return key + ':' + vals[key]; }).join(',') + ']';
    log(`\r\n\r\nUpdating - ${path}`);

    declare(path, {value: now}, {path: 1}); //Ensures we have only 1 bridged connection
}

```

---

<div class="post-metadata">

**Author:** ![RIsset](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/risset/32/1075_2.png) [@RIsset](https://forum.genieacs.com/u/RIsset)\
**Post date:** [December 2, 2022, 12:47pm UTC](https://forum.genieacs.com/t/deleteobject-api-call-not-working/3261/3 "2022-12-02T12:47:52Z")

</div>

Thank you for the quick reply.

I will add the config, and I will take a look at the logs. I hope that will show why I can’t delete objects.  
Instead of enabling/disabling I simply wanted to remove any unneeded instances. Seeing as it is described in the documentation I figured that it would work.
