TPOA API

The TPOA (Transmission Path Originating Address) API is used to deal with TPOA entries (i.e. “SMS Sender aliases”) of the user.

Remember to provide the authentication HTTP headers as described in the Authenticate using a session key and the Authenticate using a user tokeny sections.
All the query string parameters in URL must be UTF-8 URL Encoded.

Create a new alias

Creates a new TPOA Alias.

HTTP Headers

user_key / Session_key

HTTP Method

POST

HTTP Request

https://app.gateway.smsend.it/API/v1.0/REST/alias

Body Fields

The body must contain a Json with a JsonObject field named alias that contains all the alias info:

Parameter Type Description Required Default
alias String The sender that will be shown on SMS Yes
company-name String The name of company associated to this alias Yes
contact-name String The name of physical person rappresenting the company Yes
contact-surname String The surname of physical person rappresenting the company Yes
cod-fiscale String The fiscal code of company Yes
vat-number String The vat number of company Yes
contact-address String The address of company Yes
contact-city String The city of company Yes
contact-pcode String The ZIP/Postal-code/CAP code of company Yes
contact-type String enum(SERVICE_PHONE, MAIN_PHONE, FAX, EMAIL, PEC, WEB) The type of contact referred to contact-info Yes
contact-info String The value of contact Yes

Returns

Code Description
200 Successful request
400 Other errors, details are in the body
401 [Unauthorized] User_key, Token or Session_key are invalid or not provided
404 [Not found] The User_key was not found
Copy code
# Session Key example
curl -XPOST 'https://app.gateway.smsend.it/API/v1.0/REST/alias' -H 'Content-Type: application/json' \
-H 'user_key: {USER_KEY}' -H 'Session_key: {SESSION_KEY}' -d'
{
    "alias": {
        "alias": "MY ALIAS", 
        "company-name": "company name", 
        "contact-name": "name", 
        "contact-surname": "surname", 
        "cod-fiscale": "02367940224", 
        "vat-number": "02367940224", 
        "contact-address": "address", 
        "contact-city": "city", 
        "contact-pcode": "pcode", 
        "contact-type": "WEB", 
        "contact-info": "www.www.it"
    }
}
'

# Access token example
curl -XPOST 'https://app.gateway.smsend.it/API/v1.0/REST/alias' -H 'Content-Type: application/json' \
 -H 'user_key: {USER_KEY}' -H 'Access_token: {ACCESS_TOKEN}' -d'
{
    "alias": {
        "alias": "MY ALIAS", 
        "company-name": "company name", 
        "contact-name": "name", 
        "contact-surname": "surname", 
        "cod-fiscale": "02367940224", 
        "vat-number": "02367940224", 
        "contact-address": "address", 
        "contact-city": "city", 
        "contact-pcode": "pcode", 
        "contact-type": "WEB", 
        "contact-info": "www.www.it"
    }
}
'
On success, the above command returns the following response, plus the HTTP Location header pointing to the created alias
{
  "result": "OK"
}
If getAlias is true instead, the following is returned:
{
    "result": "OK",
    "string": "MY ALIAS"
}
Copy code
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.io.OutputStream;
import java.net.URL;

public class Main {
    public static void main(String[] args) {
        try {
            URL url = new URL("https://app.gateway.smsend.it/API/v1.0/REST/alias");
            HttpURLConnection conn = (HttpURLConnection) url.openConnection();

            conn.setRequestProperty("user_key", "{USER_KEY}");

            // Use this when using Session Key authentication
            conn.setRequestProperty("Session_key", "{SESSION_KEY}");                  
            // When using Access Token authentication, use this instead:
            // conn.setRequestProperty("Access_token", "{ACCESS_TOKEN}");

            conn.setRequestMethod("POST");

            conn.setRequestProperty("Accept", "application/json");
            conn.setRequestProperty("Content-type", "application/json");
            conn.setDoOutput(true);

            String payload = "{" + 
              "    \"alias\": {" + 
              "        \"alias\": \"MY ALIAS\", " + 
              "        \"company-name\": \"company name\", " + 
              "        \"contact-name\": \"name\", " + 
              "        \"contact-surname\": \"surname\", " + 
              "        \"cod-fiscale\": \"02367940224\", " + 
              "        \"vat-number\": \"02367940224\", " + 
              "        \"contact-address\": \"address\", " + 
              "        \"contact-city\": \"city\", " + 
              "        \"contact-pcode\": \"pcode\", " + 
              "        \"contact-type\": \"WEB\", " + 
              "        \"contact-info\": \"www.www.it\"" + 
              "    }" + 
              "}";

            OutputStream os = conn.getOutputStream();
            os.write(payload.getBytes());
            os.flush();

            if (conn.getResponseCode() != 200) {
                throw new RuntimeException("Failed : HTTP error code : "
                                           + conn.getResponseCode());
            }
            BufferedReader br =
                new BufferedReader(new InputStreamReader(conn.getInputStream()));

            String response = "";
            String output;
            while ((output = br.readLine()) != null) {
                response += output;
            }
            // You can parse the response using Google GSON or similar.
            // MyObject should be a class that reflect the JSON 
            // structure of the response

            GsonBuilder builder = new GsonBuilder();
            Gson gson = builder.create();
            MyObject responseObj = gson.fromJson(response, MyObject.class);
            conn.disconnect();
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }
}
On success, the above command returns the following response, plus the HTTP Location header pointing to the created alias
{
  "result": "OK"
}
If getAlias is true instead, the following is returned:
{
    "result": "OK",
    "string": "MY ALIAS"
}
Copy code
<?php

$payload = '{' . 
  '    "alias": {' . 
  '        "alias": "MY ALIAS", ' . 
  '        "company-name": "company name", ' . 
  '        "contact-name": "name", ' . 
  '        "contact-surname": "surname", ' . 
  '        "cod-fiscale": "02367940224", ' . 
  '        "vat-number": "02367940224", ' . 
  '        "contact-address": "address", ' . 
  '        "contact-city": "city", ' . 
  '        "contact-pcode": "pcode", ' . 
  '        "contact-type": "WEB", ' . 
  '        "contact-info": "www.www.it"' . 
  '    }' . 
  '}';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://app.gateway.smsend.it/API/v1.0/REST/alias');
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'Content-type: application/json',
    'user_key: {USER_KEY}',
    // Use this when using session key authentication
    'Session_key: {SESSION_KEY}',
    // When using Access Token authentication, use this instead:
    // 'Access_token: {ACCESS_TOKEN}'
));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
$response = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);

if ($info['http_code'] != 200) {
    echo('Error!');
}
else {

    $obj = json_decode($response);
    print_r($obj);
}
?>
On success, the above command returns the following response, plus the HTTP Location header pointing to the created alias
{
  "result": "OK"
}
If getAlias is true instead, the following is returned:
{
    "result": "OK",
    "string": "MY ALIAS"
}
Copy code
# pip install requests
import requests
import json
# Use this when using Session Key authentication
headers = { 'user_key': '{USER_KEY}', 'Session_key' : '{SESSION_KEY}', 'Content-type' : 'application/json' }
# When using Access Token authentication, use this instead:
# headers = { 'user_key': '{USER_KEY}', 'Access_token' : '{ACCESS_TOKEN}', 'Content-type' : 'application/json' }
payload = """{
    "alias": {
        "alias": "MY ALIAS", 
        "company-name": "company name", 
        "contact-name": "name", 
        "contact-surname": "surname", 
        "cod-fiscale": "02367940224", 
        "vat-number": "02367940224", 
        "contact-address": "address", 
        "contact-city": "city", 
        "contact-pcode": "pcode", 
        "contact-type": "WEB", 
        "contact-info": "www.www.it"
    }
}"""

r = requests.post("https://app.gateway.smsend.it/API/v1.0/REST/alias", headers=headers, data=payload)

if r.status_code != 200:
    print("An error occurred, return code is: " + str(r.status_code))
else:
    response = r.text

    obj = json.loads(response)
    print(unicode(obj))
On success, the above command returns the following response, plus the HTTP Location header pointing to the created alias
{
  "result": "OK"
}
If getAlias is true instead, the following is returned:
{
    "result": "OK",
    "string": "MY ALIAS"
}
Copy code
// Uses https://github.com/request/request
// npm install [-g] request

var request = require('request');

request({
    url: 'https://app.gateway.smsend.it/API/v1.0/REST/alias',
    method: 'POST',
    headers: { 'user_key' : '{USER_KEY}', 'Session_key' : '{SESSION_KEY}' },

    json: true,
    body:     {
        "alias": {
            "alias": "MY ALIAS", 
            "company-name": "company name", 
            "contact-name": "name", 
            "contact-surname": "surname", 
            "cod-fiscale": "02367940224", 
            "vat-number": "02367940224", 
            "contact-address": "address", 
            "contact-city": "city", 
            "contact-pcode": "pcode", 
            "contact-type": "WEB", 
            "contact-info": "www.www.it"
        }
    },

    callback: function (error, responseMeta, response) {
        if (!error && responseMeta.statusCode == 200) {

        }
        else {
            console.log('An error occurred..');
        }
    }
});
On success, the above command returns the following response, plus the HTTP Location header pointing to the created alias
{
  "result": "OK"
}
If getAlias is true instead, the following is returned:
{
    "result": "OK",
    "string": "MY ALIAS"
}
Copy code
require 'net/http'
require 'uri'
require 'json'

uri = URI.parse("https://app.gateway.smsend.it/API/v1.0/REST/alias")
payload =     {
        "alias": {
            "alias": "MY ALIAS", 
            "company-name": "company name", 
            "contact-name": "name", 
            "contact-surname": "surname", 
            "cod-fiscale": "02367940224", 
            "vat-number": "02367940224", 
            "contact-address": "address", 
            "contact-city": "city", 
            "contact-pcode": "pcode", 
            "contact-type": "WEB", 
            "contact-info": "www.www.it"
        }
    }

# Create the HTTP objects
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Post.new(uri.request_uri)
request['Content-type'] = 'application/json'
request['user_key'] = '{USER_KEY}'
request['Session_key'] = '{SESSION_KEY}'
request.body = payload.to_json

# Send the request
responseData = http.request(request)
if responseData.code == "200"
  response = responseData.body

  obj = JSON.parse(response)
  puts obj
else
  puts "Error.."
end
On success, the above command returns the following response, plus the HTTP Location header pointing to the created alias
{
  "result": "OK"
}
If getAlias is true instead, the following is returned:
{
    "result": "OK",
    "string": "MY ALIAS"
}
Copy code
using System;
using System.Text;
using System.Net;
using System.Collections.Specialized;

// We are using JSON.NET (http://www.newtonsoft.com/json)
using Newtonsoft.Json;

/*
 * The following code has been compiled and tested using the MONO
 * project.
 * 
 * To compile using MONO:
 * mcs -r:Newtonsoft.Json.dll example.cs
 */
namespace RestApplication
{
    class Program
    {        
        static void Main(string[] args)
        {
            using (var wb = new WebClient())
            {
                wb.Headers.Set(HttpRequestHeader.ContentType, "application/json");
                wb.Headers.Add("user_key", "{USER_KEY}");
                wb.Headers.Add("Session_key", "{SESSION_KEY}");

                String payload = "{" + 
                  "    \"alias\": {" + 
                  "        \"alias\": \"MY ALIAS\", " + 
                  "        \"company-name\": \"company name\", " + 
                  "        \"contact-name\": \"name\", " + 
                  "        \"contact-surname\": \"surname\", " + 
                  "        \"cod-fiscale\": \"02367940224\", " + 
                  "        \"vat-number\": \"02367940224\", " + 
                  "        \"contact-address\": \"address\", " + 
                  "        \"contact-city\": \"city\", " + 
                  "        \"contact-pcode\": \"pcode\", " + 
                  "        \"contact-type\": \"WEB\", " + 
                  "        \"contact-info\": \"www.www.it\"" + 
                  "    }" + 
                  "}";

                String response = wb.UploadString("https://app.gateway.smsend.it/API/v1.0/REST/alias", "POST", payload)

                dynamic obj = JsonConvert.DeserializeObject(response);
                Console.WriteLine(obj);
            }

        }
    }
}
On success, the above command returns the following response, plus the HTTP Location header pointing to the created alias
{
  "result": "OK"
}
If getAlias is true instead, the following is returned:
{
    "result": "OK",
    "string": "MY ALIAS"
}
Copy code
using System;
using System.Text;
using System.Net;
using System.Collections.Specialized;

// We are using JSON.NET (http://www.newtonsoft.com/json)
using Newtonsoft.Json;

/*
 * The following code has been compiled and tested using the MONO
 * project.
 * 
 * To compile using MONO:
 * mcs -r:Newtonsoft.Json.dll example.cs
 */
namespace RestApplication
{
    class Program
    {        
        static void Main(string[] args)
        {
            using (var wb = new WebClient())
            {
                wb.Headers.Set(HttpRequestHeader.ContentType, "application/json");
                wb.Headers.Add("user_key", "{USER_KEY}");
                wb.Headers.Add("Session_key", "{SESSION_KEY}");

                String payload = "{" + 
                  "    \"alias\": {" + 
                  "        \"alias\": \"MY ALIAS\", " + 
                  "        \"company-name\": \"company name\", " + 
                  "        \"contact-name\": \"name\", " + 
                  "        \"contact-surname\": \"surname\", " + 
                  "        \"cod-fiscale\": \"02367940224\", " + 
                  "        \"vat-number\": \"02367940224\", " + 
                  "        \"contact-address\": \"address\", " + 
                  "        \"contact-city\": \"city\", " + 
                  "        \"contact-pcode\": \"pcode\", " + 
                  "        \"contact-type\": \"WEB\", " + 
                  "        \"contact-info\": \"www.www.it\"" + 
                  "    }" + 
                  "}";

                String response = wb.UploadString("https://app.gateway.smsend.it/API/v1.0/REST/alias", "POST", payload)

                dynamic obj = JsonConvert.DeserializeObject(response);
                Console.WriteLine(obj);
            }

        }
    }
}
On success, the above command returns the following response, plus the HTTP Location header pointing to the created alias
{
  "result": "OK"
}
If getAlias is true instead, the following is returned:
{
    "result": "OK",
    "string": "MY ALIAS"
}

Get all aliases

Returns a paginated list of the user’s TPOA aliases.

HTTP Headers

user_key / Session_key

HTTP Method

GET

HTTP Request

https://app.gateway.smsend.it/API/v1.0/REST/alias?pageNumber={page}&pageSize={size}&hide-not-approved={value}

Parameters

Parameter Type Description Required Default
pageNumber Int Return the given results page No 1
pageSize Int The number of results in a page No 10
hide-not-approved Bool Show or hide not-yet-approved aliases No false

Returns

Code Description
200 The paginated list of the user’s TPOA aliases
400 Other errors, details are in the body
401 [Unauthorized] User_key, Token or Session_key are invalid or not provided
404 [Not found] The User_key was not found

The alias-state attribute in the returned objects represents the status of the TPOA confirmation process. It can be one of the following:

alias-state Description
0 Unconfirmed
1 Confirmed by smSend
2 Confirmed by AGCOM
3 Blocked by smSend
4 Blocked by AGCOM
9 The Alias has been pre-confirmed by smSend
Copy code
# Session Key example
curl -XGET 'https://app.gateway.smsend.it/API/v1.0/REST/alias' -H 'Content-Type: application/json' \
-H 'user_key: {USER_KEY}' -H 'Session_key: {SESSION_KEY}' 

# Access token example
curl -XGET 'https://app.gateway.smsend.it/API/v1.0/REST/alias' -H 'Content-Type: application/json' \
 -H 'user_key: {USER_KEY}' -H 'Access_token: {ACCESS_TOKEN}'
On success, the above command returns the following response:
{
    "alias": [
        {
            "contact-surname": "Dallago",
            "notification-time": "20140704124747",
            "cod-fiscale": "01843020221",
            "alias-state": 3,
            "contact-city": "Trento",
            "id-alias": 36,
            "contact-pcode": "38122",
            "vat-number": "01843020221",
            "alias": "Alias123",
            "company-name": "smSend",
            "contact-type": "FAX",
            "contact-info": "024113727142",
            "contact-name": "Stefano",
            "is-numeric": false,
            "contact-address": "Via Rosaccio 6"
        },
        {
            "contact-surname": "Dallago",
            "notification-time": "20161123155102",
            "cod-fiscale": "01843020221",
            "alias-state": 2,
            "contact-city": "Trento",
            "id-alias": 662,
            "contact-pcode": "38122",
            "vat-number": "03843020821",
            "alias": "dunp",
            "company-name": "smSend",
            "contact-type": "FAX",
            "contact-info": "04317378142",
            "contact-name": "Stefano",
            "is-numeric": false,
            "contact-address": "Via Rosaccio 6"
        }
    ],
    "total": 2,
    "pageNumber": 1,
    "result": "OK",
    "pageSize": 10
}
Copy code
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.io.OutputStream;
import java.net.URL;

public class Main {
    public static void main(String[] args) {
        try {
            URL url = new URL("https://app.gateway.smsend.it/API/v1.0/REST/alias");
            HttpURLConnection conn = (HttpURLConnection) url.openConnection();

            conn.setRequestProperty("user_key", "{USER_KEY}");

            // Use this when using Session Key authentication
            conn.setRequestProperty("Session_key", "{SESSION_KEY}");                  
            // When using Access Token authentication, use this instead:
            // conn.setRequestProperty("Access_token", "{ACCESS_TOKEN}");

            conn.setRequestMethod("GET");

            if (conn.getResponseCode() != 200) {
                throw new RuntimeException("Failed : HTTP error code : "
                                           + conn.getResponseCode());
            }
            BufferedReader br =
                new BufferedReader(new InputStreamReader(conn.getInputStream()));

            String response = "";
            String output;
            while ((output = br.readLine()) != null) {
                response += output;
            }
            // You can parse the response using Google GSON or similar.
            // MyObject should be a class that reflect the JSON 
            // structure of the response

            GsonBuilder builder = new GsonBuilder();
            Gson gson = builder.create();
            MyObject responseObj = gson.fromJson(response, MyObject.class);
            conn.disconnect();
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }
}
On success, the above command returns the following response:
{
    "alias": [
        {
            "contact-surname": "Dallago",
            "notification-time": "20140704124747",
            "cod-fiscale": "01843020221",
            "alias-state": 3,
            "contact-city": "Trento",
            "id-alias": 36,
            "contact-pcode": "38122",
            "vat-number": "01843020221",
            "alias": "Alias123",
            "company-name": "smSend",
            "contact-type": "FAX",
            "contact-info": "024113727142",
            "contact-name": "Stefano",
            "is-numeric": false,
            "contact-address": "Via Rosaccio 6"
        },
        {
            "contact-surname": "Dallago",
            "notification-time": "20161123155102",
            "cod-fiscale": "01843020221",
            "alias-state": 2,
            "contact-city": "Trento",
            "id-alias": 662,
            "contact-pcode": "38122",
            "vat-number": "03843020821",
            "alias": "dunp",
            "company-name": "smSend",
            "contact-type": "FAX",
            "contact-info": "04317378142",
            "contact-name": "Stefano",
            "is-numeric": false,
            "contact-address": "Via Rosaccio 6"
        }
    ],
    "total": 2,
    "pageNumber": 1,
    "result": "OK",
    "pageSize": 10
}
Copy code
<?php

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://app.gateway.smsend.it/API/v1.0/REST/alias');
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'Content-type: application/json',
    'user_key: {USER_KEY}',
    // Use this when using session key authentication
    'Session_key: {SESSION_KEY}',
    // When using Access Token authentication, use this instead:
    // 'Access_token: {ACCESS_TOKEN}'
));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);


$response = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);

if ($info['http_code'] != 200) {
    echo('Error!');
}
else {

    $obj = json_decode($response);
    print_r($obj);
}
?>
On success, the above command returns the following response:
{
    "alias": [
        {
            "contact-surname": "Dallago",
            "notification-time": "20140704124747",
            "cod-fiscale": "01843020221",
            "alias-state": 3,
            "contact-city": "Trento",
            "id-alias": 36,
            "contact-pcode": "38122",
            "vat-number": "01843020221",
            "alias": "Alias123",
            "company-name": "smSend",
            "contact-type": "FAX",
            "contact-info": "024113727142",
            "contact-name": "Stefano",
            "is-numeric": false,
            "contact-address": "Via Rosaccio 6"
        },
        {
            "contact-surname": "Dallago",
            "notification-time": "20161123155102",
            "cod-fiscale": "01843020221",
            "alias-state": 2,
            "contact-city": "Trento",
            "id-alias": 662,
            "contact-pcode": "38122",
            "vat-number": "03843020821",
            "alias": "dunp",
            "company-name": "smSend",
            "contact-type": "FAX",
            "contact-info": "04317378142",
            "contact-name": "Stefano",
            "is-numeric": false,
            "contact-address": "Via Rosaccio 6"
        }
    ],
    "total": 2,
    "pageNumber": 1,
    "result": "OK",
    "pageSize": 10
}
Copy code
# pip install requests
import requests
import json
# Use this when using Session Key authentication
headers = { 'user_key': '{USER_KEY}', 'Session_key' : '{SESSION_KEY}', 'Content-type' : 'application/json' }
# When using Access Token authentication, use this instead:
# headers = { 'user_key': '{USER_KEY}', 'Access_token' : '{ACCESS_TOKEN}', 'Content-type' : 'application/json' }

r = requests.get("https://app.gateway.smsend.it/API/v1.0/REST/alias", headers=headers)

if r.status_code != 200:
    print("An error occurred, return code is: " + str(r.status_code))
else:
    response = r.text

    obj = json.loads(response)
    print(unicode(obj))
On success, the above command returns the following response:
{
    "alias": [
        {
            "contact-surname": "Dallago",
            "notification-time": "20140704124747",
            "cod-fiscale": "01843020221",
            "alias-state": 3,
            "contact-city": "Trento",
            "id-alias": 36,
            "contact-pcode": "38122",
            "vat-number": "01843020221",
            "alias": "Alias123",
            "company-name": "smSend",
            "contact-type": "FAX",
            "contact-info": "024113727142",
            "contact-name": "Stefano",
            "is-numeric": false,
            "contact-address": "Via Rosaccio 6"
        },
        {
            "contact-surname": "Dallago",
            "notification-time": "20161123155102",
            "cod-fiscale": "01843020221",
            "alias-state": 2,
            "contact-city": "Trento",
            "id-alias": 662,
            "contact-pcode": "38122",
            "vat-number": "03843020821",
            "alias": "dunp",
            "company-name": "smSend",
            "contact-type": "FAX",
            "contact-info": "04317378142",
            "contact-name": "Stefano",
            "is-numeric": false,
            "contact-address": "Via Rosaccio 6"
        }
    ],
    "total": 2,
    "pageNumber": 1,
    "result": "OK",
    "pageSize": 10
}
Copy code
// Uses https://github.com/request/request
// npm install [-g] request

var request = require('request');

request({
    url: 'https://app.gateway.smsend.it/API/v1.0/REST/alias',
    method: 'GET',
    headers: { 'user_key' : '{USER_KEY}', 'Session_key' : '{SESSION_KEY}' },

    callback: function (error, responseMeta, response) {
        if (!error && responseMeta.statusCode == 200) {

        }
        else {
            console.log('An error occurred..');
        }
    }
});
On success, the above command returns the following response:
{
    "alias": [
        {
            "contact-surname": "Dallago",
            "notification-time": "20140704124747",
            "cod-fiscale": "01843020221",
            "alias-state": 3,
            "contact-city": "Trento",
            "id-alias": 36,
            "contact-pcode": "38122",
            "vat-number": "01843020221",
            "alias": "Alias123",
            "company-name": "smSend",
            "contact-type": "FAX",
            "contact-info": "024113727142",
            "contact-name": "Stefano",
            "is-numeric": false,
            "contact-address": "Via Rosaccio 6"
        },
        {
            "contact-surname": "Dallago",
            "notification-time": "20161123155102",
            "cod-fiscale": "01843020221",
            "alias-state": 2,
            "contact-city": "Trento",
            "id-alias": 662,
            "contact-pcode": "38122",
            "vat-number": "03843020821",
            "alias": "dunp",
            "company-name": "smSend",
            "contact-type": "FAX",
            "contact-info": "04317378142",
            "contact-name": "Stefano",
            "is-numeric": false,
            "contact-address": "Via Rosaccio 6"
        }
    ],
    "total": 2,
    "pageNumber": 1,
    "result": "OK",
    "pageSize": 10
}
Copy code
require 'net/http'
require 'uri'
require 'json'

uri = URI.parse("https://app.gateway.smsend.it/API/v1.0/REST/alias")

# Create the HTTP objects
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Get.new(uri.request_uri)
request['Content-type'] = 'application/json'
request['user_key'] = '{USER_KEY}'
request['Session_key'] = '{SESSION_KEY}'

# Send the request
responseData = http.request(request)
if responseData.code == "200"
  response = responseData.body

  obj = JSON.parse(response)
  puts obj
else
  puts "Error.."
end
On success, the above command returns the following response:
{
    "alias": [
        {
            "contact-surname": "Dallago",
            "notification-time": "20140704124747",
            "cod-fiscale": "01843020221",
            "alias-state": 3,
            "contact-city": "Trento",
            "id-alias": 36,
            "contact-pcode": "38122",
            "vat-number": "01843020221",
            "alias": "Alias123",
            "company-name": "smSend",
            "contact-type": "FAX",
            "contact-info": "024113727142",
            "contact-name": "Stefano",
            "is-numeric": false,
            "contact-address": "Via Rosaccio 6"
        },
        {
            "contact-surname": "Dallago",
            "notification-time": "20161123155102",
            "cod-fiscale": "01843020221",
            "alias-state": 2,
            "contact-city": "Trento",
            "id-alias": 662,
            "contact-pcode": "38122",
            "vat-number": "03843020821",
            "alias": "dunp",
            "company-name": "smSend",
            "contact-type": "FAX",
            "contact-info": "04317378142",
            "contact-name": "Stefano",
            "is-numeric": false,
            "contact-address": "Via Rosaccio 6"
        }
    ],
    "total": 2,
    "pageNumber": 1,
    "result": "OK",
    "pageSize": 10
}
Copy code
using System;
using System.Text;
using System.Net;
using System.Collections.Specialized;

// We are using JSON.NET (http://www.newtonsoft.com/json)
using Newtonsoft.Json;

/*
 * The following code has been compiled and tested using the MONO
 * project.
 * 
 * To compile using MONO:
 * mcs -r:Newtonsoft.Json.dll example.cs
 */
namespace RestApplication
{
    class Program
    {        
        static void Main(string[] args)
        {
            using (var wb = new WebClient())
            {
                wb.Headers.Set(HttpRequestHeader.ContentType, "application/json");
                wb.Headers.Add("user_key", "{USER_KEY}");
                wb.Headers.Add("Session_key", "{SESSION_KEY}");

                String response = wb.DownloadString("https://app.gateway.smsend.it/API/v1.0/REST/alias");

                dynamic obj = JsonConvert.DeserializeObject(response);
                Console.WriteLine(obj);
            }

        }
    }
}
On success, the above command returns the following response:
{
    "alias": [
        {
            "contact-surname": "Dallago",
            "notification-time": "20140704124747",
            "cod-fiscale": "01843020221",
            "alias-state": 3,
            "contact-city": "Trento",
            "id-alias": 36,
            "contact-pcode": "38122",
            "vat-number": "01843020221",
            "alias": "Alias123",
            "company-name": "smSend",
            "contact-type": "FAX",
            "contact-info": "024113727142",
            "contact-name": "Stefano",
            "is-numeric": false,
            "contact-address": "Via Rosaccio 6"
        },
        {
            "contact-surname": "Dallago",
            "notification-time": "20161123155102",
            "cod-fiscale": "01843020221",
            "alias-state": 2,
            "contact-city": "Trento",
            "id-alias": 662,
            "contact-pcode": "38122",
            "vat-number": "03843020821",
            "alias": "dunp",
            "company-name": "smSend",
            "contact-type": "FAX",
            "contact-info": "04317378142",
            "contact-name": "Stefano",
            "is-numeric": false,
            "contact-address": "Via Rosaccio 6"
        }
    ],
    "total": 2,
    "pageNumber": 1,
    "result": "OK",
    "pageSize": 10
}
Copy code
					    #!/usr/bin/env perl

use warnings;
use strict;
use LWP::UserAgent;

# Install using Cpan: "cpan JSON"
use JSON;

my $ua = LWP::UserAgent->new;

my $server_endpoint = "https://app.gateway.smsend.it/API/v1.0/REST/alias";

my $req = HTTP::Request->new(GET => $server_endpoint);

$req->header('Content_type' => 'application/json');

# IMPORTANT: Not adding the ':' before 'user_key' and
# 'Session_key' will result in perl to automatically rewrite the
# headers as 'User-Key' and 'Session-Key', which is not supported
# by our API.
$req->header(':user_key' => $auth->[0],
             ':Session_key' => $auth->[1]);
my $resp = $ua->request($req);
if ($resp->is_success && $resp->code == 200) {
  $response = $resp->decoded_content;
  my $obj = from_json($response);

}
On success, the above command returns the following response:
{
    "alias": [
        {
            "contact-surname": "Dallago",
            "notification-time": "20140704124747",
            "cod-fiscale": "01843020221",
            "alias-state": 3,
            "contact-city": "Trento",
            "id-alias": 36,
            "contact-pcode": "38122",
            "vat-number": "01843020221",
            "alias": "Alias123",
            "company-name": "smSend",
            "contact-type": "FAX",
            "contact-info": "024113727142",
            "contact-name": "Stefano",
            "is-numeric": false,
            "contact-address": "Via Rosaccio 6"
        },
        {
            "contact-surname": "Dallago",
            "notification-time": "20161123155102",
            "cod-fiscale": "01843020221",
            "alias-state": 2,
            "contact-city": "Trento",
            "id-alias": 662,
            "contact-pcode": "38122",
            "vat-number": "03843020821",
            "alias": "dunp",
            "company-name": "smSend",
            "contact-type": "FAX",
            "contact-info": "04317378142",
            "contact-name": "Stefano",
            "is-numeric": false,
            "contact-address": "Via Rosaccio 6"
        }
    ],
    "total": 2,
    "pageNumber": 1,
    "result": "OK",
    "pageSize": 10
}

Get a specific alias

Returns the data of the given TPOA Alias ID.

HTTP Headers

user_key / Session_key

HTTP Method

GET

HTTP Request

https://app.gateway.smsend.it/API/v1.0/REST/alias/{alias_id}

Parameters

Parameter Type Description Required Default
alias_id Int The alias ID Yes -

Returns

Code Description
200 The requested TPOA Alias data
400 Other errors, details are in the body
401 [Unauthorized] User_key, Token or Session_key are invalid or not provided
404 [Not found] The alias was not found

The alias-state attribute in the returned object represents the status of the TPOA confirmation process. It can be one of the following:

alias-state Description
0 Unconfirmed
1 Confirmed by smSend
2 Confirmed by AGCOM
3 Blocked by smSend
4 Blocked by AGCOM
9 The Alias has been pre-confirmed by smSend
Copy code
# Session Key example
curl -XGET 'https://app.gateway.smsend.it/API/v1.0/REST/alias/{alias_id}' -H 'Content-Type: application/json' \
-H 'user_key: {USER_KEY}' -H 'Session_key: {SESSION_KEY}' 

# Access token example
curl -XGET 'https://app.gateway.smsend.it/API/v1.0/REST/alias/{alias_id}' -H 'Content-Type: application/json' \
 -H 'user_key: {USER_KEY}' -H 'Access_token: {ACCESS_TOKEN}'
On success, the above command returns the following response:
{
   "result":"OK",
   "alias":{
      "id-alias":35,
      "alias":"+393458922223",
      "notification-time":"20140704141759",
      "alias-state":3,
      "is-numeric":true,
      "company-name":"aCompany",
      "contact-name":null,
      "contact-surname":null,
      "cod-fiscale":"",
      "vat-number":"",
      "contact-address":null,
      "contact-city":null,
      "contact-pcode":null,
      "contact-type":"123456789",
      "contact-info":""
   }
}
Copy code
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.io.OutputStream;
import java.net.URL;

public class Main {
    public static void main(String[] args) {
        try {
            URL url = new URL("https://app.gateway.smsend.it/API/v1.0/REST/alias/{alias_id}");
            HttpURLConnection conn = (HttpURLConnection) url.openConnection();

            conn.setRequestProperty("user_key", "{USER_KEY}");

            // Use this when using Session Key authentication
            conn.setRequestProperty("Session_key", "{SESSION_KEY}");                  
            // When using Access Token authentication, use this instead:
            // conn.setRequestProperty("Access_token", "{ACCESS_TOKEN}");

            conn.setRequestMethod("GET");

            if (conn.getResponseCode() != 200) {
                throw new RuntimeException("Failed : HTTP error code : "
                                           + conn.getResponseCode());
            }
            BufferedReader br =
                new BufferedReader(new InputStreamReader(conn.getInputStream()));

            String response = "";
            String output;
            while ((output = br.readLine()) != null) {
                response += output;
            }
            // You can parse the response using Google GSON or similar.
            // MyObject should be a class that reflect the JSON 
            // structure of the response

            GsonBuilder builder = new GsonBuilder();
            Gson gson = builder.create();
            MyObject responseObj = gson.fromJson(response, MyObject.class);
            conn.disconnect();
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }
}
On success, the above command returns the following response:
{
   "result":"OK",
   "alias":{
      "id-alias":35,
      "alias":"+393458922223",
      "notification-time":"20140704141759",
      "alias-state":3,
      "is-numeric":true,
      "company-name":"aCompany",
      "contact-name":null,
      "contact-surname":null,
      "cod-fiscale":"",
      "vat-number":"",
      "contact-address":null,
      "contact-city":null,
      "contact-pcode":null,
      "contact-type":"123456789",
      "contact-info":""
   }
}
Copy code
<?php

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://app.gateway.smsend.it/API/v1.0/REST/alias/{alias_id}');
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'Content-type: application/json',
    'user_key: {USER_KEY}',
    // Use this when using session key authentication
    'Session_key: {SESSION_KEY}',
    // When using Access Token authentication, use this instead:
    // 'Access_token: {ACCESS_TOKEN}'
));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);


$response = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);

if ($info['http_code'] != 200) {
    echo('Error!');
}
else {

    $obj = json_decode($response);
    print_r($obj);
}
?>
On success, the above command returns the following response:
{
   "result":"OK",
   "alias":{
      "id-alias":35,
      "alias":"+393458922223",
      "notification-time":"20140704141759",
      "alias-state":3,
      "is-numeric":true,
      "company-name":"aCompany",
      "contact-name":null,
      "contact-surname":null,
      "cod-fiscale":"",
      "vat-number":"",
      "contact-address":null,
      "contact-city":null,
      "contact-pcode":null,
      "contact-type":"123456789",
      "contact-info":""
   }
}
Copy code
# pip install requests
import requests
import json
# Use this when using Session Key authentication
headers = { 'user_key': '{USER_KEY}', 'Session_key' : '{SESSION_KEY}', 'Content-type' : 'application/json' }
# When using Access Token authentication, use this instead:
# headers = { 'user_key': '{USER_KEY}', 'Access_token' : '{ACCESS_TOKEN}', 'Content-type' : 'application/json' }

r = requests.get("https://app.gateway.smsend.it/API/v1.0/REST/alias/{alias_id}", headers=headers)

if r.status_code != 200:
    print("An error occurred, return code is: " + str(r.status_code))
else:
    response = r.text

    obj = json.loads(response)
    print(unicode(obj))
On success, the above command returns the following response:
{
   "result":"OK",
   "alias":{
      "id-alias":35,
      "alias":"+393458922223",
      "notification-time":"20140704141759",
      "alias-state":3,
      "is-numeric":true,
      "company-name":"aCompany",
      "contact-name":null,
      "contact-surname":null,
      "cod-fiscale":"",
      "vat-number":"",
      "contact-address":null,
      "contact-city":null,
      "contact-pcode":null,
      "contact-type":"123456789",
      "contact-info":""
   }
}
Copy code
// Uses https://github.com/request/request
// npm install [-g] request

var request = require('request');

request({
    url: 'https://app.gateway.smsend.it/API/v1.0/REST/alias/{alias_id}',
    method: 'GET',
    headers: { 'user_key' : '{USER_KEY}', 'Session_key' : '{SESSION_KEY}' },

    callback: function (error, responseMeta, response) {
        if (!error && responseMeta.statusCode == 200) {

        }
        else {
            console.log('An error occurred..');
        }
    }
});
On success, the above command returns the following response:
{
   "result":"OK",
   "alias":{
      "id-alias":35,
      "alias":"+393458922223",
      "notification-time":"20140704141759",
      "alias-state":3,
      "is-numeric":true,
      "company-name":"aCompany",
      "contact-name":null,
      "contact-surname":null,
      "cod-fiscale":"",
      "vat-number":"",
      "contact-address":null,
      "contact-city":null,
      "contact-pcode":null,
      "contact-type":"123456789",
      "contact-info":""
   }
}
Copy code
require 'net/http'
require 'uri'
require 'json'

uri = URI.parse("https://app.gateway.smsend.it/API/v1.0/REST/alias/{alias_id}")

# Create the HTTP objects
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Get.new(uri.request_uri)
request['Content-type'] = 'application/json'
request['user_key'] = '{USER_KEY}'
request['Session_key'] = '{SESSION_KEY}'

# Send the request
responseData = http.request(request)
if responseData.code == "200"
  response = responseData.body

  obj = JSON.parse(response)
  puts obj
else
  puts "Error.."
end
On success, the above command returns the following response:
{
   "result":"OK",
   "alias":{
      "id-alias":35,
      "alias":"+393458922223",
      "notification-time":"20140704141759",
      "alias-state":3,
      "is-numeric":true,
      "company-name":"aCompany",
      "contact-name":null,
      "contact-surname":null,
      "cod-fiscale":"",
      "vat-number":"",
      "contact-address":null,
      "contact-city":null,
      "contact-pcode":null,
      "contact-type":"123456789",
      "contact-info":""
   }
}
Copy code
using System;
using System.Text;
using System.Net;
using System.Collections.Specialized;

// We are using JSON.NET (http://www.newtonsoft.com/json)
using Newtonsoft.Json;

/*
 * The following code has been compiled and tested using the MONO
 * project.
 * 
 * To compile using MONO:
 * mcs -r:Newtonsoft.Json.dll example.cs
 */
namespace RestApplication
{
    class Program
    {        
        static void Main(string[] args)
        {
            using (var wb = new WebClient())
            {
                wb.Headers.Set(HttpRequestHeader.ContentType, "application/json");
                wb.Headers.Add("user_key", "{USER_KEY}");
                wb.Headers.Add("Session_key", "{SESSION_KEY}");

                String response = wb.DownloadString("https://app.gateway.smsend.it/API/v1.0/REST/alias/{alias_id}");

                dynamic obj = JsonConvert.DeserializeObject(response);
                Console.WriteLine(obj);
            }

        }
    }
}
On success, the above command returns the following response:
{
   "result":"OK",
   "alias":{
      "id-alias":35,
      "alias":"+393458922223",
      "notification-time":"20140704141759",
      "alias-state":3,
      "is-numeric":true,
      "company-name":"aCompany",
      "contact-name":null,
      "contact-surname":null,
      "cod-fiscale":"",
      "vat-number":"",
      "contact-address":null,
      "contact-city":null,
      "contact-pcode":null,
      "contact-type":"123456789",
      "contact-info":""
   }
}
Copy code
#!/usr/bin/env perl

use warnings;
use strict;
use LWP::UserAgent;

# Install using Cpan: "cpan JSON"
use JSON;

my $ua = LWP::UserAgent->new;

my $server_endpoint = "https://app.gateway.smsend.it/API/v1.0/REST/alias/{alias_id}";

my $req = HTTP::Request->new(GET => $server_endpoint);

$req->header('Content_type' => 'application/json');

# IMPORTANT: Not adding the ':' before 'user_key' and
# 'Session_key' will result in perl to automatically rewrite the
# headers as 'User-Key' and 'Session-Key', which is not supported
# by our API.
$req->header(':user_key' => $auth->[0],
             ':Session_key' => $auth->[1]);
my $resp = $ua->request($req);
if ($resp->is_success && $resp->code == 200) {
  $response = $resp->decoded_content;
  my $obj = from_json($response);

}
On success, the above command returns the following response:
{
   "result":"OK",
   "alias":{
      "id-alias":35,
      "alias":"+393458922223",
      "notification-time":"20140704141759",
      "alias-state":3,
      "is-numeric":true,
      "company-name":"aCompany",
      "contact-name":null,
      "contact-surname":null,
      "cod-fiscale":"",
      "vat-number":"",
      "contact-address":null,
      "contact-city":null,
      "contact-pcode":null,
      "contact-type":"123456789",
      "contact-info":""
   }
}

Remove an alias

Deletes the given TPOA Alias.

HTTP Headers

user_key / Session_key

HTTP Method

DELETE

HTTP Request

https://app.gateway.smsend.it/API/v1.0/REST/alias/{alias_id}

Parameters

Parameter Type Description Required Default
alias_id Int The alias ID Yes -

Returns

Code Description
200 Alias successfully deleted
400 Other errors, details are in the body
401 [Unauthorized] User_key, Token or Session_key are invalid or not provided
404 [Not found] The alias was not found
Copy code
# Session Key example
curl -XDELETE 'https://app.gateway.smsend.it/API/v1.0/REST/alias/{alias_id}' -H 'Content-Type: application/json' \
-H 'user_key: {USER_KEY}' -H 'Session_key: {SESSION_KEY}' 

# Access token example
curl -XDELETE 'https://app.gateway.smsend.it/API/v1.0/REST/alias/{alias_id}' -H 'Content-Type: application/json' \
 -H 'user_key: {USER_KEY}' -H 'Access_token: {ACCESS_TOKEN}'
On success, the above command returns the following response:
{
  "result": "OK"
}
Copy code
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.io.OutputStream;
import java.net.URL;

public class Main {
    public static void main(String[] args) {
        try {
            URL url = new URL("https://app.gateway.smsend.it/API/v1.0/REST/alias/{alias_id}");
            HttpURLConnection conn = (HttpURLConnection) url.openConnection();

            conn.setRequestProperty("user_key", "{USER_KEY}");

            // Use this when using Session Key authentication
            conn.setRequestProperty("Session_key", "{SESSION_KEY}");                  
            // When using Access Token authentication, use this instead:
            // conn.setRequestProperty("Access_token", "{ACCESS_TOKEN}");

            conn.setRequestMethod("DELETE");

            if (conn.getResponseCode() != 200) {
                throw new RuntimeException("Failed : HTTP error code : "
                                           + conn.getResponseCode());
            }
            BufferedReader br =
                new BufferedReader(new InputStreamReader(conn.getInputStream()));

            String response = "";
            String output;
            while ((output = br.readLine()) != null) {
                response += output;
            }
            // You can parse the response using Google GSON or similar.
            // MyObject should be a class that reflect the JSON 
            // structure of the response

            GsonBuilder builder = new GsonBuilder();
            Gson gson = builder.create();
            MyObject responseObj = gson.fromJson(response, MyObject.class);
            conn.disconnect();
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }
}
On success, the above command returns the following response:
{
  "result": "OK"
}
Copy code
<?php

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://app.gateway.smsend.it/API/v1.0/REST/alias/{alias_id}');
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'Content-type: application/json',
    'user_key: {USER_KEY}',
    // Use this when using session key authentication
    'Session_key: {SESSION_KEY}',
    // When using Access Token authentication, use this instead:
    // 'Access_token: {ACCESS_TOKEN}'
));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');

$response = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);

if ($info['http_code'] != 200) {
    echo('Error!');
}
else {

    $obj = json_decode($response);
    print_r($obj);
}
?>
On success, the above command returns the following response:
{
  "result": "OK"
}
Copy code
# pip install requests
import requests
import json
# Use this when using Session Key authentication
headers = { 'user_key': '{USER_KEY}', 'Session_key' : '{SESSION_KEY}', 'Content-type' : 'application/json' }
# When using Access Token authentication, use this instead:
# headers = { 'user_key': '{USER_KEY}', 'Access_token' : '{ACCESS_TOKEN}', 'Content-type' : 'application/json' }

r = requests.delete("https://app.gateway.smsend.it/API/v1.0/REST/alias/{alias_id}", headers=headers)

if r.status_code != 200:
    print("An error occurred, return code is: " + str(r.status_code))
else:
    response = r.text

    obj = json.loads(response)
    print(unicode(obj))
On success, the above command returns the following response:
{
  "result": "OK"
}
Copy code
// Uses https://github.com/request/request
// npm install [-g] request

var request = require('request');

request({
    url: 'https://app.gateway.smsend.it/API/v1.0/REST/alias/{alias_id}',
    method: 'DELETE',
    headers: { 'user_key' : '{USER_KEY}', 'Session_key' : '{SESSION_KEY}' },

    callback: function (error, responseMeta, response) {
        if (!error && responseMeta.statusCode == 200) {

        }
        else {
            console.log('An error occurred..');
        }
    }
});
On success, the above command returns the following response:
{
  "result": "OK"
}
Copy code
require 'net/http'
require 'uri'
require 'json'

uri = URI.parse("https://app.gateway.smsend.it/API/v1.0/REST/alias/{alias_id}")

# Create the HTTP objects
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(uri.request_uri)
request['Content-type'] = 'application/json'
request['user_key'] = '{USER_KEY}'
request['Session_key'] = '{SESSION_KEY}'

# Send the request
responseData = http.request(request)
if responseData.code == "200"
  response = responseData.body

  obj = JSON.parse(response)
  puts obj
else
  puts "Error.."
end
On success, the above command returns the following response:
{
  "result": "OK"
}
Copy code
using System;
using System.Text;
using System.Net;
using System.Collections.Specialized;

// We are using JSON.NET (http://www.newtonsoft.com/json)
using Newtonsoft.Json;

/*
 * The following code has been compiled and tested using the MONO
 * project.
 * 
 * To compile using MONO:
 * mcs -r:Newtonsoft.Json.dll example.cs
 */
namespace RestApplication
{
    class Program
    {        
        static void Main(string[] args)
        {
            using (var wb = new WebClient())
            {
                wb.Headers.Set(HttpRequestHeader.ContentType, "application/json");
                wb.Headers.Add("user_key", "{USER_KEY}");
                wb.Headers.Add("Session_key", "{SESSION_KEY}");

                wb.UploadValues("https://app.gateway.smsend.it/API/v1.0/REST/alias/{alias_id}", "DELETE", new NameValueCollection());

                dynamic obj = JsonConvert.DeserializeObject(response);
                Console.WriteLine(obj);
            }

        }
    }
}
On success, the above command returns the following response:
{
  "result": "OK"
}
Copy code
#!/usr/bin/env perl

use warnings;
use strict;
use LWP::UserAgent;

# Install using Cpan: "cpan JSON"
use JSON;

my $ua = LWP::UserAgent->new;

my $server_endpoint = "https://app.gateway.smsend.it/API/v1.0/REST/alias/{alias_id}";

my $req = HTTP::Request->new(DELETE => $server_endpoint);

$req->header('Content_type' => 'application/json');

# IMPORTANT: Not adding the ':' before 'user_key' and
# 'Session_key' will result in perl to automatically rewrite the
# headers as 'User-Key' and 'Session-Key', which is not supported
# by our API.
$req->header(':user_key' => $auth->[0],
             ':Session_key' => $auth->[1]);
my $resp = $ua->request($req);
if ($resp->is_success && $resp->code == 200) {
  $response = $resp->decoded_content;
  my $obj = from_json($response);

}
On success, the above command returns the following response:
{
  "result": "OK"
}