function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
User UsersUser Users 

session invalid while using rest api

Hello,  I get INVALID_SESSION_ID error when I am trying to use https://ap2.salesforce.com/services/data/v37.0/sobjects/ url on browser to get list of objects.
Amit Singh 1Amit Singh 1
Hello, you can not use https://ap2.salesforce.com/services/data/v37.0/sobjects/ directly from the browser for fetching the list of objects. You need to write apex code for fetching all the list of Objects(Standard/Custom).

If you want to get a list of all the objects then visit the below link.
https://developer.salesforce.com/page/Creating_REST_APIs_using_Apex_REST
https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_what_is_rest_api.htm

Let me know if this resolves the issue :)

Thanks,
Amit
User UsersUser Users
Is there any rest url from which I get list of object?
Amit Singh 1Amit Singh 1
Hello,

No, You can not directly access any Salesforce API url without authentication. If you want to achieve it then you can do this by creating a force.com site .

For more info refer the below link.
http://www.wadewegner.com/2013/03/creating-anonymous-rest-apis-with-salesforce-com/

Thanks,
Amit
User UsersUser Users
when I am using  curl https://ap2.salesforce.com/services/data/v34.0 -H "Authorization: Bearer token" command, then it will give session expire or invalid.
How can I resolve this?