I am trying to POST a data to receive an input using powershell but it's throwing error. Url: https://www.example.com/api/login
JSON data = {"username": "emailid", "password": "password"}
Once the post is successful, i will receive an output in JSON format something like:
{"account": "some-guid", "Token": "xxx", "selflink": "https://www.example.com/api/me", "username": "emailid"}
When I am posting the JSON data, I'm getting syntax error.
I'm using the below code to invoke
$url = "https://somedomain.com/api/login"
$params = @{"username"="abcd@pqr.com";
"password"="123456";
}
$response = Invoke-WebRequest -Uri $url -Method POST -Body $params -ContentType "application/json"