CCP - Receive error '400 Bad request' using curl command

CCP - Receive error '400 Bad request' using curl command

153
Created On 11/10/26 11:03 AM - Last Modified 11/10/26 15:52 PM


Symptom


Sample curl command in a lab environment:

curl -vk 'https://pvwa01.demo.local/AIMWebService/api/accounts?AppId=Test-App01&Query=Safe=Test Safe;Object=Operating System-CYBRUnixviaSSHAccounts-1.1.1.1-root02'


Using the curl command above on a client machine to retrieve the credentials resulted in the following error:

image.png



Environment


10.5;10.6;10.7;10.8;10.9;10.10;11.1;11;11.2;11.3;11.4;11.5;11.6;11.7;12.0

Central Credential Provider

Curl Command



Cause


'HTTP Error 400. The request is badly formed'


In this particular example, the error appeared due to a mistyped URL when issuing the curl command:

curl -vk 'https://pvwa01.demo.local/AIMWebService/api/accounts?AppId=Test-App01&Query=Safe=Test Safe;Object=Operating System-CYBRUnixviaSSHAccounts-1.1.1.1-root02'


There is a space between 'Test' and 'Safe' as well as 'Operating' and 'System' in the URL address of the curl command.



Resolution


A URL must not contain a literal space and it must be encoded (e.g. adding %20 to represent a space).


The following is an example to resolve HTTP error 400:

curl -vk 'https://pvwa01.demo.local/AIMWebService/api/accounts?AppId=Test-App01&Query=Safe=Test%20Safe;Object=Operating%20System-CYBRUnixviaSSHAccounts-1.1.1.1-root02'



Actions
  • Print
  • Copy Link

    https://knowledgebase.paloaltonetworks.com/KCSArticleDetail?id=kA1hj0000000pH8CAI&lang=en_US&refURL=http%3A%2F%2Fknowledgebase.paloaltonetworks.com%2FKCSArticleDetail