Reply

powershell + curl + put = failure

Techie
Posts: 7
2566     0

The following command line curl PUT fails::

 

.\curl.exe -u jblueSmiley Tongueassword -H 'Content-Type: application/json' -X PUT 'https://infoblox.example.com/wapi/v2.11.2/network/ZG5zLm5ldHdvcmskMTAuNDEuMzIuMC8yNC8w:10.41.32.0/24...' -d '{"extattrs+":{"City": {"value": "Denver"}}}'

 

with the following error:

 

{ "Error": "AdmConProtoError: JSON Decoding: Expecting property name: line 1 column 1 (char 1)",
"code": "Client.Ibap.Proto.JSONDecoding",
"text": "JSON Decoding: Expecting property name: line 1 column 1 (char 1)"
}

 

I have went over the syntax a million times and I cannot figure out what is wrong.  Thoughts?

Re: powershell + curl + put = failure

Techie
Posts: 7
2567     0

So I got this to work using native powershell:

 

$json = '{"extattrs+":{"City": {"value": "Denver"}}}'
invoke-restmethod -uri "https://infoblox.example.com/wapi/v2.11.2/network/ZG5zLm5ldHdvcmskMTAuNDEuMzIuMC8yNC8w:10.41.32.0/24..." -Headers @{ Authorization = "Basic "+ [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes("jblueSmiley Tongueassword")) } -Method Put -Body $json -ContentType 'application/json'

 

Still would like to figure out why curl fails ... 

Re: powershell + curl + put = failure

New Member
Posts: 8
2567     0

I have seen something similar before where the WAPI call is correct but if using any curl commands that has JSON data from Windows environment does not work. However, if the exact same WAPI call is used from Linux it works. The issue was related with curl/Windows.

 

To narrow this down, could check the following:

 

1. Check if WAPI calls that does not have JSON encoding i.e (-d '{key:value}' work. For example, does this command work from Windows cmd/PS?

 

curl -k -u user:pass -X GET https://1.2.3.4/wapi/v2.1/grid

2. Check to see if if WAPI calls that have JSON format in fail when used from Windows cmd/PS.

 

3. Run the exact same WAPI calls from a Linux terminal and check if it works.

Showing results for 
Search instead for 
Did you mean: 

Recommended for You