You need to sign in to do that
Don't have an account?
rishi jaykar 1
what is "Authorization: Bearer ***token*** "X-PrettyPrint:1" in curl https://instance.salesforce.com/services/data/v37.0/limits/ -H "Authorization: Bearer ***token*** "X-PrettyPrint:1"
how to use this curl in my class and return JSON result store in array or list in my controller class?
All Salesforce resources are protected and in order to use those we need to authenticate first and then use access_token. Please refer below link for more details
https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_understanding_authentication.htm
This is how you have to consume it in a Callout service.
If you do not have JSON input or output, you can skip the related code pieces.
Let me know if this helps.
Like: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_limits.htm
(go through link) this format
its really helpful but the problem is there, what is Authorization ,Bearer ,sToken and X-PrettyPrint:1 in these 2 line request.setHeader('Authorization', 'Bearer ' + sToken); request.setHeader("X-PrettyPrint:1");
You need to read some materials on HTTPRequest and Response classes. Try the URL below.
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_restful_http_httprequest.htm
And, various headers available in Request class.
https://en.wikipedia.org/wiki/List_of_HTTP_header_fields
This is a good place to start. There are more information available on OAuth2.0, and various types of responses you get from that.
Google is your friend in need.