Calling an PingAccess APIs from Powershell

339 Views Asked by At

I am trying to call PingAccess APIs to configure my PingAccess. I am new to using APIs to do this, and have a question.

I am trying to use CURL to the API .

curl -k -u Administrator:dummypsswd -H "X-Xsrf-Header: PingAccess" -H "Content-Type: application/json" -d '{"alias":"PLACEHOLDER_STAR_MINGLE","fileData": [[System.IO.File]::ReadAllBytes("C:\test.pfx")],"password": "1234"}' https://localhost:9000/pa-admin-api/v1/keyPairs/import -v

When I run this I get the following error.

Error On Powershell

I still dont know why am I unauthorized. Any help is appreciated.

1

There are 1 best solutions below

0
Hans Z. On

When you have special characters in your password you'll need to enclose the username/password tuple in double quotes:

curl -k -u "Administrator:dummypsswdwithspecialcharslike&&" -H "X-Xsrf-Header: PingAccess" -H "Content-Type: application/json" -d '{"alias":"PLACEHOLDER_STAR_MINGLE","fileData": [[System.IO.File]::ReadAllBytes("C:\test.pfx")],"password": "1234"}' https://localhost:9000/pa-admin-api/v1/keyPairs/import -v