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
rishi jaykar 1rishi jaykar 1 

what is "Authorization: Bearer ***token*** "X-PrettyPrint:1" in curl -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? 
Prafull G.Prafull G.
If you want to use this from controller class then you need to make use of Http classes. 

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
Bearer is a type of OAuth token returned by your Authorization call.

This is how you have to consume it in a Callout service.
public class clsHTTPCalloutService {
	//If you dont have an input JSON, you can skip the argument 1
    public static String Callout(String sInputJson, String sToken) {
        String returnValue = '';
        try {
            Http http = new Http();
            HttpRequest request = new HttpRequest();
            request.setEndpoint('');  //Your URI
            request.setHeader('Authorization', 'Bearer ' + sToken);
			//if the request and response for your REST call is JSON, use the code below.
            request.setHeader('Content-Type', 'application/json'); 
            request.setHeader('accept', 'application/json');
			HttpResponse response = http.send(request);

            // Parse the JSON response          
            if (response.getStatusCode() != 200) { //Make sure about the Status code with Dev team
                System.debug('The status code returned was not expected: ' +
                             response.getStatusCode() + ' ' + response.getStatus());
                returnValue = 'ERROR';
            else {
                returnValue = response.getBody();
            return returnValue;
        catch(System.CalloutException e) {
            return null;
If you do not have JSON input or output, you can skip the related code pieces.

Let me know if this helps.
rishi jaykar 1rishi jaykar 1
firstly i want to get the result from -H "Authorization: Bearer ***token*** "X-PrettyPrint:1"  but the problem with this curl what is "Authorization: Bearer ***token*** "X-PrettyPrint:1"
(go through link) this format 
rishi jaykar 1rishi jaykar 1
Hii @LBK
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.

And, various headers available in Request class.

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.