Reply
Highlighted
Accepted Solution

Create new network with extensible attribute using the WAPI

chinobita
Techie
Posts: 2
4617     0

I've tried to create a new network with setting the extensible attribute as follows.

 

curl -k -u admin:admin -X POST https://192.168.1.1/wapi/v1.4/network -d '{"network"="10.0.0.0/24","extattrs":{"Site":{"value":"Test"}}}'

 

It doesn't work. Any ideas??

 

Thanks

Re: Create new network with extensible attribute using the WAPI

GHorne Community Manager
Community Manager
Posts: 254
4618     0
What does the errormessage you get back from the API say?

Re: Create new network with extensible attribute using the WAPI

chinobita
Techie
Posts: 2
4618     0

I've got the following error message:

 

curl -k -u admin:admin -X POST https://192.168.1.1/wapi/v1.4/network -d '{"network":"10.0.0.0/24","extattrs":{"Site":{"value":"Test"}}}'

 

{ "Error": "AdmConProtoError: Unknown argument/field: '{\"network\":\"10.0.0.0/24\",\"extattrs\":{\"Site\":{\"value\":\"Test\"}}}'",
"code": "Client.Ibap.Proto",
"text": "Unknown argument/field: '{\"network\":\"10.0.0.0/24\",\"extattrs\":{\"Site\":{\"value\":\"Test\"}}}'"

 

The following command has worked fine if only a new network has been created:

 

curl -k -u admin:admin -X POST https://192.168.1.1/wapi/v1.4/network -d network=10.0.0.0/24

 

However, I wonder if we could create a new network with setting the extensible attributes at the same time.

 

Thanks!

 

 

Re: Create new network with extensible attribute using the WAPI

Adviser
Posts: 132
4618     0

@chinobita wrote:
 

curl -k -u admin:admin -X POST 'https://192.168.1.1/wapi/v1.4/network -d '{"network"="10.0.0.0/24","extattrs":{"Site":{"value":"Test"}}}'


Retry the command, replacing the '=' after 'network' with ':'

curl -k -u admin:admin -X POST 'https://192.168.1.1/wapi/v1.4/network -d '{"network":"10.0.0.0/24","extattrs":{"Site":{"value":"Test"}}}'

 

Field values submitted as part of a POST request are in the form of a JSON dictionary, which has the format '{"field1": value1, "field2": value2, ...}' where value1, value2, etc., may be strings, integer values, lists, or (as in the case of 'extattrs') another dictionary.

Re: Create new network with extensible attribute using the WAPI

yanamans
Techie
Posts: 1
4618     0

Hi,

 

I just tried with the following :

 

curl -k -u admin:admin -X POST https://infobloxaddress/wapi/v1.4/network -d '{"network":"10.10.10.0/24","extattrs":{"Location City":{"value":"Test"}}}'

 

But got the error.

 

{ "Error": "AdmConProtoError: Unknown argument/field: '{\"network\":\"10.10.10.0/24\",\"extattrs\":{\"Location City\":{\"value\":\"Test\"}}}'",
"code": "Client.Ibap.Proto",
"text": "Unknown argument/field: '{\"network\":\"7.40.32.0/19\",\"extattrs\":{\"Location City\":{\"value\":\"Test\"}}}'"

 

 

Could anyone help here.

 

Thank you

Re: Create new network with extensible attribute using the WAPI

Adviser
Posts: 75
4618     0

Hi,

 

Could you please add the header content-type and try again?

 

Sample call:

curl -k -u admin:infoblox -H 'content-type:application/json' -X POST https://grid-master/wapi/v1.4/network -d '{"network":"10.10.10.0/24","extattrs":{"Location City":{"value":"Test"}}}'

Regards,

Krishna Vasudevan

Showing results for 
Search instead for 
Do you mean 

Recommended for You