Forum Discussion
vaishnavi I think you misread my URL or mistyped/miscopied yours?
vaishnavi if you want the response in JSON, you usually have to add:
?restapi.response_format=json
Have a go and let us know.
- vaishnavi10 years agoExpert
ayshe - oops, you are right. I tried with incorrect URL.
I corrected the URL and tried POST calls (with required headers and parameters) and response type mentioned in OlivierS comment.
1. URL : https://api.lithium.com
response : 500 Internal server error
2. URL : https://api.stage.lithium.com
response : 500 Internal server error
I am not sure why I am getting error in response.
- fuenteso10 years agoLeader
Did you ever find out how to make the call? I'm having the same issue and it is so frustrating :(
- vaishnavi10 years agoExpert
Hi fuenteso,
Please find calls below :-
1. URL hit >>
[comunity_base_url_with_http_or_https]/auth/oauth2/authorize?client_id=[url_encoded_client_id]&response_type=code&redirect_uri=[comunity_base_url_without_http]
response >> gets redirected to a URL where 'code', 'user-id', 'tenent-id' are returned as parameters
http://[comunity_base_url_without_http]/t5/oauth/[comunity_base_url_without_http]?code=actual_code_here&user-id=user_id_here&tenant-id=tenant_id_here2. POST >> accessToken
https://api.stage.lithium.com/auth/v1/accessToken
headers >>
client_id : [url_docoded_format_your_client_id], content-type : application/jsoncontent to send >>
{
"code" : "[url_docoded_format_your_code]",
"client_id" : "[url_docoded_format_your_client_id]",
"client_secret" : "[url_docoded_format_your_client_secret]",
"redirect_uri" : "[comunity_base_url_without_http]",
"grant_type" : "authorization_code"
}{"response":{"httpCode":200,"message":"OK","status":"success","data":{"lithiumUserId":"actual_alphanumeric_id","userId":"actual_interger_id","access_token":"actual_access_token","expires_in":86400,"refresh_token":"actual_refresh_token","token_type":"bearer"}}}
Please let me know if you need any more details.
Thanks,
Vaishnavi