Atmosphere® API Authentication

To use Atmosphere® APIs, you first need to obtain a token. Follow the following steps to create a new user with API access and receive your token. Once you have obtained a token, it's used as the Bearer Authorization in your API requests.

Create a New User with API Access

  1. Log into the Customer Portal.
  2. From the menu at the left side of the page, click User Management.
  3. Click the Create New User/Contact button.

  1. On the User/Contact Details pop-up, fill in the Full Name, Email, and Phone.
  2. Click Create Login.
  3. Enter a unique name in the Username field and select API from the Access drop-down list.
  4. Click Save.

An email is automatically sent to the email address entered in step 4, with your username and password.

Retrieve Your Token

You can retrieve your token through the Atmosphere® Portal or the Customer Portal using the username and password created above.

Note: Tokens acquired through the Atmosphere® API are valid for 24 hours. Once the token expires, repeat the request to get a new token.

Atmosphere® Portal

Request

POST https://atmosphere.intelepeer.com/_rest/v4/authenticate

Content-Type: application/json

Copy
{

"username": "YOUR USERNAME",

"password": "YOUR PASSWORD"

}

Success Response

Successful authentication. Token returned in the body of the response.

Copy
Status: 200
{
"token":"fFkq..."
}

Related Errors

Copy
Status: 401
{
"code":401,
"error":"Unauthorized"
}

Customer Portal

Request

POST https://customer.intelepeer.com/_rest/v4/authenticate

Content-Type: application/json

Copy
{

"username": "YOUR USERNAME",

"password": "YOUR PASSWORD"

}

Success Response

Successful authentication. Token returned in the body of the response.

Copy
Status: 200
{
"token":"fFkq..."
}

Related Errors

Copy
Status: 401
{
"code":401,
"error":"Unauthorized"
}

 

Note: If you are unable to retrieve your token, confirm the user you created has been granted API access in the Customer Portal, and your username and password accuracy in the body of the request.

 

Code Examples

Example

Copy
package main.java.authorization;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

import org.apache.http.HttpHeaders;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.message.BasicNameValuePair;

public class GetToken {
    public static void main(String... args) throws Exception {
        final String url = "https://api.intelepeer.com/sms/v1/authenticate/get_portal_auth_token";
        final String USERNAME = "INSERT_USERNAME";
        final String PASSWORD = "INSERT_PASSWORD";

        HttpClient httpclient = HttpClientBuilder.create().build();
        HttpPost httpPost = new HttpPost(url);

        // add header
        httpPost.setHeader(HttpHeaders.CONTENT_TYPE, "application/json");

        // Data to be posted
        List urlParameters = new ArrayList();
        urlParameters.add(new BasicNameValuePair("username", USERNAME));
        urlParameters.add(new BasicNameValuePair("password", PASSWORD));

        // add data to post
        httpPost.setEntity(new UrlEncodedFormEntity(urlParameters));

        // execute post
        HttpResponse response = httpclient.execute(httpPost);

        // show post results
        System.out.println("nSending 'POST' request to URL : " + url);
        System.out.println("Post parameters : " + httpPost.getEntity());
        System.out.println("Response Code : " + 
                                    response.getStatusLine().getStatusCode());

        BufferedReader rd = new BufferedReader(
                        new InputStreamReader(response.getEntity().getContent()));

        StringBuffer result = new StringBuffer();
        String line = "";
        while ((line = rd.readLine()) != null) {
            result.append(line);
        }

        System.out.println(result.toString());
    }
}

Example

Copy
const request = require("request");
///////////////////////////////////////////////////////////////////////////////
/// update these accordingly                                                ///
///////////////////////////////////////////////////////////////////////////////
let data = { "username": "INSERT_USERNAME", "password": "INSERT_PASSWORD" }

///////////////////////////////////////////////////////////////////////////////
/// leave these alone                                                       ///
///////////////////////////////////////////////////////////////////////////////
let url  = "https://api.intelepeer.com/_rest/v4/app/sms/authenticate/get_portal_auth_token"
let hdrs = {  'Content-Type': "application/json" }

///////////////////////////////////////////////////////////////////////////////
/// execute the task and parse results                                      ///
///////////////////////////////////////////////////////////////////////////////
request.get({
        url: url,
        headers: hdrs
    },
    (error, response, body) => {                
        let result = JSON.parse(body);
        console.log(result.token);
});

Example

Copy
"INSERT_USERNAME", "password" => "INSERT_PASSWORD" ];

###############################################################################
### leave these alone                                                       ###
###############################################################################
$url  = "https://api.intelepeer.com/_rest/v4/app/sms/authenticate/get_portal_auth_token";
$hdrs = ['Content-Type' => "application/json" ];

###############################################################################
### execute the task and parse results                                      ###
###############################################################################

try{
  $client = new Client();
  $response = $client->post($url, [
    'headers' => $hdrs,
    'json' => $data
    ]);
}
catch (RequestException $e){
  echo "Request Failed:". $e->getMessage();
}

echo $response->getBody();
?>

Example

Copy
import requests

###############################################################################
### update these accordingly                                                ###
###############################################################################
data = { "username": "INSERT_USERNAME", "password": "INSERT_PASSWORD" }

###############################################################################
### leave these alone                                                       ###
###############################################################################
url  = "https://api.intelepeer.com/_rest/v4/app/sms/authenticate/get_portal_auth_token"
hdrs = {  'Content-Type': "application/json" }

###############################################################################
### execute the task and parse results                                      ###
###############################################################################
response    = requests.post(url, json=data, headers=hdrs)
status_code = response.status_code
text        = response.text
token = None
try:
    token = response.json().get(u'token')
except: pass

print u'{}: {}'.format('OK' if response else 'ERROR', response.text )