website logo
⌘K
Introduction
Authentication
API Reference (Swagger)
API Reference
Campaigns
Contact
Media
Testimonial
Websites
Widgets
Webhooks
Docs powered by archbee 

Authentication

Header

To authenticate, add an Authorization header to your API request that contains an API Key (see below). We are using Basic authentication so you need to construct the credentials first combining any string as first value and the password (your api key) with a colon. Then encode the string base64.

API Key

An API Key can be generated in your Trust account.

Example

C#
|
 private void GetAuthenticationHeader(HttpClient client)
{
    var byteArray = Encoding.ASCII.GetBytes("dummy" + ":" + _apiKey);
    client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
}

JS
|
let  http = require('http');
const host = "https://api.usetrust.app/v1/testimonial/all/c2cd39b7-239c-4455-a4e6-aa5879a1e858";

let request = http.request({'hostname': host',
                            'auth': 'dummy:' + apiKey
                           }, 
                           function (response) {
                             console.log('STATUS: ' + response.statusCode);
                             console.log('HEADERS: ' + JSON.stringify(response.headers));
                             response.setEncoding('utf8');
                             response.on('data', function (chunk) {
                               console.log('BODY: ' + chunk);
                             });
                           });
request.end();

JS
|
let request = require('request');
const username = "dummy";
const password = apiKey;
const auth = "Basic " + new Buffer(username + ":" + password).toString("base64");
const url = "https://api.usetrust.app/v1/testimonial/all/c2cd39b7-239c-4455-a4e6-aa5879a1e858";

request.get( {
    url : url,
    headers : {
        "Authorization" : auth
    }
  }, function(error, response, body) {
      console.log('body : ', body);
  } );




Updated 03 Mar 2023
Did this page help you?
Yes
No
PREVIOUS
Introduction
NEXT
API Reference (Swagger)
Docs powered by archbee 
TABLE OF CONTENTS
Header
API Key
Example