Colony

TRITECH MEDIA

COLONY REST API

OAuth 2.0 Authentication

Colony uses OAuth 2.0 as it's authentication mechanism in order to interact with the API. Below is an outline on how to get your OAuth credentials in order to make calls to the API.

1. Create a client

Firstly you need to create a client that users can give access to, if you do not alreay have a client you can create one here. There you will be able to get your API Key and Secret.

2. Request an access token

To request an access token, submit a POST request to the url https://api.colonyhq.com/oauth2/access_token/ with the following fields:

client_id
The client API Key you've just configured at the previous step.
client_secret
The client API Secret configured at the previous step.
username
The username with which you want to log in.
password
Well, that speaks for itself.

You can use the command line to test that your local configuration is working:

curl -X POST -d "client_id=<your-client-id>&client_secret=<your-client-secret>&grant_type=password&username=<your-username>&password=<your-password>" https://api.colonyhq.com/oauth2/access_token/

You should get a response that looks something like this:

{
    "access_token": "<your-access-token>",
    "scope": "read",
    "expires_in": 86399,
    "refresh_token": "<your-refresh-token>"
}

3. Access the API

The command line to test the authentication looks like:

curl -H "Authorization: Bearer <your-access-token>" https://api.colonyhq.com/collate/campaigns/

That should return a list of all the campaigns you have access to.