kushan.kjk kushan.kjk - 28 days ago 8
Linux Question

curl authentication failed in rest api

I'm currently trying to authenticate REST api using curl request.
but it gives error http 400 bad request for my curl request.

This is the curl request i'm used

curl -k -v -X POST -H "Content-Type: application/json" --data-binary @auth.txt https://example.com/vedsdk/Authorize/


auth.txt file contain credential for rest api.

auth.txt file contain

{
"Username":"Api_Acconut",
"Password":"8+\Kt\P;Z"
}


This Api_Account is a local account for REST Api platform.

Can anyone tell me where I'm wrong in this..

Answer

Found out the solution. add another back slash (\) in password

{ "Username":"Api_Acconut", "Password":"8+\\Kt\\P;Z" }