Another Salesforce blog!!!

Salesforce, Apex

HTTP POST to the URL (Login) – Web API 2


How to do User Login into Web Api 2Do a HTTP POST to the URL

[cc]http://localhost/token[/cc]

with the HTTP HEADER

[cc]
content-type: application/x-www-form-urlencoded
[/cc]

HTTP BODY

[cc]
username=john&password=secret&grant_type=password
[/cc]

You should get HTTP RESPONSE 200 and return data as

[cc]
{
“access_token”:”zt3Ma_gzOxRi53YgCciMe1H1j6Uss………..”,
“token_type”:”bearer”,
“expires_in”:1209599,
“userName”:”john”,
“.issued”:”Tue, 17 Jan 2014 17:58:05 GMT”,
“.expires”:”Tue, 31 Jan 2014 17:58:05 GMT”
}
[/cc]

Leave a Reply

Your email address will not be published. Required fields are marked *

*