Authentication

All access to Invisible Collector’s API is secured and requires authorization. As such we require Bearer Authentication (also called token authentication). This works by forcing all requests to include a token called bearer token which can be understood as saying “allow access to this resource to the user holding this token”.

You can read more about this type of authentication and other authorization schemes here.

The bearer token is a cryptographically secure key generated by Invisible Collector which looks something like the following:

4c5cb3d718ca898f1afefadfb722ea1f6871bd909c759508153fe0da2ce3f657

This token allows us to associate a request with an account.

Within the Invisible Collector system the token is linked to the company itself.

You can check what API Token a company has by navigating to the company’s settings page.

Below is an example of a request:

curl -XGET \
  --header "Content-Type: application/json" \
  --header "Authorization: Bearer 56a73507b66cd761caae7547ef2a66fc3a393746ba4bb9a91e303fcb3ceefb98" \
  https://api.invisiblecollector.com/companies
require 'invisible_collector'

# Be sure to replace the token with your own.
client = InvisibleCollector::API.new(api_token: '56a73507b66cd761caae7547ef2a66fc3a393746ba4bb9a91e303fcb3ceefb98')
# fetch your company information
client.company.get()
import com.ic.invisiblecollector.IcApiFacade;

// Be sure to replace the token with your own
// This will be used in the following examples
IcApiFacade apiFacade = new IcApiFacade("56a73507b66cd761caae7547ef2a66fc3a393746ba4bb9a91e303fcb3ceefb98");

// get company info example
Company company = apiFacade.requestCompanyInfo();

using InvisibleCollectorLib;
using InvisibleCollectorLib.Model;

// Be sure to replace the token with your own
var ic = new InvisibleCollector("56a73507b66cd761caae7547ef2a66fc3a393746ba4bb9a91e303fcb3ceefb98");

// get company info example
Company company = await ic.GetCompanyInfoAsync();

import "github.com/invisiblecloud/invisible-collector-go/ic"

iC, err := ic.NewInvisibleCollector("56a73507b66cd761caae7547ef2a66fc3a393746ba4bb9a91e303fcb3ceefb98", ic.InvisibleCollectorUri)
if err != nil {
  panic(err)
}

// make a request
var channel = make(chan ic.CompanyPair)
go iC.GetCompany(channel)
p := <-channel

// check no errors occurred
if p.Error != nil {
  panic(p.Error)
}

// do stuff with returned model
fmt.Println(p.Company)
// in the following go examples, no error checking is done as it is done here