- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
powershell + curl + put = failure
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-25-2021 07:50 PM
The following command line curl PUT fails::
.\curl.exe -u jblueassword -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
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-25-2021 08:47 PM
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("jblueassword")) } -Method Put -Body $json -ContentType 'application/json'
Still would like to figure out why curl fails ...
Re: powershell + curl + put = failure
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2021 01:53 PM
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.