Authentication

iNode offers two authentication methods, OAuth2 and API key.

OAuth2 #

Please contact our support team to get your client_id and client_secret for your oauth2 application that is linked to you account.

You can use your company owner user account username and password with the combination of client_id and client_secret to retrieve an access token.

Examples #

cURL #
curl --location --request POST 'https://inode.smatstraffic.com/api/oauth/token/' \
 --header 'Content-Type: application/x-www-form-urlencoded' \
 --data-urlencode 'grant_type=password' \
 --data-urlencode 'username=<username>' \
 --data-urlencode 'password=<password>' \
 --data-urlencode 'client_secret=<client secret>' \
 --data-urlencode 'client_id=<client id>' \
 --data-urlencode 'scope=sync'
Python #
auth_body = {
     'grant_type': 'password',
     'username': USERNAME,
     'password': PASSWORD,
     'client_id': CLIENT_ID,
     'client_secret': CLIENT_SECRET,
     'scope': 'sync'
 }
# content-type must be application/x-www-form-urlencoded
auth_response = requests.post("https://inode.smatstraffic.com/api/oauth/token/", data=auth_body)
auth_response_json = auth_response.json()
access_token = auth_response_json['access_token']
refresh_token = auth_response_json['refresh_token']

API Key #

The easiest way to get access to the iNode API is using the API Key that you can retrieve from the iNode dashboard. Go to the Settings > My Profile > API Access and copy the API key.

Note: only iNode users with the role of Owner can retrieve the API Access from the iNode dashboard.

After you retrieve the API Token from the API Access page, you need to include the token in the “Authorization” header of your request that you send to the iNode API.

Examples #

The examples below are making a get request to the iNode v1 endpoint for retrieving the links.

cURL #

curl 'https://inode.smatstraffic.com/api/v1/links/' -H 'Authorization: Token xxxxxxxxxxxxxxxxxxxxxxxx'

Python #

import requests
headers = {
    'Authorization': 'Token xxxxxxxxxxxxxxxxxxxxxxxxxxx'
}

response = requests.get('https://inode.smatstraffic.com/api/v1/links/', headers=headers)

PHP #

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://inode.smatstraffic.com/api/v1/links/');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');

$headers = array();
$headers[] = 'Authorization: Token xxxxxxxxxxxxxxxxxxxxxxxx';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);
if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
}
curl_close($ch);

GO #

req, err := http.NewRequest("GET", "https://inode.smatstraffic.com/api/v1/links/", nil)
if err != nil {
    // handle err
}
req.Header.Set("Authorization", "Token xxxxxxxxxxxxxxxxxxxxxxxx")
resp, err := http.DefaultClient.Do(req)
if err != nil {
    // handle err
}
defer resp.Body.Close()