You need to sign in to do that
Don't have an account?
venkateshp
Apex Rest service testing
i have salesforce insatnce url like https://[instance].salesforce.com/ and authorization token
I am trying to get the resposnse using the following url from Apex rest api like below
https://[instance].salesforce.com/services/apexrest/[namespace]/[url mapping]?Authorization = OAuth [OAuth token]
if i posted above url in the browser[mozilla] i am getting following error message
INVALID_SESSION_ID
Session expired or invalid
Where i did mistake?
Your oauth token needs to be sent in the Authorization HTTP header.
Thank you simon,
I need information on couple of things
1. if i am trying to connect from mobile application(like android or iphone), i need to authorize and get the token for every time when i am sending request to force.com application. Is there any time validuty constraint on the oauth token or
if i get once token i can use it for any time?
2. with apex rest can i porvide different services, which can be consumed by mobile applications. Is there any limitations on number of requests(Api calls) for force.com .
Thanks in advance
Regards,
venkatesh
1. Once the user have approved the app via oauth, you are left with 2 tokens, a refresh_token which is long lived, and an access_token which expires on inactivity. you use the refresh_token to get new access tokens without going through the authorization process again.
2. Yes, there are total & concurrent API request limits, the exact number depend on what edition & number of licenses you have, see the API docs for the details.
Hi simon,
I tries to get refresh_token with the following post url
https://[instance]/services/oauth2/token?grant_type=refresh_token&client_id=[client-id]&client_secret=[client-secrete]&refresh_token=[access-token]
I am getting error like below
<?xml version="1.0" encoding="UTF-8"?><OAuth><error>invalid_grant</error><error_description>expired access/refresh token</error_description></OAuth>
Where is the mistake?
Thanks in advance,
venkatesh.
if the client calling apexrest service like below
https://[instance].salesforce.com/services/apexrest/[restresource]?param=[value]¶m1=[value]¶m2=[value]es
how can i get the parameters from url into rest resource [any URL methods supports this one].
thank you,
venkatesh.