Skip to content
Apex library for HTTP callouts.
Branch: master
Clone or download
Pull request Compare This branch is 3 commits ahead, 5 commits behind Manzanit0:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Apex library for HTTP callouts.


You can use it with variety of request methods, authentication types or contexts.

Request methods

Library is able to execute GET, POST, PUT, PATCH, DELET, HEAD. POST example:

Object result = new HttpClientAura(
                new HttpClientProviderAuthProvider('SampleAuthProviderName'))
                        + '/v1/resource/baz/post'
                        , '{"fizz":"buzz"}');

Authentication types

Library supports several authentication schemes - AuthProvider, Named credentials, Cookie based authentication or basic username/password authentication, for example:

static Object postQuxByParams(String params){
                new HttpClientAura(
                        new HttpClientProviderBasic('admin', 'hunter2'))
                        + '/v2/qux/post',


Usage in Lightning server side controllers

Library provides basic catching of errors and reporting them via AuraHandledException that is readable on client side. Example call:

@AuraEnabled public static Object getFoo() {
               new HttpClientAura(
                       new HttpClientProviderNamedCredentials('SampleNamedCredential'))
                       + '/v3/resource/foo/get');

Usage elsewhere

new HttpClient(
        new HttpClientProviderAuthProvider('SampleAuthProviderName'))
        + '/v1/resource/foo/get');

Calling internal API's

final static String endpoint = '/services/data/';
final static String apiVersion = 'v43.0';
final static String query = '/tooling/query?q=';
final static String param = 'SELECT Description, EndpointUrl, FullName, IsActive, ManageableState, NamespacePrefix, ProtocolMismatch, SiteName, Metadata FROM RemoteProxy';
final static String sobjectApi = '/tooling/sobjects/RemoteProxy/';
@AuraEnabled public static Object Query(){
    HttpClientProviderSelf self = new HttpClientProviderSelf();
    return new HttpClientAura(self)
            .get(self.getBaseUrl() + endpoint + apiVersion + query + EncodingUtil.urlEncode(param, 'UTF-8'));

See more at

Deploy to Salesforce
You can’t perform that action at this time.