THE GAME HAS CHANGED

Introducing Infoblox Universal DDI ManagementTM

Watch the launch to discover the new era of management for critical network services. Watch Now

API & Integration, DevOps,NetOps,SecOps

Reply

delete IP address with REST API

New Member
Posts: 6
4994     0

I used the following link for references https://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/td-p/1214 and https://www.infoblox.com/wp-content/uploads/infoblox-deployment-infoblox-rest-api.pdf.

 

I tried to delete an existing IP address, but it does not work. The search IP address worked as expected.

 

curl -k -u admin:infoblox -X GET 'https://x.x.x.x/wapi/v2.9/search?address=172.0.2.6&_return_as_object=1'

{

    "result": [

        {

            "_ref": "record:host/ZG5zLmhvc3QkLm5vbl9ETlNfaG9zdF9yb290LjAuMTU3OTE5NTYwNjA1NC5oMTcyLTAtMi1hMQ:h172-0-2-a1/%20",

            "ipv4addrs": [

                {

                    "_ref": "record:host_ipv4addr/ZG5zLmhvc3RfYWRkcmVzcyQubm9uX0ROU19ob3N0X3Jvb3QuMC4xNTc5MTk1NjA2MDU0LmgxNzItMC0yLWExLjE3Mi4wLjIuNi4:172.0.2.6/h172-0-2-a1/%20",

                    "configure_for_dhcp": false,

                    "host": "h172-0-2-a1",

                    "ipv4addr": "172.0.2.6"

                }

            ],

            "name": "h172-0-2-a1",

            "view": " "

        },

        {

            "_ref": "network/ZG5zLm5ldHdvcmskMTcyLjAuMi4wLzI0LzA:172.0.2.0/24/default",

            "network": "172.0.2.0/24",

            "network_view": "default"

        }

    ]

}

 

 

curl -k -u admin:Infoblox -H 'content-type: application/json' -X DELETE "https://x.x.x.x/wapi/v2.9/record:host/ZG5zLmhvc3QkLm5vbl9ETlNfaG9zdF9yb290LjAuMTU3OTE5NTYwNjA1NC5oMT..."
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>401 Authorization Required</title>
</head><body>
<h1>Authorization Required</h1>
<p>This server could not verify that you
are authorized to access the document
requested. Either you supplied the wrong
credentials (e.g., bad password), or your
browser doesn't understand how to supply
the credentials required.</p>
</body></html>

 

also trying the following but no success:

 

curl -k -u admin:infoblox -H 'content-type: application/json' -X DELETE ‘http://x.x.x.x/wapi/v2.9/ipv4addr/ZG5zLmhvc3RfYWRkcmVzcyQubm9uX0ROU19ob3N0X3Jvb3QuMC4xNTc5MTk1NjA2MD...
[1] 28011
curl: (1) Protocol "‘http" not supported or disabled in libcurl

 

Re: delete IP address with REST API

Moderator
Moderator
Posts: 321
4994     0

In the search you are using a lowecase "infoblox" for the password but in the first delete example you are using a capitalized "Infoblox" for the password.  The password is case-sensitive.  Can you double-check?

 

In the second example, the URL must be https, it will not work with unencrpyted http.  Can you try it with https?

 

Re: delete IP address with REST API

New Member
Posts: 6
4994     0
I tried two different tags, but still has errors.


curl -k -u admin:infoblox -X GET 'https://x.x.x.x/wapi/v2.9/search?address=172.0.2.6&_return_as_object=1'
{
"result": [
{
"_ref": "record:host/ZG5zLmhvc3QkLm5vbl9ETlNfaG9zdF9yb290LjAuMTU3OTE5NTYwNjA1NC5oMTcyLTAtMi1hMQ:h172-0-2-a1/%20",
"ipv4addrs": [
{
"_ref": "record:host_ipv4addr/ZG5zLmhvc3RfYWRkcmVzcyQubm9uX0ROU19ob3N0X3Jvb3QuMC4xNTc5MTk1NjA2MDU0LmgxNzItMC0yLWExLjE3Mi4wLjIuNi4:172.0.2.6/h172-0-2-a1/%20",
"configure_for_dhcp": false,
"host": "h172-0-2-a1",
"ipv4addr": "172.0.2.6"
}
],
"name": "h172-0-2-a1",
"view": " "
},
{
"_ref": "network/ZG5zLm5ldHdvcmskMTcyLjAuMi4wLzI0LzA:172.0.2.0/24/default",
"network": "172.0.2.0/24",
"network_view": "default"
}
]
}



curl -k -u admin:infoblox -H 'content-type: application/json' -X DELETE "https://198.235.67.202/wapi/v2.9/ipv4addr/ZG5zLmhvc3RfYWRkcmVzcyQubm9uX0ROU19ob3N0X3Jvb3QuMC4xNTc5MT..."
{ "Error": "AdmConProtoError: Unknown object type (ipv4addr)",
"code": "Client.Ibap.Proto",
"text": "Unknown object type (ipv4addr)"


curl -k -u admin:infoblox -H 'content-type: application/json' -X DELETE "https://198.235.67.02/wapi/v2.9/record:host_ipv4addr/ZG5zLmhvc3RfYWRkcmVzcyQubm9uX0ROU19ob3N0X3Jvb3Q..."
{ "Error": "AdmConProtoError: Operation delete not allowed for record:host_ipv4addr",
"code": "Client.Ibap.Proto",
"text": "Operation delete not allowed for record:host_ipv4addr"

Re: delete IP address with REST API

New Member
Posts: 6
4995     0

The correct tag should be the record:host.

 

 

 

 

Showing results for 
Search instead for 
Did you mean: 

Recommended for You