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
PIYUSH  KUMARPIYUSH KUMAR 

can I find subdomain through CallOut on the basic of Api key:-.

Basically I want to fetch out the subdomain of my end point 'https://app.chargify.com' using Api key. I am able to fetch out subdomins on the basic of user name and password but now want to fetch out on the basic of api key...
public class productFechOut {
    public static void basicAuthCallout(){
        HttpRequest req = new HttpRequest();
        String username = 'hPzrfBXboQVmTZ0v63Z';
        String password = '3Z';
        Blob headerValue = Blob.valueOf(username + ':' + password);
        String authorizationHeader = 'BASIC ' + EncodingUtil.base64Encode(headerValue);
        req.setHeader('Authorization', authorizationHeader);
        req.setHeader('Content-Type', 'application/json');
        req.setEndpoint('https://app.chargify.com');
        req.setMethod('GET');
        Http http = new Http();
        HTTPResponse res = http.send(req);
        System.debug('res123'+res.getBody());
    }
}