NAV
shell php java python nodejs ruby c#

Autenticação

Cada pedido realizado terá de incluir no respetivo cabeçalho do pedido http a autenticação do cliente. Tal é feito usando uma autenticação de acesso básico HTTP.

O cabeçalho da autorização é construído combinando a combinação utilizador:palavra-passe e codificando-a em base64. A esta combinação antepõe-se Authorization: Basic

Por exemplo, para o utilizador username e palavra-passe apiPassword o cabeçalho resultante seria:

Authorization: Basic dXNlcm5hbWU6YXBpUGFzc3dvcmQ=

Campanhas

SMS

Envio SMS

POST https://dashboard.360nrs.com/api/rest/sms

curl -X POST 'https://dashboard.360nrs.com/api/rest/sms' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
  "to": ["34666555444"],
  "from": "TEST",
  "message": "SMS text message"
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/sms',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => '{
  "to": ["34666555444"],
  "from": "TEST",
  "message": "SMS text message"
}',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Basic YOUR_AUTH_TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;

public class App {
  public static void main(String[] args) {
    try {
      URL url = new URL("https://dashboard.360nrs.com/api/rest/sms");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("POST");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      connection.setRequestProperty("Accept", "application/json");
      String requestBody = "{ \"to\": [\"34666555444\"], \"from\": \"TEST\", \"message\": \"SMS text message\" }";
      connection.setDoOutput(true);
      DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
      wr.writeBytes(requestBody);
      wr.flush();
      wr.close();
      BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
      }
      in.close();
      System.out.println(response.toString());
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
}
var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://dashboard.360nrs.com/api/rest/sms',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  },
  'body': '{ "to": ["34666555444"], "from": "TEST", "message": "SMS text message" }'
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/sms"

payload = "{ \"to\": [\"34666555444\"], \"from\": \"TEST\", \"message\": \"SMS text message\" }"
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Basic YOUR_AUTH_TOKEN'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
require "uri"
require "net/http"

url = URI("https://dashboard.360nrs.com/api/rest/sms")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"
request.body = "{ \"to\": [\"34666555444\"], \"from\": \"TEST\", \"message\": \"SMS text message\" }"

response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
  class HelloWorld {
    static void Main(string[] args) {
      var client = new RestClient("https://dashboard.360nrs.com/api/rest/sms");
      client.Timeout = -1;
      var request = new RestRequest(Method.POST);
      request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
      request.AddHeader("Content-Type", "application/json");
      request.AddParameter("application/json", "{ \"to\": [\"34666555444\"], \"from\": \"TEST\", \"message\": \"SMS text message\" }",  ParameterType.RequestBody);
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

Response

HTTP Response Code 202 (ACCEPTED)

{
  "campaignId": 100000,
  "result": [
    {
      "accepted": true,
      "to": "34666555444",
      "id": "XXXXXXXXXXXXX",
      "parts": 1,
      "scheduledAt": null,
      "expiresAt": null
    }
  ]
}

HTTP Response Code 207 (MULTI-STATUS)

{
  "campaignId": 100000,
  "result": [
    {
      "accepted": true,
      "to": "34666555444",
      "id": "XXXXXXXXXXXXX",
      "parts": 1,
      "scheduledAt": null,
      "expiresAt": null
    },
    {
      "accepted": false,
      "to": "34",
      "error": {
        "code": 102,
        "description": "No valid recipients"
      }
    }
  ]
}

Error response (HTTP 400)

{
  "error": {
    "code": 102,
    "description": "No valid recipients"
  }
}

Parâmetros

Parâmetro Tipo Obrigatório Descrição
message string Sim Texto da mensagem. O máximo de caracteres permitidos são 160 se não for especificado que a mensagem é multipartes. (Veja parâmetro parts). O texto deverá receber a codificação UTF-8.
to array Sim Número do telefone móvel destinatário da mensagem. Deve-se incluir o prefixo do país destinatário. (Exemplo Brasil 5511966778899). Pode-se especificar diversos destinatários através deste parâmetro.
from string Sim Nome do remetente da mensagem, este parâmetro é formado por 15 caracteres numéricos ou 11 caracteres alfanuméricos. Não é permitida a utilização de caracteres especiais.
encoding string Não Os valores possíveis são 'gsm', 'gsm-pt' e 'utf-16'. O valor gsm deve ser utilizado para envios convencionais na codificação GSM7 com até 160 caracteres por mensagem. O valor utf-16 deve ser utilizado para envios com caracteres especiais na codificação UCS2 (UTF16) com até 70 caracteres por mensagem. O valor padrão deste parâmetro é gsm.
scheduleDate string Não Data de envio das mensagens no UTC. Para envios de mensagens programadas, é possível especificar a data e hora do envio no formato YYYYmmddHHiiss (Exemplo: 20130215142000 seria 15 de fevereiro de 2013 às 14:20). Para envios imediatos, não especifique este parâmetro.
expirationDate string Não Data de validade das mensagens no UTC. Formato YYYYmmddHHiiss (Exemplo: 20130215142000 seria 15 de fevereiro de 2013 às 14:20).
parts integer Não Este parâmetro indica o número máximo de partes que a mensagem terá no momento do envio. O valor padrão deste parâmetro é 1. Caso este parâmetro não seja especificado, ao enviar uma mensagem com mais de 160 caracteres em codificação GSM ou 70 caracteres na codificação UTF16, o processamento da mensagem falhará. É preciso ter em conta que mensagens concatenadas em GSM são fracionadas em partes com até 153 caracteres cada e em UTF16 em 67. Cada parte será processada e tarifada distintamente, mas ao destinatário chegará como uma única mensagem com a indicação de paginação de acordo com as limitações de cada operadora local. Nosso servidor utilizará o mínimo de partes necessárias para processar a mensagem mesmo que seja indicado um valor alto de partes no parâmetro, caso o número indicado seja inferior ao necessário, o envio falhará e será retornado o código 105. O número máximo de partes permitidas é 8.
notificationUrl string Não URL que será feita a chamada GET com os parâmetros desejados de resposta.
trans integer Não Os valores disponíveis são 1 ou 0. Ao indiciar o valor 0 (este é o valor padrão caso o parâmetro não seja especificado) o servidor não realizará nenhuma alteração nos caracteres especiais da mensagem. Com o valor 1 indicado, o servidor fará a alteração dos caracteres especiais a caracteres comuns de acordo com a seguinte regra de tradução: 'á' => 'a', 'í'=>'i', 'ó'=>'o', 'ú'=>'u', 'ç'=>'Ç', 'Á'=>'A', 'Í'=>'I', 'Ó'=>'O', 'Ú'=>'U', 'À'=>'A', 'È'=>'E', 'Ì'=>'I', 'Ò'=>'O', 'Ù'=>'U', 'º' => '', 'ª' => '', 'Õ' => 'O', 'õ' => 'o', 'â' => 'a', 'ê' => 'e', 'î'=>'i', 'ô'=>'o', 'û'=>'u', ' '=>'A', 'Ê'=>'E', 'Î'=>'I', 'Ô'=>'O', 'Û'=>'U', 'ã' => 'a', 'Ã' => 'A'.
campaignName string Não Nome da campanha Se especificado, uma campanha será criada com o nome indicado no painel que conterá as estatísticas de envio. Se uma campanha com este nome já existe, as estatísticas de entrega serão adicionadas à campanha existente.
tags array Não campaignName é necessário se este parâmetro for especificado. Lista de tags para adicionar à campanha. As tags podem ser usadas para filtrar as estatísticas no painel.
certified boolean Não Se for especificado como true, a mensagem será enviada como certificado. Mensagens certificadas têm custo adicional
sub array Não array com variáveis de substituição que serão aplicadas à mensagem.
splitParts boolean Não Para mensagens que excedem o tamanho máximo do SMS, o servidor dividirá a mensagem em vários SMS, em vez de usar o SMS concatenado. O valor padrão é false.
flash boolean Não Um flash SMS é uma mensagem que aparece diretamente na tela do dispositivo. Dependendo do modelo e do sistema operacional, é possível armazená-lo na caixa de entrada e enviar mensagens concatenadas.
availableTimes array Não Indique as horas em que o SMS será enviado. Os objetos json são definidos na forma:

[{"day": 1, "from": "09:00", "to": "21:00"}]

day: é indicado um dia no intervalo de segunda a domingo, deve ser um número entre 1 e 7. Opcional: Se não for especificado, o intervalo se aplicará a todos os dias da semana.
from: hora que define o início do intervalo de tempo no formato UTC de 24 horas.
to: hora que define o fim do intervalo de tempo no formato UTC de 24 horas.

Variáveis de substituição

Ao usar o sub-parâmetro, a matriz deve conter tantos itens quanto os destinatários de envio.

{
  "from": "TEST",
  "to": ["34666555444", "34666555333"],
  "message": "Hello {name}",
  "sub": [
    {"name": "first contact name"},
    {"name": "second contact name"}
  ]
}

Variáveis personalizadas podem ser indicadas no corpo da mensagem. Essas variáveis serão substituídas pelas variáveis personalizadas do contato ou pelas variáveis indicadas no parâmetro sub.

Filtros variáveis personalizados

É possível adicionar os seguintes filtros às variáveis personalizadas.

Filtro Descrição Ejemplo Resultado
lower Retornar texto em minúsculas. {name|lower} my name
upper Retornar texto em maiúsculas. {name|upper} MY NAME
capitalize Retorne o texto com a primeira letra da primeira palavra em maiúsculas. {name|capitalize} My name
capitalizeAll Retorne o texto com a primeira letra de cada palavra em maiúsculas. {name|capitalizeAll} My Name
formatDotComma Retorna o número com um ponto como separador de milhares y vírgula como separador de decimais. {number|formatDotComma} 1.234,56
formatCommaDot Retorna o número com uma vírgula como separador de milhares y ponto como separador de decimais. {number|formatCommaDot} 1,234.56
shorten Retorna um url encurtado. Deve ser um URL válido. {url|shorten} https://nrs.so/xxxxxx

Avisos de recebimento/DLR

Se desejar receber os avisos de recebimento / dlr em tempo real, é necessário especificar o parâmetro notificationUrl e em seu valor indicar a URL para onde nosso servidor enviará os dados de cada envio.

O funcionamento consiste na especificação de cada envio, a URL onde é desejado receber a requisição GET do nosso servidor com o DLR do envio assim que o recebemos da operadora.

Nosso servidor enviará as variáveis através do método GET. Cada variável deverá conter caracteres de escape que será substituído com o seu devido valor. A formação desses caracteres de escape é formada por "%" seguido de uma letra. Cada letra possui seu valor correspondente. Veja abaixo um exemplo de URL:

http://mi.server.com/notifica.php?remitente=%p&tel=%P&estado=%d

Veja abaixo a definição de cada caractere de escape:

O valor em %d é o que terá o estado final da mensagem enviada. Os possíveis valores de estado e seus significados são:

Veja abaixo um exemplo de URL a ser especificada no parâmetro para que o nosso servidor possa fazer as substituições dos caracteres de escape a sua URL e também um exemplo de envio de mensagem com a solicitação do Aviso de recebimento/DLR

http://mi.server.com/notifica.php?idenvio=7584remitente=%p&tel=%P&estado=%d

Informação de SMS por id de mensagem

GET https://dashboard.360nrs.com/api/rest/sms/<ID>

curl -X GET 'https://dashboard.360nrs.com/api/rest/sms/<ID>' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/sms/<ID>',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Basic YOUR_AUTH_TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;

public class App {
  public static void main(String[] args) {
    try {
      URL url = new URL("https://dashboard.360nrs.com/api/rest/sms/<ID>");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("GET");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      connection.setRequestProperty("Accept", "application/json");
      BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
      }
      in.close();
      System.out.println(response.toString());
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
}
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://dashboard.360nrs.com/api/rest/sms/<ID>',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/sms/<ID>"

payload = {}
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Basic YOUR_AUTH_TOKEN'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
require "uri"
require "net/http"

url = URI("https://dashboard.360nrs.com/api/rest/sms/<ID>")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"

response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
  class HelloWorld {
    static void Main(string[] args) {
      var client = new RestClient("https://dashboard.360nrs.com/api/rest/sms/<ID>");
      client.Timeout = -1;
      var request = new RestRequest(Method.GET);
      request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
      request.AddHeader("Content-Type", "application/json");
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

Response

HTTP Response Code 200 (OK)

{
    "data": [
        {
            "id": "XXXXXXXXXXXXX",
            "from": "360NRS",
            "to": "34666555444",
            "message": "SMS text message",
            "campaignId": 123456,
            "sendingId": 234567,
            "isDelivered": true,
            "isClicked": false,
            "events": [
                {
                    "type": "sent",
                    "date": "2021-07-19T15:00:33+00:00",
                    "isMobile": false,
                    "browser": "",
                    "os": ""
                },
                {
                    "type": "delivered",
                    "date": "2021-07-19T15:00:33+00:00",
                    "isMobile": false,
                    "browser": "",
                    "os": ""
                }
            ],
            "customFields": {
                "email": "test@test.com",
                "phone": "34666555444",
                "name": "Name"
            },
            "links": {
                "self": "https://dashboard.360nrs.com/api/rest/sms/XXXXXXXXXXXXX"
            }
        }
    ]
}

Error response (HTTP 404)

{
    "error": {
        "code": 404,
        "description": "Resource not found"
    }
}
Parâmetro Tipo Obrigatório Descrição
id string Sim Identificador da mensagem retornada na resposta à chamada para api/rest/sms no campo id. É possível especificar vários identificadores separados por vírgulas.

Email

Envio de email

POST https://dashboard.360nrs.com/api/rest/mailing

curl -X POST 'https://dashboard.360nrs.com/api/rest/mailing' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
    "to": ["test@example.com"],
    "fromName": "Info",
    "fromEmail": "info@360nrs.com",
    "body": "<html><head><title>TEST</title></head><body><a href=\"https://example.com\">link</a></body></html>",
    "replyTo": "replyto@example.com",
    "subject": "TEST"
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/mailing',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => '{
    "to": ["test@example.com"],
    "fromName": "Info",
    "fromEmail": "info@360nrs.com",
    "body": "<html><head><title>TEST</title></head><body><a href=\"https://example.com\">link</a></body></html>",
    "replyTo": "replyto@example.com",
    "subject": "TEST"
}',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Basic YOUR_AUTH_TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;

public class App {
  public static void main(String[] args) {
    try {
      URL url = new URL("https://dashboard.360nrs.com/api/rest/mailing");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("POST");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      connection.setRequestProperty("Accept", "application/json");
      String requestBody = "{ \"to\": [\"test@example.com\"], \"fromName\": \"Info\", \"fromEmail\": \"info@360nrs.com\", \"body\": \"<html><head><title>TEST</title></head><body><a href=\\\"https://example.com\\\">link</a></body></html>\", \"replyTo\": \"replyto@example.com\", \"subject\": \"TEST\" }";
      connection.setDoOutput(true);
      DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
      wr.writeBytes(requestBody);
      wr.flush();
      wr.close();
      BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
      }
      in.close();
      System.out.println(response.toString());
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
}
var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://dashboard.360nrs.com/api/rest/mailing',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  },
  'body': '{ "to": ["test@example.com"], "fromName": "Info", "fromEmail": "info@360nrs.com", "body": "<html><head><title>TEST</title></head><body><a href=\"https://example.com\">link</a></body></html>", "replyTo": "replyto@example.com", "subject": "TEST" }'
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/mailing"

payload = "{ \"to\": [\"test@example.com\"], \"fromName\": \"Info\", \"fromEmail\": \"info@360nrs.com\", \"body\": \"<html><head><title>TEST</title></head><body><a href=\\\"https://example.com\\\">link</a></body></html>\", \"replyTo\": \"replyto@example.com\", \"subject\": \"TEST\" }"
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Basic YOUR_AUTH_TOKEN'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
require "uri"
require "net/http"

url = URI("https://dashboard.360nrs.com/api/rest/mailing")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"
request.body = "{ \"to\": [\"test@example.com\"], \"fromName\": \"Info\", \"fromEmail\": \"info@360nrs.com\", \"body\": \"<html><head><title>TEST</title></head><body><a href=\\\"https://example.com\\\">link</a></body></html>\", \"replyTo\": \"replyto@example.com\", \"subject\": \"TEST\" }"

response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
  class HelloWorld {
    static void Main(string[] args) {
      var client = new RestClient("https://dashboard.360nrs.com/api/rest/mailing");
      client.Timeout = -1;
      var request = new RestRequest(Method.POST);
      request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
      request.AddHeader("Content-Type", "application/json");
      request.AddParameter("application/json", "{ \"to\": [\"test@example.com\"], \"fromName\": \"Info\", \"fromEmail\": \"info@360nrs.com\", \"body\": \"<html><head><title>TEST</title></head><body><a href=\\\"https://example.com\\\">link</a></body></html>\", \"replyTo\": \"replyto@example.com\", \"subject\": \"TEST\" }",  ParameterType.RequestBody);
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

Response

HTTP Response Code 202 (ACCEPTED)

{
  "campaignId": 100000,
  "result": [
    {
      "accepted": true,
      "to": "test@example.com",
      "id": "XXXXXXXXXXXXX",
      "scheduledAt": null
    }
  ]
}

HTTP Response Code 207 (MULTI-STATUS)

{
  "campaignId": 100000,
  "result": [
    {
      "accepted": true,
      "to": "test@example.com",
      "id": "XXXXXXXXXXXXX",
      "scheduledAt": null
    },
    {
      "accepted": false,
      "to": "invalidEmail",
      "error": {
        "code": 102,
        "description": "No valid recipients"
      }
    }
  ]
}

Error response (HTTP 400)

{
  "error": {
    "code": 102,
    "description": "No valid recipients"
  }
}

Parâmetros

Parâmetro Tipo Obrigatório Descrição
body string Não Corpo do email em formato HTML com codificação UTF-8. Obrigatório sem templateId.
templateId integer Não ID do modelo para enviar como o corpo do email. Necessário sem body.
to array Sim Emails destinatários do envio. É permitido indicar múltiplos destinatários.
fromEmail string Sim Email remetente. O email indicado deve estar validado na plataforma 360NRS.
subject string Sim Breve resumo sobre o assunto da mensagem.
fromName string Não Nome do remetente do envio.
replyTo string Sim Direção de e-mail para onde os destinatários poderão responder.
scheduleDate string Não Data de envio das mensagens. Para envios de mensagens programadas, é possível especificar a data e hora do envio no formato YYYYmmddHHiiss (Exemplo: 20130215142000 seria 15 de fevereiro de 2013 às 14:20). Para envios imediatos, não especifique este parâmetro.
campaignName string Não Nome da campanha Se especificado, uma campanha será criada com o nome indicado no painel que conterá as estatísticas de envio. Se uma campanha com este nome já existe, as estatísticas de entrega serão adicionadas à campanha existente.
tags array Não campaignName é necessário se este parâmetro for especificado. Lista de tags para adicionar à campanha. As tags podem ser usadas para filtrar as estatísticas no painel.
sub array Não array com variáveis de substituição que serão aplicadas à mensagem.
trackOpens boolean Não Adicione um pixel para obter estatísticas de abertura. O valor padrão é true.
trackClicks boolean Não Rastreie os links para obter estatísticas de clique. O valor padrão é true.

Variáveis de substituição

Ao usar o sub-parâmetro, a matriz deve conter tantos itens quanto os destinatários de envio.

{
  "to": ["test@example.com", "test2@example.com"],
  "fromName": "Info",
  "fromEmail": "info@360nrs.com",
  "body": "<html><head><title>TEST</title></head><body>Hello {name}, <a href=\"https://example.com\">link</a></body></html>",
  "replyTo": "replyto@example.com",
  "subject": "TEST",
  "sub": [
    {"name": "first contact name"},
    {"name": "second contact name"}
  ]
}

Variáveis personalizadas podem ser indicadas no corpo da mensagem. Essas variáveis serão substituídas pelas variáveis personalizadas do contato ou pelas variáveis indicadas no parâmetro sub.

Voz

Envio de pedido de Voz

POST https://dashboard.360nrs.com/api/rest/voice

curl -X POST 'https://dashboard.360nrs.com/api/rest/voice' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
  "to": ["34666666666"],
  "message": "Esto es un test de mensaje de voz",
  "gender": "F",
  "language": "es_ES"
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/voice',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => '{
  "to": ["34666666666"],
  "message": "Esto es un test de mensaje de voz",
  "gender": "F",
  "language": "es_ES"
}',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Basic YOUR_AUTH_TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;

public class App {
  public static void main(String[] args) {
    try {
      URL url = new URL("https://dashboard.360nrs.com/api/rest/voice");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("POST");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      connection.setRequestProperty("Accept", "application/json");
      String requestBody = "{ \"to\": [\"34666666666\"], \"message\": \"Esto es un test de mensaje de voz\", \"gender\": \"F\", \"language\": \"es_ES\" }";
      connection.setDoOutput(true);
      DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
      wr.writeBytes(requestBody);
      wr.flush();
      wr.close();
      BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
      }
      in.close();
      System.out.println(response.toString());
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
}
var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://dashboard.360nrs.com/api/rest/voice',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  },
  'body': '{ "to": ["34666666666"], "message": "Esto es un test de mensaje de voz", "gender": "F", "language": "es_ES" }'
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/voice"

payload = "{ \"to\": [\"34666666666\"], \"message\": \"Esto es un test de mensaje de voz\", \"gender\": \"F\", \"language\": \"es_ES\" }"
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Basic YOUR_AUTH_TOKEN'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
require "uri"
require "net/http"

url = URI("https://dashboard.360nrs.com/api/rest/voice")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"
request.body = "{ \"to\": [\"34666666666\"], \"message\": \"Esto es un test de mensaje de voz\", \"gender\": \"F\", \"language\": \"es_ES\" }"

response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
  class HelloWorld {
    static void Main(string[] args) {
      var client = new RestClient("https://dashboard.360nrs.com/api/rest/voice");
      client.Timeout = -1;
      var request = new RestRequest(Method.POST);
      request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
      request.AddHeader("Content-Type", "application/json");
      request.AddParameter("application/json", "{ \"to\": [\"34666666666\"], \"message\": \"Esto es un test de mensaje de voz\", \"gender\": \"F\", \"language\": \"es_ES\" }",  ParameterType.RequestBody);
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

Response

HTTP Response Code 202 (ACCEPTED)

{
  "campaignId": 100000,
  "result": [
    {
      "accepted": true,
      "to": "34666666666",
      "id": "XXXXXXXXXXXXX",
      "scheduledAt": null,
      "expiresAt": null
    }
  ]
}

HTTP Response Code 207 (MULTI-STATUS)

{
  "campaignId": 100000,
  "result": [
    {
      "accepted": true,
      "to": "34666666666",
      "id": "XXXXXXXXXXXXX",
      "parts": 1,
      "scheduledAt": null,
      "expiresAt": null
    },
    {
      "accepted": false,
      "to": "34",
      "error": {
        "code": 102,
        "description": "No valid recipients"
      }
    }
  ]
}

Error response (HTTP 400)

{
  "error": {
    "code": 102,
    "description": "No valid recipients"
  }
}

Parâmetros

Parâmetro Tipo Obrigatório Descrição
message string Sim Corpo da mensagem. Pode conter no máximo 500 caracteres. O texto deve ser codificado em UTF-8.
to array Sim Número do telemóvel destinatário da mensagem. Deve incluir o prefixo (Ex.: em Espanha 34666666666). Este campo permite-lhe especificar vários destinatários.
language string Sim Idioma para converter o texto, as opções são:

'en_GB': Inglês - Reino Unido,
'en_US': Inglês - Estados Unidos,
'es_ES': Espanhol - Espanha,
'es_US': Espanhol - Latino,
'pt_PT': Português - Portugal,
'pt_BR': Português - Brasil,
'cmn_CN': Chinês mandarim - China *,
'arb': Árabe *,
'de_DE': Alemão - Alemanha,
'fr_FR': Francês - França,
'it_IT': Italiano - Itália,
'hi_IN': Indi - Índia *.

* Disponível apenas no gênero feminino.
gender string Sim Género da voz, os valores permitidos são 'F' para voz de mulher e 'M' para voz de homem.
callers object Não Objeto com a lista de remetentes personalizados por país para usar na chamada. Se o remetente não for especificado para um país específico, o remetente padrão será usado. Para configurar um remetente personalizado, entre em contato com o departamento de suporte. Exemplo:

{"ES": "6123456789", "PT": "6987654321"}
scheduleDate string Não Data de envio da mensagem em formato UTC. Caso seja necessário enviar mensagens programadas é possível especificar a data de envio indicando a data no formato YYYYmmddHHiiss (Exemplo: 20130215142000 seria 15 de fevereiro de 2013 às 14:20:00). Em caso de envio imediato não é necessário especificar este parâmetro.
expirationDate string Não Permite determinar a data máxima na qual a chamada pode ser realizada. Após este prazo, a chamada será cancelada. Especificar o período de validade ativará automaticamente as tentativas de chamada, voltando a realizá-la caso o destinatário não atenda. A data deve ter o formato YYYYmmddHHiiss (Exemplo: 20130215142000 seria 15 de fevereiro de 2013 às 14:20:00)
campaignName string Não Nome da campanha. Caso seja especificado, será criada uma campanha com o nome indicado no painel de controlo, contendo as estatísticas do envio. Caso já exista uma campanha com este nome, as estatísticas de envio serão juntas à campanha existente.
tags array Não campaignName é necessário caso este parâmetro seja especificado. Lista de tags a juntar à campanha. As tags podem ser utilizadas para filtrar as estatísticas no painel do controlo.
sub array Não array com variáveis de substituição que serão aplicadas à mensagem.

Variáveis de substituição

Variáveis personalizadas podem ser indicadas no corpo da mensagem. Essas variáveis serão substituídas pelas variáveis personalizadas do contato ou pelas variáveis indicadas no parâmetro sub. Ao usar o sub-parâmetro, a matriz deve conter tantos itens quanto os destinatários de envio.

Petição de envio de Voz com url para arquivo de áudio

POST https://dashboard.360nrs.com/api/rest/voiceAudio

curl -X POST 'https://dashboard.360nrs.com/api/rest/voiceAudio' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
  "to": ["34666666666"],
  "audioUrl": "https://example.com/audio.mp3"
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/voiceAudio',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => '{
  "to": ["34666666666"],
  "audioUrl": "https://example.com/audio.mp3"
}',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Basic YOUR_AUTH_TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;

public class App {
  public static void main(String[] args) {
    try {
      URL url = new URL("https://dashboard.360nrs.com/api/rest/voiceAudio");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("POST");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      connection.setRequestProperty("Accept", "application/json");
      String requestBody = "{ \"to\": [\"34666666666\"], \"audioUrl\": \"https://example.com/audio.mp3\" }";
      connection.setDoOutput(true);
      DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
      wr.writeBytes(requestBody);
      wr.flush();
      wr.close();
      BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
      }
      in.close();
      System.out.println(response.toString());
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
}
var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://dashboard.360nrs.com/api/rest/voiceAudio',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  },
  'body': '{ "to": ["34666666666"], "audioUrl": "https://example.com/audio.mp3" }'
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/voiceAudio"

payload = "{ \"to\": [\"34666666666\"], \"audioUrl\": \"https://example.com/audio.mp3\" }"
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Basic YOUR_AUTH_TOKEN'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
require "uri"
require "net/http"

url = URI("https://dashboard.360nrs.com/api/rest/voiceAudio")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"
request.body = "{ \"to\": [\"34666666666\"], \"audioUrl\": \"https://example.com/audio.mp3\" }"

response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
  class HelloWorld {
    static void Main(string[] args) {
      var client = new RestClient("https://dashboard.360nrs.com/api/rest/voiceAudio");
      client.Timeout = -1;
      var request = new RestRequest(Method.POST);
      request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
      request.AddHeader("Content-Type", "application/json");
      request.AddParameter("application/json", "{ \"to\": [\"34666666666\"], \"audioUrl\": \"https://example.com/audio.mp3\" }",  ParameterType.RequestBody);
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

Response

HTTP Response Code 202 (ACCEPTED)

{
  "campaignId": 100000,
  "result": [
    {
      "accepted": true,
      "to": "34666666666",
      "id": "XXXXXXXXXXXXX",
      "scheduledAt": null,
      "expiresAt": null
    }
  ]
}

Error response (HTTP 400)

{
  "error": {
    "code": 102,
    "description": "No valid recipients"
  }
}

Parâmetros

Parâmetro Tipo Obrigatório Descrição
to array Sim Número do telemóvel destinatário da mensagem. Deve incluir o prefixo (Ex.: em Espanha 34666666666). Este campo permite-lhe especificar vários destinatários.
audioUrl string Sim URL del audio a enviar. Ejemplo: https://example.com/audio.mp3.
callers object Não Objeto com a lista de remetentes personalizados por país para usar na chamada. Se o remetente não for especificado para um país específico, o remetente padrão será usado. Para configurar um remetente personalizado, entre em contato com o departamento de suporte. Exemplo:

{"ES": "6123456789", "PT": "6987654321"}
scheduleDate string Não Data de envio da mensagem em formato UTC. Caso seja necessário enviar mensagens programadas é possível especificar a data de envio indicando a data no formato YYYYmmddHHiiss (Exemplo: 20130215142000 seria 15 de fevereiro de 2013 às 14:20:00). Em caso de envio imediato não é necessário especificar este parâmetro.
expirationDate string Não Permite determinar a data máxima na qual a chamada pode ser realizada. Após este prazo, a chamada será cancelada. Especificar o período de validade ativará automaticamente as tentativas de chamada, voltando a realizá-la caso o destinatário não atenda. A data deve ter o formato YYYYmmddHHiiss (Exemplo: 20130215142000 seria 15 de fevereiro de 2013 às 14:20:00)
campaignName string Não Nome da campanha. Caso seja especificado, será criada uma campanha com o nome indicado no painel de controlo, contendo as estatísticas do envio. Caso já exista uma campanha com este nome, as estatísticas de envio serão juntas à campanha existente.
tags array Não campaignName é necessário caso este parâmetro seja especificado. Lista de tags a juntar à campanha. As tags podem ser utilizadas para filtrar as estatísticas no painel do controlo.

Política de tentativas

O sistema de voz reage automaticamente às chamadas caso o destinatário não atender a chamada. Esta funcionalidade não gera custos acrescidos, uma vez que apenas as chamadas que sejam atendidas pelo destinatário serão cobradas.

Quando o sistema deteta que a chamada não tenha sido atendida, tentará novamente passados 30 minutos. O tempo decorrido desde a chamada não atendida para a tentativa irá variar consoante a lista de espera existente, mas será sempre superior a 30 minutos. Serão realizadas um máximo de 3 tentativas após a primeira chamada.

Para evitar que as novas tentativas sejam realizadas em horários indesejáveis é essencial especificar a variável opcional expirationDate de modo a ativar esta funcionalidade.

Voz Interactiva

Requisição envio de Voz Interactiva

POST https://dashboard.360nrs.com/api/rest/voice-interactive

Text to speech request

curl -X POST 'https://dashboard.360nrs.com/api/rest/voice-interactive' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
  "to": ["34699999999"],
  "campaignName": "Llamadas de prueba",
  "menu": {
    "gender": "M",
    "language": "es_ES",
    "message": "Esto es un test de llamada interactiva",
    "type": "speech"
  }
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/voice-interactive',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => '{
  "to": ["34699999999"],
  "campaignName": "Llamadas de prueba",
  "menu": {
    "gender": "M",
    "language": "es_ES",
    "message": "Esto es un test de llamada interactiva",
    "type": "speech"
  }
}',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Basic YOUR_AUTH_TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;

public class App {
  public static void main(String[] args) {
    try {
      URL url = new URL("https://dashboard.360nrs.com/api/rest/voice-interactive");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("POST");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      connection.setRequestProperty("Accept", "application/json");
      String requestBody = "{ \"to\": [\"34699999999\"], \"campaignName\": \"Llamadas de prueba\", \"menu\": { \"gender\": \"M\", \"language\": \"es_ES\", \"message\": \"Esto es un test de llamada interactiva\", \"type\": \"speech\" } }";
      connection.setDoOutput(true);
      DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
      wr.writeBytes(requestBody);
      wr.flush();
      wr.close();
      BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
      }
      in.close();
      System.out.println(response.toString());
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
}
var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://dashboard.360nrs.com/api/rest/voice-interactive',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  },
  'body': '{ "to": ["34699999999"], "campaignName": "Llamadas de prueba", "menu": { "gender": "M", "language": "es_ES", "message": "Esto es un test de llamada interactiva", "type": "speech" } }'
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/voice-interactive"

payload = "{ \"to\": [\"34699999999\"], \"campaignName\": \"Llamadas de prueba\", \"menu\": { \"gender\": \"M\", \"language\": \"es_ES\", \"message\": \"Esto es un test de llamada interactiva\", \"type\": \"speech\" } }"
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Basic YOUR_AUTH_TOKEN'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
require "uri"
require "net/http"

url = URI("https://dashboard.360nrs.com/api/rest/voice-interactive")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"
request.body = "{ \"to\": [\"34699999999\"], \"campaignName\": \"Llamadas de prueba\", \"menu\": { \"gender\": \"M\", \"language\": \"es_ES\", \"message\": \"Esto es un test de llamada interactiva\", \"type\": \"speech\" } }"

response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
  class HelloWorld {
    static void Main(string[] args) {
      var client = new RestClient("https://dashboard.360nrs.com/api/rest/voice-interactive");
      client.Timeout = -1;
      var request = new RestRequest(Method.POST);
      request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
      request.AddHeader("Content-Type", "application/json");
      request.AddParameter("application/json", "{ \"to\": [\"34699999999\"], \"campaignName\": \"Llamadas de prueba\", \"menu\": { \"gender\": \"M\", \"language\": \"es_ES\", \"message\": \"Esto es un test de llamada interactiva\", \"type\": \"speech\" } }",  ParameterType.RequestBody);
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

Send audio request

curl -X POST 'https://dashboard.360nrs.com/api/rest/voice-interactive' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
  "to": ["34699999999"],
  "campaignName": "Llamadas de prueba",
  "menu": {
    "url": "https://www.audio.com/audio.wav",
    "type": "audio"
  }
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/voice-interactive',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => '{
  "to": ["34699999999"],
  "campaignName": "Llamadas de prueba",
  "menu": {
    "url": "https://www.audio.com/audio.wav",
    "type": "audio"
  }
}',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Basic YOUR_AUTH_TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;

public class App {
  public static void main(String[] args) {
    try {
      URL url = new URL("https://dashboard.360nrs.com/api/rest/voice-interactive");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("POST");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      connection.setRequestProperty("Accept", "application/json");
      String requestBody = "{ \"to\": [\"34699999999\"], \"campaignName\": \"Llamadas de prueba\", \"menu\": { \"url\": \"https://www.audio.com/audio.wav\", \"type\": \"audio\" } }";
      connection.setDoOutput(true);
      DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
      wr.writeBytes(requestBody);
      wr.flush();
      wr.close();
      BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
      }
      in.close();
      System.out.println(response.toString());
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
}
var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://dashboard.360nrs.com/api/rest/voice-interactive',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  },
  'body': '{ "to": ["34699999999"], "campaignName": "Llamadas de prueba", "menu": { "url": "https://www.audio.com/audio.wav", "type": "audio" } }'
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/voice-interactive"

payload = "{ \"to\": [\"34699999999\"], \"campaignName\": \"Llamadas de prueba\", \"menu\": { \"url\": \"https://www.audio.com/audio.wav\", \"type\": \"audio\" } }"
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Basic YOUR_AUTH_TOKEN'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
require "uri"
require "net/http"

url = URI("https://dashboard.360nrs.com/api/rest/voice-interactive")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"
request.body = "{ \"to\": [\"34699999999\"], \"campaignName\": \"Llamadas de prueba\", \"menu\": { \"url\": \"https://www.audio.com/audio.wav\", \"type\": \"audio\" } }"

response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
  class HelloWorld {
    static void Main(string[] args) {
      var client = new RestClient("https://dashboard.360nrs.com/api/rest/voice-interactive");
      client.Timeout = -1;
      var request = new RestRequest(Method.POST);
      request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
      request.AddHeader("Content-Type", "application/json");
      request.AddParameter("application/json", "{ \"to\": [\"34699999999\"], \"campaignName\": \"Llamadas de prueba\", \"menu\": { \"url\": \"https://www.audio.com/audio.wav\", \"type\": \"audio\" } }",  ParameterType.RequestBody);
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

Complete request example

{
  "to": [
    "699999999"
  ],
  "campaignName": "Campaña de prueba",
  "menu": {
    "gender": "F",
    "language": "es_ES",
    "message": "Hola, elija una de las siguientes opciones: 1. Transferir con Comercial. 2. Valorar nuestra atención al cliente. 3. Agregar al Blacklist. 4. Repetir mensaje",
    "type": "speech",
    "menuOptions": [
      {
        "key": -1,
        "typeId": "Play",
        "data": {
          "gender": "M",
          "language": "es_ES",
          "message": "Ha elegido una opción incorrecta.",
          "type": "speech"
        }
      },
      {
        "key": 1,
        "typeId": "CallTransfer",
        "data": {
          "url": "http://www.audios.com/audio.wav",
          "type": "audio",
          "phone": "699999999",
          "phonePrefix": "34"
        }
      },
      {
        "key": 2,
        "typeId": "GetDataWhilePlaying",
        "data": {
          "gender": "M",
          "language": "es_ES",
          "message": "Puntúe del 1 al 5 nuestra atención al cliente.",
          "type": "speech"
        },
        "menu": {
          "gender": "M",
          "language": "es_ES",
          "message": "Puntúe del 1 al 5 nuestra atención al cliente.",
          "type": "speech",
          "menuOptions": [
            {
              "key": 1,
              "typeId": "Play",
              "data": {
                "gender": "M",
                "language": "es_ES",
                "message": "Gracias por valorar nuestra atención",
                "type": "speech"
              }
            },
            {
              "key": 2,
              "typeId": "Play",
              "data": {
                "gender": "M",
                "language": "es_ES",
                "message": "Gracias por valorar nuestra atención",
                "type": "speech"
              }
            },
            {
              "key": 3,
              "typeId": "Play",
              "data": {
                "gender": "M",
                "language": "es_ES",
                "message": "Gracias por valorar nuestra atención",
                "type": "speech"
              }
            },
            {
              "key": 4,
              "typeId": "Play",
              "data": {
                "gender": "M",
                "language": "es_ES",
                "message": "Gracias por valorar nuestra atención",
                "type": "speech"
              }
            },
            {
              "key": 5,
              "typeId": "Play",
              "data": {
                "gender": "M",
                "language": "es_ES",
                "message": "Gracias por valorar nuestra atención",
                "type": "speech"
              }
            }
          ]
        }
      },
      {
        "key": 3,
        "typeId": "AddToBlackList",
        "data": {
          "url": "http://www.audios.com/audio.wav",
          "type": "audio"
        }
      },
      {
        "key": 4,
        "typeId": "RepeatMessage"
      }
    ]
  }
}

Parâmetros

Parâmetro Tipo Obrigatório Descrição
to array Sim Destinatário do número de telemóvel da mensagem. Você deve incluir o prefixo (Ex: na Espanha 34666666666). Este campo permite que você indique vários destinatários.
callers object Não Objeto com uma lista de remetentes personalizados por país para utilizar na chamada. Se o remetente não for especificado para um país específico, o remetente padrão será utilizado. Para definir um remetente personalizado, entre em contacto com o departamento de suporte. Exemplo:

{"ES": "6123456789", "PT": "6987654321"}
scheduleDate string Não Data em que a mensagem foi enviada no formato UTC. Se precisar enviar mensagens programadas, você pode especificar a data de envio indicando a data no formato YYYYmmddHHiiss (Ex: 20130215142000 seria 15 de fevereiro de 2013 às 14:20:00). Em caso de envio imediato, este parâmetro não precisa ser especificado.
expirationDate string Não Permite determinar a data máxima em que a chamada pode ser feita. Após esse prazo, a ligação será cancelada. Especificar o período de validade ativará automaticamente as novas tentativas de chamada, que farão a chamada novamente se o destinatário não atender a chamada. A data deve estar no formato YYYYmmddHHiiss (Ex: 20130215142000 seria 15 de fevereiro de 2013 às 14h20).
campaignName string Sim Nome da campanha.
tags array Não campaignName é necessário se este parâmetro for especificado. Lista de tags para adicionar à campanha. As tags podem ser utilizadas para filtrar as estatísticas no painel.
sub array Não array com variáveis de substituição que serão aplicadas à mensagem.
menu object Sim Define a árvore do menu em seu discurso de abertura. Veja os parâmetros do menu.
speechRetries integer Não Número de vezes que a narração será repetida se o destinatário não interagir, valores possíveis na faixa de 1 a 10.
speechTimeoutSeconds integer Não Este é um tempo de espera em segundos antes de repetir a fala, depende do parâmetro speechRetries, pode ser um valor de 1 a 30.
callRetries integer Não Número de tentativas de chamada para destinatários, valores possíveis no intervalo de 1 a 10.
costLimit integer Não Limite de portes de envio em euros.Se o limite estabelecido for atingido, a campanha será pausada e você será avisado por email.
availableTimes array Não Indica os horários em que as chamadas serão feitas. Os objetos json são definidos na forma:

[{"day": 1, "from": "09:00", "to": "21:00"}]

day: é indicado um dia no intervalo de segunda a domingo, deve ser um número entre 1 e 7.
from: hora que define o início do intervalo de tempo no formato de 24 horas.
to: hora que define o fim do intervalo de tempo no formato de 24 horas.

Variáveis de substituição

Variáveis personalizadas podem ser indicadas no corpo da mensagem. Essas variáveis serão substituídas pelas variáveis personalizadas do contato ou pelas variáveis indicadas no parâmetro sub. Ao usar o sub-parâmetro, a matriz deve conter tantos itens quanto os destinatários de envio.

Parâmetros menu

Parámetro Tipo Obrigatório Descrição
type string Sim Define o tipo de fala se será a conversão de texto para áudio ou um ficheiro de áudio específico.
Os valores podem ser apenas: speech ou audio
Os parâmetros de message, language e gender serão necessários se 'speech' for especificado
O parâmetro url será necessário se o 'audio' for especificado
message string Não Mensagem de texto. Ele pode ter no máximo 500 caracteres. O texto deve ser codificado em UTF-8.
language string Não Idioma para converter o texto, as opções são:

'en_GB': Inglês - Reino Unido,
'en_US': Inglês - Estados Unidos,
'es_ES': Espanhol - Espanha,
'es_US': Espanhol - Latino,
'pt_PT': Português - Portugal,
'pt_BR': Português - Brasil,
'cmn_CN': Chinês mandarim - China *,
'arb': Árabe *,
'de_DE': Alemão - Alemanha,
'fr_FR': Francês - França,
'it_IT': Italiano - Itália,
'hi_IN': Indi - Índia *.

* Disponível apenas no gênero feminino.
gender string Não Género de voz, os valores permitidos são 'F' para voz feminina e 'M' para voz masculina.
url string Não URL de localização do ficheiro de áudio com esquema e nome de domínio, por exemplo: http://www.audios.com/audio.wav
O ficheiro de áudio deve ter a seguinte codificação:
Profundidade de bits: 16 bits
Taxa de amostragem: 8.000 Hz
Formato: wav
Canal: Mono
menuOptions array Não Você especifica se deseja adicionar opções ao menu de chamadas.
Se for especificado, não deve estar vazio e deve conter pelo menos duas opções, que correspondem a uma opção de erro ou omissão e pelo menos mais uma opção adicional, estas são explicadas na seção de parâmetros de opção de menu.
Cada uma dessas opções deve ser especificada como um objeto.

Parâmetros menuOptions

Parámetro Tipo Obrigatório Descrição
key integer Sim Tecla do telefone que o destinatário pode selcionar, pois a definição exclusiva da chamada é -1 e de 1 a 9 para as demais opções.
typeId string Sim Define os tipos de opções de menu, incluindo os seguintes tipos:
'Play': reproduz uma mensagem.
'CallTransfer': transferência de chamadas.
'GetDataWhilePlaying': submenu de chamada e coleta de dados, este tipo é obrigatório ao definir um menu para a opção.
'RepeatMessage': repete a mensagem atual.
'AddToBlackList': o destinatário é adicionado à lista negra do canal de voz interativo.
data object Sim Corresponde aos mesmos parâmetros de menu, com exceção do parâmetro menuOptions, e os parâmetros devem ser adicionados se typeId for CallTransfer:
'phone': corresponde ao número do telefone para transferir a chamada sem o prefixo.
'phonePrefix': corresponde ao prefixo do telefone para o qual a chamada será transferida.
menu object Não Obrigatório se typeId tiver sido especificado como 'GetDataWhilePlaying', corresponde aos parâmetros do menu incluindo menuOptions se você quiser configurá-lo, mas com a exceção de que suas subopções podem não conter mais um typeid igual a 'GetDataWhilePlaying', uma vez que só é permitido submenus até dois níveis.

Landing SMS

Requisição de envio de SMS

POST https://dashboard.360nrs.com/api/rest/landingsms

curl -X POST 'https://dashboard.360nrs.com/api/rest/landingsms' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
  "to": ["34666555444"],
  "message": "TEST API LANDING {LAND_URL}",
  "from": "LANDINGAPI",
  "templateBody": "<html><head><title>LANDING TEST</title></head><body><h1>HELLO LANDING</h1></body></html>"
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/landingsms',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => '{
  "to": ["34666555444"],
  "message": "TEST API LANDING {LAND_URL}",
  "from": "LANDINGAPI",
  "templateBody": "<html><head><title>LANDING TEST</title></head><body><h1>HELLO LANDING</h1></body></html>"
}',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Basic YOUR_AUTH_TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;

public class App {
  public static void main(String[] args) {
    try {
      URL url = new URL("https://dashboard.360nrs.com/api/rest/landingsms");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("POST");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      connection.setRequestProperty("Accept", "application/json");
      String requestBody = "{ \"to\": [\"34666555444\"], \"message\": \"TEST API LANDING {LAND_URL}\", \"from\": \"LANDINGAPI\", \"templateBody\": \"<html><head><title>LANDING TEST</title></head><body><h1>HELLO LANDING</h1></body></html>\" }";
      connection.setDoOutput(true);
      DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
      wr.writeBytes(requestBody);
      wr.flush();
      wr.close();
      BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
      }
      in.close();
      System.out.println(response.toString());
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
}
var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://dashboard.360nrs.com/api/rest/landingsms',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  },
  'body': '{ "to": ["34666555444"], "message": "TEST API LANDING {LAND_URL}", "from": "LANDINGAPI", "templateBody": "<html><head><title>LANDING TEST</title></head><body><h1>HELLO LANDING</h1></body></html>" }'
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/landingsms"

payload = "{ \"to\": [\"34666555444\"], \"message\": \"TEST API LANDING {LAND_URL}\", \"from\": \"LANDINGAPI\", \"templateBody\": \"<html><head><title>LANDING TEST</title></head><body><h1>HELLO LANDING</h1></body></html>\" }"
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Basic YOUR_AUTH_TOKEN'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
require "uri"
require "net/http"

url = URI("https://dashboard.360nrs.com/api/rest/landingsms")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"
request.body = "{ \"to\": [\"34666555444\"], \"message\": \"TEST API LANDING {LAND_URL}\", \"from\": \"LANDINGAPI\", \"templateBody\": \"<html><head><title>LANDING TEST</title></head><body><h1>HELLO LANDING</h1></body></html>\" }"

response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
  class HelloWorld {
    static void Main(string[] args) {
      var client = new RestClient("https://dashboard.360nrs.com/api/rest/landingsms");
      client.Timeout = -1;
      var request = new RestRequest(Method.POST);
      request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
      request.AddHeader("Content-Type", "application/json");
      request.AddParameter("application/json", "{ \"to\": [\"34666555444\"], \"message\": \"TEST API LANDING {LAND_URL}\", \"from\": \"LANDINGAPI\", \"templateBody\": \"<html><head><title>LANDING TEST</title></head><body><h1>HELLO LANDING</h1></body></html>\" }",  ParameterType.RequestBody);
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

Response

HTTP Response Code 202 (ACCEPTED)

{
  "campaignId": 100000,
  "result": [
    {
      "accepted": true,
      "to": "34666555444",
      "id": "XXXXXXXXXXXXX",
      "parts": 1,
      "scheduledAt": null,
      "expiresAt": null
    }
  ]
}

HTTP Response Code 207 (MULTI-STATUS)

{
  "campaignId": 100000,
  "result": [
    {
      "accepted": true,
      "to": "34666555444",
      "id": "XXXXXXXXXXXXX",
      "parts": 1,
      "scheduledAt": null,
      "expiresAt": null
    },
    {
      "accepted": false,
      "to": "34",
      "error": {
        "code": 102,
        "description": "No valid recipients"
      }
    }
  ]
}

Error response (HTTP 400)

{
  "error": {
    "code": 102,
    "description": "No valid recipients"
  }
}

Parâmetros

Parâmetro Tipo Obrigatório Descrição
message string Sim Texto da mensagem. O máximo de caracteres permitidos são 160 se não for especificado que a mensagem é multipartes. (Veja parâmetro parts). O texto deverá receber a codificação UTF-8.
to array Sim Número do telefone móvel destinatário da mensagem. Deve-se incluir o prefixo do país destinatário. (Exemplo Brasil 5511966778899). Pode-se especificar diversos destinatários através deste parâmetro.
from string Sim Nome do remetente da mensagem, este parâmetro é formado por 15 caracteres numéricos ou 11 caracteres alfanuméricos. Não é permitida a utilização de caracteres especiais.
encoding string Não Os valores possíveis são 'gsm', 'gsm-pt' e 'utf-16'. O valor gsm deve ser utilizado para envios convencionais na codificação GSM7 com até 160 caracteres por mensagem. O valor utf-16 deve ser utilizado para envios com caracteres especiais na codificação UCS2 (UTF16) com até 70 caracteres por mensagem. O valor padrão deste parâmetro é gsm.
scheduleDate string Não Data de envio das mensagens no UTC. Para envios de mensagens programadas, é possível especificar a data e hora do envio no formato YYYYmmddHHiiss (Exemplo: 20130215142000 seria 15 de fevereiro de 2013 às 14:20). Para envios imediatos, não especifique este parâmetro.
expirationDate string Não Data de validade das mensagens no UTC. Formato YYYYmmddHHiiss (Exemplo: 20130215142000 seria 15 de fevereiro de 2013 às 14:20).
parts integer Não Este parâmetro indica o número máximo de partes que a mensagem terá no momento do envio. O valor padrão deste parâmetro é 1. Caso este parâmetro não seja especificado, ao enviar uma mensagem com mais de 160 caracteres em codificação GSM ou 70 caracteres na codificação UTF16, o processamento da mensagem falhará. É preciso ter em conta que mensagens concatenadas em GSM são fracionadas em partes com até 153 caracteres cada e em UTF16 em 67. Cada parte será processada e tarifada distintamente, mas ao destinatário chegará como uma única mensagem com a indicação de paginação de acordo com as limitações de cada operadora local. Nosso servidor utilizará o mínimo de partes necessárias para processar a mensagem mesmo que seja indicado um valor alto de partes no parâmetro, caso o número indicado seja inferior ao necessário, o envio falhará e será retornado o código 105. O número máximo de partes permitidas é 8.
notificationUrl string Não URL que será feita a chamada GET com os parâmetros desejados de resposta.
trans integer Não Os valores disponíveis são 1 ou 0. Ao indiciar o valor 0 (este é o valor padrão caso o parâmetro não seja especificado) o servidor não realizará nenhuma alteração nos caracteres especiais da mensagem. Com o valor 1 indicado, o servidor fará a alteração dos caracteres especiais a caracteres comuns de acordo com a seguinte regra de tradução: 'á' => 'a', 'í'=>'i', 'ó'=>'o', 'ú'=>'u', 'ç'=>'Ç', 'Á'=>'A', 'Í'=>'I', 'Ó'=>'O', 'Ú'=>'U', 'À'=>'A', 'È'=>'E', 'Ì'=>'I', 'Ò'=>'O', 'Ù'=>'U', 'º' => '', 'ª' => '', 'Õ' => 'O', 'õ' => 'o', 'â' => 'a', 'ê' => 'e', 'î'=>'i', 'ô'=>'o', 'û'=>'u', ' '=>'A', 'Ê'=>'E', 'Î'=>'I', 'Ô'=>'O', 'Û'=>'U', 'ã' => 'a', 'Ã' => 'A'
campaignName string Não Nome da campanha Se especificado, uma campanha será criada com o nome indicado no painel que conterá as estatísticas de envio. Se uma campanha com este nome já existe, as estatísticas de entrega serão adicionadas à campanha existente.
tags array Não campaignName é necessário se este parâmetro for especificado. Lista de tags para adicionar à campanha. As tags podem ser usadas para filtrar as estatísticas no painel.
certified boolean Não Se for especificado como true, a mensagem será enviada como certificado. Mensagens certificadas têm custo adicional
sub array Não array com variáveis de substituição que serão aplicadas à mensagem.
splitParts boolean Não Para mensagens que excedem o tamanho máximo do SMS, o servidor dividirá a mensagem em vários SMS, em vez de usar o SMS concatenado. O valor padrão é false.
flash boolean Não Um flash SMS é uma mensagem que aparece diretamente na tela do dispositivo. Dependendo do modelo e do sistema operacional, é possível armazená-lo na caixa de entrada e enviar mensagens concatenadas.
templateBody string Não O conteúdo da página de destino em formato HTML e codificação UTF-8. Obrigatório sem templateId.
templateId integer Não ID do modelo para enviar como conteúdo da página de destino. Obrigatório sem templateBody.

Variáveis de substituição

Ao usar o sub-parâmetro, a matriz deve conter tantos itens quanto os destinatários de envio, usando o seguinte formato:

{
  "from": "TEST",
  "to": ["34666555444", "34666555333"],
  "message": "Hello {name}",
  "sub": [
    {"name": "first contact name"},
    {"name": "second contact name"}
  ]
}

Variáveis personalizadas podem ser indicadas no corpo da mensagem e no código HTML do modelo. Essas variáveis serão substituídas pelas variáveis personalizadas do contato ou pelas variáveis indicadas no parâmetro sub.

Filtros variáveis personalizados

É possível adicionar os seguintes filtros às variáveis personalizadas.

Filtro Descrição Ejemplo Resultado
lower Retornar texto em minúsculas. {name|lower} my name
upper Retornar texto em maiúsculas. {name|upper} MY NAME
capitalize Retorne o texto com a primeira letra da primeira palavra em maiúsculas. {name|capitalize} My name
capitalizeAll Retorne o texto com a primeira letra de cada palavra em maiúsculas. {name|capitalizeAll} My Name
formatDotComma Retorna o número com um ponto como separador de milhares y vírgula como separador de decimais. {number|formatDotComma} 1.234,56
formatCommaDot Retorna o número com uma vírgula como separador de milhares y ponto como separador de decimais. {number|formatCommaDot} 1,234.56
shorten Retorna um url encurtado. Deve ser um URL válido. {url|shorten} https://nrs.so/xxxxxx

Mensagens programadas

Listar

GET https://dashboard.360nrs.com/api/rest/scheduled

curl -X GET 'https://dashboard.360nrs.com/api/rest/scheduled' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/scheduled',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Basic YOUR_AUTH_TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;

public class App {
  public static void main(String[] args) {
    try {
      URL url = new URL("https://dashboard.360nrs.com/api/rest/scheduled");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("GET");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      connection.setRequestProperty("Accept", "application/json");
      BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
      }
      in.close();
      System.out.println(response.toString());
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
}
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://dashboard.360nrs.com/api/rest/scheduled',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/scheduled"

payload = {}
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Basic YOUR_AUTH_TOKEN'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
require "uri"
require "net/http"

url = URI("https://dashboard.360nrs.com/api/rest/scheduled")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"

response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
  class HelloWorld {
    static void Main(string[] args) {
      var client = new RestClient("https://dashboard.360nrs.com/api/rest/scheduled");
      client.Timeout = -1;
      var request = new RestRequest(Method.GET);
      request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
      request.AddHeader("Content-Type", "application/json");
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

Response

Multi GUID

{
  "result": [
    {
      "guid": "100",
      "type": "SMS",
      "created_at": "2017-09-18 10:49:12",
      "updated_at": "2017-09-18 10:49:12",
      "scheduled_at": "2017-11-11 10:10:10"
    },
    {
      "guid": "101",
      "type": "SMS",
      "created_at": "2017-09-18 10:49:12",
      "updated_at": "2017-09-18 10:49:12",
      "scheduled_at": "2017-11-11 10:10:10"
    },
    {
      "guid": "102",
      "type": "SMS",
      "created_at": "2017-09-18 10:49:12",
      "updated_at": "2017-09-18 10:49:12",
      "scheduled_at": "2017-11-11 10:10:10"
    }
  ],
  "total": 3
}

Single GUID

{
  "result": {
    "guid": "100",
    "type": "SMS",
    "content": "Contenido del SMS",
    "created_at": "2017-09-18 10:49:12",
    "updated_at": "2017-09-18 10:49:12",
    "scheduled_at": "2017-11-11 10:10:10"
  },
  "total": 1
}

Podem-se filtrar todos os envios programados. A lista poderá ser filtrada por tipo de envio (SMS ou MAILING) e também por GUID, relação de GUIDs ou para todos.

O conteúdo da mensagem não é mostrado na lista a não ser que seja especificado um único GUID.

Parâmetro Tipo Obrigatório Descrição
guid integer, array Não Identificador único de cada uma das mensagens Podem-se indicar diversos guids agrupados num array ou nenhum para visualizar todos.
type string Não SMS o MAILING

Atualização

PUT https://dashboard.360nrs.com/api/rest/scheduled

curl -X PUT 'https://dashboard.360nrs.com/api/rest/scheduled' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
  "guid": [100,101],
  "scheduleDate": "20171011093000"
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/scheduled',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'PUT',
  CURLOPT_POSTFIELDS => '{
  "guid": [100,101],
  "scheduleDate": "20171011093000"
}',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Basic YOUR_AUTH_TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;

public class App {
  public static void main(String[] args) {
    try {
      URL url = new URL("https://dashboard.360nrs.com/api/rest/scheduled");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("PUT");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      connection.setRequestProperty("Accept", "application/json");
      String requestBody = "{ \"guid\": [100,101], \"scheduleDate\": \"20171011093000\" }";
      connection.setDoOutput(true);
      DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
      wr.writeBytes(requestBody);
      wr.flush();
      wr.close();
      BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
      }
      in.close();
      System.out.println(response.toString());
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
}
var request = require('request');
var options = {
  'method': 'PUT',
  'url': 'https://dashboard.360nrs.com/api/rest/scheduled',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  },
  'body': '{ "guid": [100,101], "scheduleDate": "20171011093000" }'
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/scheduled"

payload = "{ \"guid\": [100,101], \"scheduleDate\": \"20171011093000\" }"
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Basic YOUR_AUTH_TOKEN'
}

response = requests.request("PUT", url, headers=headers, data=payload)

print(response.text)
require "uri"
require "net/http"

url = URI("https://dashboard.360nrs.com/api/rest/scheduled")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Put.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"
request.body = "{ \"guid\": [100,101], \"scheduleDate\": \"20171011093000\" }"

response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
  class HelloWorld {
    static void Main(string[] args) {
      var client = new RestClient("https://dashboard.360nrs.com/api/rest/scheduled");
      client.Timeout = -1;
      var request = new RestRequest(Method.PUT);
      request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
      request.AddHeader("Content-Type", "application/json");
      request.AddParameter("application/json", "{ \"guid\": [100,101], \"scheduleDate\": \"20171011093000\" }",  ParameterType.RequestBody);
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

Response

{
  "result": true,
  "updated": 2
}

Atualiza a data de programação de um, vários ou todos os envios programados. Pode-se filtrar por GUID e/ou tipo de envio.

Parâmetro Tipo Obrigatório Descrição
guid integer, array Não Identificador del mensaje o mensajes. Se le puede pasar un identificador, un array de identificadores o ninguno para mostrarlos todos.
type string Não SMS o MAILING
scheduleDate string Sim Fecha de envío del mensaje en formato UTC. Si se necesita enviar mensajes programados se puede especificar la fecha de envío indicando la fecha en formato YYYYmmddHHiiss (Ej: 20130215142000 sería el 15 de febrero de 2013 a las 14:20:00). En caso de envío inmediato no se tiene que especificar este parámetro.

Eliminar

DELETE https://dashboard.360nrs.com/api/rest/scheduled

curl -X DELETE 'https://dashboard.360nrs.com/api/rest/scheduled' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
  "guid": [100, 101]
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/scheduled',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'DELETE',
  CURLOPT_POSTFIELDS => '{
  "guid": [100, 101]
}',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Basic YOUR_AUTH_TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;

public class App {
  public static void main(String[] args) {
    try {
      URL url = new URL("https://dashboard.360nrs.com/api/rest/scheduled");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("DELETE");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      connection.setRequestProperty("Accept", "application/json");
      String requestBody = "{ \"guid\": [100, 101] }";
      connection.setDoOutput(true);
      DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
      wr.writeBytes(requestBody);
      wr.flush();
      wr.close();
      BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
      }
      in.close();
      System.out.println(response.toString());
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
}
var request = require('request');
var options = {
  'method': 'DELETE',
  'url': 'https://dashboard.360nrs.com/api/rest/scheduled',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  },
  'body': '{ "guid": [100, 101] }'
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/scheduled"

payload = "{ \"guid\": [100, 101] }"
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Basic YOUR_AUTH_TOKEN'
}

response = requests.request("DELETE", url, headers=headers, data=payload)

print(response.text)
require "uri"
require "net/http"

url = URI("https://dashboard.360nrs.com/api/rest/scheduled")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Delete.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"
request.body = "{ \"guid\": [100, 101] }"

response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
  class HelloWorld {
    static void Main(string[] args) {
      var client = new RestClient("https://dashboard.360nrs.com/api/rest/scheduled");
      client.Timeout = -1;
      var request = new RestRequest(Method.DELETE);
      request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
      request.AddHeader("Content-Type", "application/json");
      request.AddParameter("application/json", "{ \"guid\": [100, 101] }",  ParameterType.RequestBody);
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

Response

{
  "result": true,
  "deleted": 2
}

Elimine um, vários ou todos os envios programados. Pode-se filtrar por um ou vários GUID ou nenhum.

Parámetro Tipo Obligatorio Descripción
guid integer, array Não Identificador único de cada uma das mensagens. Podem-se indicar diversos guids agrupados num array ou nenhum para deletar todos.
type string Não SMS o MAILING

Lista de campanhas

GET https://dashboard.360nrs.com/api/rest/campaigns

curl -X GET 'https://dashboard.360nrs.com/api/rest/campaigns' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/campaigns',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Basic YOUR_AUTH_TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;

public class App {
  public static void main(String[] args) {
    try {
      URL url = new URL("https://dashboard.360nrs.com/api/rest/campaigns");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("GET");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      connection.setRequestProperty("Accept", "application/json");
      BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
      }
      in.close();
      System.out.println(response.toString());
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
}
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://dashboard.360nrs.com/api/rest/campaigns',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/campaigns"

payload = {}
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Basic YOUR_AUTH_TOKEN'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
require "uri"
require "net/http"

url = URI("https://dashboard.360nrs.com/api/rest/campaigns")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"

response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
  class HelloWorld {
    static void Main(string[] args) {
      var client = new RestClient("https://dashboard.360nrs.com/api/rest/campaigns");
      client.Timeout = -1;
      var request = new RestRequest(Method.GET);
      request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
      request.AddHeader("Content-Type", "application/json");
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

Response

{
  "data": [
    {
      "id": 1,
      "name": "My campaign",
      "type": "basic",
      "createdAt": "2018-12-27T11:31:16+00:00",
      "updatedAt": "2018-12-27T11:31:16+00:00",
      "links": {
        "self": "https://dashboard.360nrs.com/api/rest/campaigns/1",
        "sendings": "https://dashboard.360nrs.com/api/rest/campaigns/1/sendings"
      },
      "sendings": {
        "data": [
          {
            "id": 1,
            "campaignName": "My campaign",
            "status": "OPENED",
            "channel": "sms",
            "total": 2,
            "processed": 2,
            "totalSmsParts": 4,
            "cost": 0.02,
            "currency": "EUR",
            "tags": [],
            "scheduledAt": null,
            "expiresAt": null,
            "startedAt": null,
            "finishedAt": null,
            "createdAt": "2018-12-27T11:31:16+00:00",
            "updatedAt": "2018-12-27T11:31:22+00:00",
            "events": {
              "delivered": 2,
              "opened": 0,
              "opened_unique": 0,
              "clicked": 0,
              "clicked_unique": 0,
              "unsubscribed": 0,
              "hard_bounced": 0,
              "complaint": 0,
              "sent": 2,
              "soft_bounced": 0,
              "undelivered": 0,
              "rejected": 0,
              "expired": 0,
              "unsubscribed_landing": 0
            },
            "links": {
              "self": "https://dashboard.360nrs.com/api/rest/sendings/1",
              "eventsReport": "https://dashboard.360nrs.com/api/rest/sendings/1/reports/events"
            }
          }
        ]
      }
    }
  ]
}

Filtros

Parâmetro Descrição
name Filtrar por nome da campanha. É possível usar o caractere "*" como "wildcard". Exemplo: ?name=CAMPAIGN_2020_*
channel Filtrar por canal. Valores disponíveis: sms, mailing, landing, text2speech. Exemplo: ?channel=sms.
beforeDate Mostrar resultados antes da data indicada. A data deve ser especificada no formato ISO 8601. Exemplo: ?beforeDate=2019-01-01T00%3A00%3A00%2B00%3A00.
afterDate Mostrar resultados após a data indicada. A data deve ser especificada no formato ISO 8601. Exemplo: ?afterDate=2019-01-01T00%3A00%3A00%2B00%3A00.

Os parâmetros devem ser codificados corretamente (urlencode) em relação ao padrão RFC 3986 para serem suportados pelo servidor.

Campos da resposta

Parâmetro Descrição
name Nome da campanha.
type Tipo de campanha. Valores possíveis: basic, automatic, trigger, testab.
sendings Listagem dos envios associadas na campanha. Para campanhas de tipo basic e automatic O número de envios será sempre 1.
sendings.*.status Status do envio. Valores possíveis:
PENDING: Envio agendado para uma data futura.
SAVED: Envio salvo. Não será enviado até que a campanha seja confirmada na plataforma.
SENDING: Envio em processamento.
PAUSED: Envio pausado.
FINISHED: Envio finalizado.
CANCELLED: Envio cancelado.
EDITING: O envio está sendo editado na plataforma.
OPENED: Os envios por API informarão esse status. Indica que o envio pode aceitar mais mensagens.
AUTOMATED: Envio automatizado aguardando que as condições de automação sejam alcançadas.
WAITING: Envio trigger aguardando que as condições de envio sejam alcançadas.
sendings.*.channel Canal do envio. Valores possíveis: sms, mailing, landing y text2speech.
sendings.*.total Total de mensagens a serem enviadas.
sendings.*.processed Total de mensagens enviadas.
sendings.*.totalSmsParts Aplicável apenas aos envios de SMS. No caso de envios concatenados, será indicado o número de partes de SMS enviadas.
sendings.*.cost Custo do envio.
sendings.*.currency Código da moeda para o custo.
sendings.*.tags Tags atribuídas ao envio.
sendings.*.scheduledAt Data de programação da campanha. Nenhuma mensagem será enviada antes desta data.
sendings.*.expiresAt Data de expiração da campanha. Após essa data, nenhuma outra mensagem será enviada.
sendings.*.events Resumo dos totais de eventos produzidos no envio. Eventos:
delivered: A mensagem foi entregue ao contato.
opened: O contato abriu a mensagem. Não aplicável a sms e text2speech.
opened_unique: Total de aberturas únicas. Não aplicável a sms e text2speech.
clicked: O contato clicou em um link incluído na mensagem. Não aplicável a sms e text2speech.
clicked_unique: Total de cliques únicos. Não aplicável a sms e text2speech.
unsubscribed: O contato solicitou a baixa da lista.
hard_bounced: Total hard bounces gerado pela campanha. Aplicável apenas ao envio de emails.
complaint: O contato marcou a mensagem como indesejada.
sent: A mensagen foi enviada ao contato.
soft_bounced: Total soft bounces gerado pela campanha. Aplicável apenas ao envio de emails.
undelivered: Não foi possível entregar a mensagem ao contato.
rejected: A tentativa de enviar a mensagem foi rejeitada.
expired: A mensagem foi rejeitada devido a que a data de expiração da campanha já foi alcançada.
unsubscribed_landing: O contato solicitou a baixa usando a landing page incluída na mensagem.

Bancos de dados

Contactos

Lista de contactos

GET https://dashboard.360nrs.com/api/rest/contacts

curl -X GET 'https://dashboard.360nrs.com/api/rest/contacts?include=customFields,groups' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/contacts?include=customFields,groups',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Basic YOUR_AUTH_TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;

public class App {
  public static void main(String[] args) {
    try {
      URL url = new URL("https://dashboard.360nrs.com/api/rest/contacts?include=customFields,groups");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("GET");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      connection.setRequestProperty("Accept", "application/json");
      BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
      }
      in.close();
      System.out.println(response.toString());
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
}
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://dashboard.360nrs.com/api/rest/contacts?include=customFields,groups',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/contacts?include=customFields,groups"

payload = {}
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Basic YOUR_AUTH_TOKEN'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
require "uri"
require "net/http"

url = URI("https://dashboard.360nrs.com/api/rest/contacts?include=customFields,groups")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"

response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
  class HelloWorld {
    static void Main(string[] args) {
      var client = new RestClient("https://dashboard.360nrs.com/api/rest/contacts?include=customFields,groups");
      client.Timeout = -1;
      var request = new RestRequest(Method.GET);
      request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
      request.AddHeader("Content-Type", "application/json");
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

Response

{
  "data": [
    {
      "id": 1,
      "email": "email@example.com",
      "phone": "34666666666",
      "countryIso": "ES",
      "landline": "900222222",
      "name": "Name",
      "surname": "Last name",
      "createdAt": "2018-03-13T14:32:25+00:00",
      "updatedAt": "2018-07-04T13:57:09+00:00",
      "customFields": {
        "data": [
          {
            "key": "color",
            "type": "string",
            "value": "green"
          }
        ]
      },
      "groups": {
        "data": [
          {
            "id": 1,
            "name": "My Contact List"
          }
        ]
      }
    }
  ],
  "meta": {
    "pagination": {
      "total": 500,
      "count": 100,
      "per_page": 100,
      "current_page": 1,
      "total_pages": 5,
      "links": {
        "next": "https://dashboard.360nrs.com/api/rest/contacts?include=customFields%2Cgroups&page=2"
      }
    }
  }
}

Filtros

Parâmetro Descrição
limit Total de contactos a exibir num único pedido. Valor por defeito: 100. Máximo: 1000.
include Incluir os sub-recursos associados na resposta. É possível especificar vários valores separando-os por vírgulas. Valores disponíveis: customFields, groups, blacklist.
email Pesquisa do contacto com o e-mail especificado: ?email=myemail@example.com.
phone Pesquisa do contacto com o telefone especificado: ?phone=34666666666.
landline Pesquisa do contacto com o telefone fixo especificado: ?landline=900222222.
countryIso Filtrar os contactos para um determinado país: ?countryIso=ES.
blacklist Filtrar os contactos que se encontrem em alguma das seguintes listas negras. É possível indicar vários valores separados por vírgulas. Valores disponíveis: any, none, sms, mailing, landing, text2speech.

Mostrar um contacto

GET https://dashboard.360nrs.com/api/rest/contacts/<ID>

curl -X GET 'https://dashboard.360nrs.com/api/rest/contacts/1?include=customFields,groups' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/contacts/1?include=customFields,groups',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Basic YOUR_AUTH_TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;

public class App {
  public static void main(String[] args) {
    try {
      URL url = new URL("https://dashboard.360nrs.com/api/rest/contacts/1?include=customFields,groups");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("GET");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      connection.setRequestProperty("Accept", "application/json");
      BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
      }
      in.close();
      System.out.println(response.toString());
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
}
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://dashboard.360nrs.com/api/rest/contacts/1?include=customFields,groups',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/contacts/1?include=customFields,groups"

payload = {}
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Basic YOUR_AUTH_TOKEN'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
require "uri"
require "net/http"

url = URI("https://dashboard.360nrs.com/api/rest/contacts/1?include=customFields,groups")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"

response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
  class HelloWorld {
    static void Main(string[] args) {
      var client = new RestClient("https://dashboard.360nrs.com/api/rest/contacts/1?include=customFields,groups");
      client.Timeout = -1;
      var request = new RestRequest(Method.GET);
      request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
      request.AddHeader("Content-Type", "application/json");
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

Response

{
  "data": {
    "id": 1,
    "email": "email@example.com",
    "phone": "34666666666",
    "countryIso": "ES",
    "landline": "900222222",
    "name": "Name",
    "surname": "Last name",
    "createdAt": "2018-03-13T14:32:25+00:00",
    "updatedAt": "2018-07-04T13:57:09+00:00",
    "customFields": {
      "data": [
        {
          "key": "color",
          "type": "string",
          "value": "green"
        }
      ]
    },
    "groups": {
      "data": [
        {
          "id": 1,
          "name": "My Contact List"
        }
      ]
    }
  }
}

Filtros

Parâmetro Descrição
include Incluir os sub-recursos associados na resposta. É possível especificar vários valores separando-os por vírgulas. Valores disponíveis: customFields, groups, blacklist.

Criar um novo contacto

POST https://dashboard.360nrs.com/api/rest/contacts

curl -X POST 'https://dashboard.360nrs.com/api/rest/contacts' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
    "email": "new.contact@example.com",
    "phone": "3466666666",
    "countryIso": "ES",
    "groupsNames": ["My contact list"],
    "customFields": [
        {
            "key": "company",
            "value": "ACME inc."
        }
    ]
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/contacts',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => '{
    "email": "new.contact@example.com",
    "phone": "3466666666",
    "countryIso": "ES",
    "groupsNames": ["My contact list"],
    "customFields": [
        {
            "key": "company",
            "value": "ACME inc."
        }
    ]
}',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Basic YOUR_AUTH_TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;

public class App {
  public static void main(String[] args) {
    try {
      URL url = new URL("https://dashboard.360nrs.com/api/rest/contacts");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("POST");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      connection.setRequestProperty("Accept", "application/json");
      String requestBody = "{ \"email\": \"new.contact@example.com\", \"phone\": \"3466666666\", \"countryIso\": \"ES\", \"groupsNames\": [\"My contact list\"], \"customFields\": [ { \"key\": \"company\", \"value\": \"ACME inc.\" } ] }";
      connection.setDoOutput(true);
      DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
      wr.writeBytes(requestBody);
      wr.flush();
      wr.close();
      BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
      }
      in.close();
      System.out.println(response.toString());
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
}
var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://dashboard.360nrs.com/api/rest/contacts',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  },
  'body': '{ "email": "new.contact@example.com", "phone": "3466666666", "countryIso": "ES", "groupsNames": ["My contact list"], "customFields": [ { "key": "company", "value": "ACME inc." } ] }'
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/contacts"

payload = "{ \"email\": \"new.contact@example.com\", \"phone\": \"3466666666\", \"countryIso\": \"ES\", \"groupsNames\": [\"My contact list\"], \"customFields\": [ { \"key\": \"company\", \"value\": \"ACME inc.\" } ] }"
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Basic YOUR_AUTH_TOKEN'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
require "uri"
require "net/http"

url = URI("https://dashboard.360nrs.com/api/rest/contacts")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"
request.body = "{ \"email\": \"new.contact@example.com\", \"phone\": \"3466666666\", \"countryIso\": \"ES\", \"groupsNames\": [\"My contact list\"], \"customFields\": [ { \"key\": \"company\", \"value\": \"ACME inc.\" } ] }"

response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
  class HelloWorld {
    static void Main(string[] args) {
      var client = new RestClient("https://dashboard.360nrs.com/api/rest/contacts");
      client.Timeout = -1;
      var request = new RestRequest(Method.POST);
      request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
      request.AddHeader("Content-Type", "application/json");
      request.AddParameter("application/json", "{ \"email\": \"new.contact@example.com\", \"phone\": \"3466666666\", \"countryIso\": \"ES\", \"groupsNames\": [\"My contact list\"], \"customFields\": [ { \"key\": \"company\", \"value\": \"ACME inc.\" } ] }",  ParameterType.RequestBody);
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

Response (HTTP 201)

{
  "data": {
    "id": 1,
    "email": "new.contact@example.com",
    "phone": "3466666666",
    "countryIso": "ES",
    "landline": null,
    "name": null,
    "surname": null,
    "createdAt": "2018-03-13T14:32:25+00:00",
    "updatedAt": "2018-03-13T14:32:25+00:00",
    "links": {
      "self": "https://dashboard.360nrs.com/api/rest/contacts/1"
    }
  }
}

Error response

{
  "error": {
    "code": 422,
    "description": "The email field is required."
  }
}

Parâmetros

Parâmetro Tipo Obrigatório Descrição
email string Obrigatório quando o phone ou landline não é especificado. E-mail do novo contacto.
phone string Obrigatório quando email ou landline não for especificado. Número de telemóvel do contacto.
landline string Obrigatório quando email ou phone não for especificado. Número de telefone fixo do contacto.
countryIso string Obrigatório quando phone ou landline não for especificado. ISO code de 2 letras del país del contacto.
groupsIds array Obrigatório de groupsNames não for especificado. Lista de grupos aos quais será adicionado o novo contacto. Para obter as ids de grupos, consultar a documentação para o endpoint correspondente.
groupsNames array Obrigatório se groupsIds não for especificado. Em alternativa, caso não disponha da lista de IDs de grupos, é possível especificar uma lista com os nomes dos grupos aos quais será adicionado o contacto.
name string Não Nome do contacto.
surname string Não Apelidos do contacto.
customFields[]key string Não Nome do campo personalizado a adicionar.
customFields[]type string Não Tipo do campo personalizado. Valores possíveis: string, date, decimal. Para utilizar um campo, o valor deverá estar no formato ISO8601. Valor por defeito: string
customFields[]value string Não Valor do campo personalizado.

Atualizar um contacto

PUT https://dashboard.360nrs.com/api/rest/contacts/<ID>

curl -X PUT 'https://dashboard.360nrs.com/api/rest/contacts/1' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
    "email": "new.contact@example.com",
    "phone": "3466666666",
    "countryIso": "ES",
    "groupsNames": ["My contact list"],
    "customFields": [
        {
            "key": "company",
            "value": "ACME inc."
        }
    ]
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/contacts/1',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'PUT',
  CURLOPT_POSTFIELDS => '{
    "email": "new.contact@example.com",
    "phone": "3466666666",
    "countryIso": "ES",
    "groupsNames": ["My contact list"],
    "customFields": [
        {
            "key": "company",
            "value": "ACME inc."
        }
    ]
}',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Basic YOUR_AUTH_TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;

public class App {
  public static void main(String[] args) {
    try {
      URL url = new URL("https://dashboard.360nrs.com/api/rest/contacts/1");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("PUT");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      connection.setRequestProperty("Accept", "application/json");
      String requestBody = "{ \"email\": \"new.contact@example.com\", \"phone\": \"3466666666\", \"countryIso\": \"ES\", \"groupsNames\": [\"My contact list\"], \"customFields\": [ { \"key\": \"company\", \"value\": \"ACME inc.\" } ] }";
      connection.setDoOutput(true);
      DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
      wr.writeBytes(requestBody);
      wr.flush();
      wr.close();
      BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
      }
      in.close();
      System.out.println(response.toString());
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
}
var request = require('request');
var options = {
  'method': 'PUT',
  'url': 'https://dashboard.360nrs.com/api/rest/contacts/1',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  },
  'body': '{ "email": "new.contact@example.com", "phone": "3466666666", "countryIso": "ES", "groupsNames": ["My contact list"], "customFields": [ { "key": "company", "value": "ACME inc." } ] }'
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/contacts/1"

payload = "{ \"email\": \"new.contact@example.com\", \"phone\": \"3466666666\", \"countryIso\": \"ES\", \"groupsNames\": [\"My contact list\"], \"customFields\": [ { \"key\": \"company\", \"value\": \"ACME inc.\" } ] }"
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Basic YOUR_AUTH_TOKEN'
}

response = requests.request("PUT", url, headers=headers, data=payload)

print(response.text)
require "uri"
require "net/http"

url = URI("https://dashboard.360nrs.com/api/rest/contacts/1")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Put.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"
request.body = "{ \"email\": \"new.contact@example.com\", \"phone\": \"3466666666\", \"countryIso\": \"ES\", \"groupsNames\": [\"My contact list\"], \"customFields\": [ { \"key\": \"company\", \"value\": \"ACME inc.\" } ] }"

response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
  class HelloWorld {
    static void Main(string[] args) {
      var client = new RestClient("https://dashboard.360nrs.com/api/rest/contacts/1");
      client.Timeout = -1;
      var request = new RestRequest(Method.PUT);
      request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
      request.AddHeader("Content-Type", "application/json");
      request.AddParameter("application/json", "{ \"email\": \"new.contact@example.com\", \"phone\": \"3466666666\", \"countryIso\": \"ES\", \"groupsNames\": [\"My contact list\"], \"customFields\": [ { \"key\": \"company\", \"value\": \"ACME inc.\" } ] }",  ParameterType.RequestBody);
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

Response (HTTP 200)

{
  "data": {
    "id": 1,
    "email": "new.contact@example.com",
    "phone": "3466666666",
    "countryIso": "ES",
    "landline": null,
    "name": null,
    "surname": null,
    "createdAt": "2018-03-13T14:32:25+00:00",
    "updatedAt": "2018-03-13T14:32:25+00:00",
    "links": {
      "self": "https://dashboard.360nrs.com/api/rest/contacts/1"
    }
  }
}

Error response

{
  "error": {
    "code": 422,
    "description": "The email field is required."
  }
}

Parâmetros

Parâmetro Tipo Obrigatório Descrição
email string Obrigatório quando o phone ou landline não é especificado. E-mail do novo contacto.
phone string Obrigatório quando email ou landline não for especificado. Número de telemóvel do contacto.
landline string Obrigatório quando email ou phone não for especificado. Número de telefone fixo do contacto.
countryIso string Obrigatório quando phone ou landline não for especificado. ISO code de 2 letras del país del contacto.
groupsIds array Obrigatório de groupsNames não for especificado. Lista de grupos aos quais será adicionado o novo contacto. Para obter as ids de grupos, consultar a documentação para o endpoint correspondente.
groupsNames array Obrigatório se groupsIds não for especificado. Em alternativa, caso não disponha da lista de IDs de grupos, é possível especificar uma lista com os nomes dos grupos aos quais será adicionado o contacto.
name string Não Nome do contacto.
surname string Não Apelidos do contacto.
customFields[]key string Não Nome do campo personalizado a adicionar.
customFields[]type string Não Tipo do campo personalizado. Valores possíveis: string, date, decimal. Para utilizar um campo, o valor deverá estar no formato ISO8601. Valor por defeito: string.
customFields[]value string Não Valor do campo personalizado.

Eliminar um contacto

DELETE https://dashboard.360nrs.com/api/rest/contacts/<ID>

curl -X DELETE 'https://dashboard.360nrs.com/api/rest/contacts/1' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/contacts/1',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'DELETE',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Basic YOUR_AUTH_TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;

public class App {
  public static void main(String[] args) {
    try {
      URL url = new URL("https://dashboard.360nrs.com/api/rest/contacts/1");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("DELETE");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      connection.setRequestProperty("Accept", "application/json");
      BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
      }
      in.close();
      System.out.println(response.toString());
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
}
var request = require('request');
var options = {
  'method': 'DELETE',
  'url': 'https://dashboard.360nrs.com/api/rest/contacts/1',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/contacts/1"

payload = {}
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Basic YOUR_AUTH_TOKEN'
}

response = requests.request("DELETE", url, headers=headers, data=payload)

print(response.text)
require "uri"
require "net/http"

url = URI("https://dashboard.360nrs.com/api/rest/contacts/1")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Delete.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"

response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
  class HelloWorld {
    static void Main(string[] args) {
      var client = new RestClient("https://dashboard.360nrs.com/api/rest/contacts/1");
      client.Timeout = -1;
      var request = new RestRequest(Method.DELETE);
      request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
      request.AddHeader("Content-Type", "application/json");
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

Caso o pedido seja bem sucedido, responderá com um código HTTP 204.

Grupos

Lista de grupos

GET https://dashboard.360nrs.com/api/rest/groups

curl -X GET 'https://dashboard.360nrs.com/api/rest/groups' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/groups',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Basic YOUR_AUTH_TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;

public class App {
  public static void main(String[] args) {
    try {
      URL url = new URL("https://dashboard.360nrs.com/api/rest/groups");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("GET");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      connection.setRequestProperty("Accept", "application/json");
      BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
      }
      in.close();
      System.out.println(response.toString());
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
}
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://dashboard.360nrs.com/api/rest/groups',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/groups"

payload = {}
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Basic YOUR_AUTH_TOKEN'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
require "uri"
require "net/http"

url = URI("https://dashboard.360nrs.com/api/rest/groups")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"

response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
  class HelloWorld {
    static void Main(string[] args) {
      var client = new RestClient("https://dashboard.360nrs.com/api/rest/groups");
      client.Timeout = -1;
      var request = new RestRequest(Method.GET);
      request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
      request.AddHeader("Content-Type", "application/json");
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

Response

{
  "data": [
    {
      "id": 1,
      "name": "My contact list"
    }
  ],
  "meta": {
    "pagination": {
      "total": 500,
      "count": 100,
      "per_page": 100,
      "current_page": 1,
      "total_pages": 5,
      "links": {
        "next": "https://dashboard.360nrs.com/api/rest/groups?page=2"
      }
    }
  }
}

Filtros

Parâmetro Descrição
limit Total de contactos a exibir num único pedido. Valor por defeito: 100. Máximo: 1000.

Mostrar um grupo

GET https://dashboard.360nrs.com/api/rest/groups/<ID>

curl -X GET 'https://dashboard.360nrs.com/api/rest/groups/1' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/groups/1',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Basic YOUR_AUTH_TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;

public class App {
  public static void main(String[] args) {
    try {
      URL url = new URL("https://dashboard.360nrs.com/api/rest/groups/1");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("GET");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      connection.setRequestProperty("Accept", "application/json");
      BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
      }
      in.close();
      System.out.println(response.toString());
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
}
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://dashboard.360nrs.com/api/rest/groups/1',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/groups/1"

payload = {}
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Basic YOUR_AUTH_TOKEN'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
require "uri"
require "net/http"

url = URI("https://dashboard.360nrs.com/api/rest/groups/1")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"

response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
  class HelloWorld {
    static void Main(string[] args) {
      var client = new RestClient("https://dashboard.360nrs.com/api/rest/groups/1");
      client.Timeout = -1;
      var request = new RestRequest(Method.GET);
      request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
      request.AddHeader("Content-Type", "application/json");
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

Response

{
  "data": {
    "id": 1,
    "name": "My contact list"
  }
}

Filtros

Parâmetro Descrição
include Inclui sub-recursos associados na resposta. Você pode especificar vários valores, separando-os com vírgulas. Valores disponíveis: customFields, groups, blacklist.

Criar um novo grupo

POST https://dashboard.360nrs.com/api/rest/groups

curl -X POST 'https://dashboard.360nrs.com/api/rest/groups' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
    "name": "My new contact list"
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/groups',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => '{
    "name": "My new contact list"
}',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Basic YOUR_AUTH_TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;

public class App {
  public static void main(String[] args) {
    try {
      URL url = new URL("https://dashboard.360nrs.com/api/rest/groups");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("POST");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      connection.setRequestProperty("Accept", "application/json");
      String requestBody = "{ \"name\": \"My new contact list\" }";
      connection.setDoOutput(true);
      DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
      wr.writeBytes(requestBody);
      wr.flush();
      wr.close();
      BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
      }
      in.close();
      System.out.println(response.toString());
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
}
var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://dashboard.360nrs.com/api/rest/groups',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  },
  'body': '{ "name": "My new contact list" }'
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/groups"

payload = "{ \"name\": \"My new contact list\" }"
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Basic YOUR_AUTH_TOKEN'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
require "uri"
require "net/http"

url = URI("https://dashboard.360nrs.com/api/rest/groups")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"
request.body = "{ \"name\": \"My new contact list\" }"

response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
  class HelloWorld {
    static void Main(string[] args) {
      var client = new RestClient("https://dashboard.360nrs.com/api/rest/groups");
      client.Timeout = -1;
      var request = new RestRequest(Method.POST);
      request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
      request.AddHeader("Content-Type", "application/json");
      request.AddParameter("application/json", "{ \"name\": \"My new contact list\" }",  ParameterType.RequestBody);
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

Response (HTTP 201)

{
  "data": {
    "id": 1,
    "name": "My new contact list"
  }
}

Error response

{
  "error": {
    "code": 422,
    "description": "The name field is required."
  }
}

Parâmetros

Parâmetro Tipo Obrigatório Descrição
name string Sim Nome do novo grupo.

Atualizar um grupo

PUT https://dashboard.360nrs.com/api/rest/groups

curl -X PUT 'https://dashboard.360nrs.com/api/rest/groups' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
    "name": "My new contact list"
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/groups',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'PUT',
  CURLOPT_POSTFIELDS => '{
    "name": "My new contact list"
}',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Basic YOUR_AUTH_TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;

public class App {
  public static void main(String[] args) {
    try {
      URL url = new URL("https://dashboard.360nrs.com/api/rest/groups");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("PUT");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      connection.setRequestProperty("Accept", "application/json");
      String requestBody = "{ \"name\": \"My new contact list\" }";
      connection.setDoOutput(true);
      DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
      wr.writeBytes(requestBody);
      wr.flush();
      wr.close();
      BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
      }
      in.close();
      System.out.println(response.toString());
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
}
var request = require('request');
var options = {
  'method': 'PUT',
  'url': 'https://dashboard.360nrs.com/api/rest/groups',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  },
  'body': '{ "name": "My new contact list" }'
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/groups"

payload = "{ \"name\": \"My new contact list\" }"
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Basic YOUR_AUTH_TOKEN'
}

response = requests.request("PUT", url, headers=headers, data=payload)

print(response.text)
require "uri"
require "net/http"

url = URI("https://dashboard.360nrs.com/api/rest/groups")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Put.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"
request.body = "{ \"name\": \"My new contact list\" }"

response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
  class HelloWorld {
    static void Main(string[] args) {
      var client = new RestClient("https://dashboard.360nrs.com/api/rest/groups");
      client.Timeout = -1;
      var request = new RestRequest(Method.PUT);
      request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
      request.AddHeader("Content-Type", "application/json");
      request.AddParameter("application/json", "{ \"name\": \"My new contact list\" }",  ParameterType.RequestBody);
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

Response (HTTP 200)

{
  "data": {
    "id": 1,
    "name": "My new contact list"
  }
}

Error response

{
  "error": {
    "code": 422,
    "description": "The name field is required."
  }
}

Parâmetros

Parâmetro Tipo Obrigatório Descrição
name string Sim Nome do novo grupo.

Eliminar um grupo

DELETE https://dashboard.360nrs.com/api/rest/groups/<ID>

curl -X DELETE 'https://dashboard.360nrs.com/api/rest/groups/1' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/groups/1',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'DELETE',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Basic YOUR_AUTH_TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;

public class App {
  public static void main(String[] args) {
    try {
      URL url = new URL("https://dashboard.360nrs.com/api/rest/groups/1");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("DELETE");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      connection.setRequestProperty("Accept", "application/json");
      BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
      }
      in.close();
      System.out.println(response.toString());
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
}
var request = require('request');
var options = {
  'method': 'DELETE',
  'url': 'https://dashboard.360nrs.com/api/rest/groups/1',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/groups/1"

payload = {}
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Basic YOUR_AUTH_TOKEN'
}

response = requests.request("DELETE", url, headers=headers, data=payload)

print(response.text)
require "uri"
require "net/http"

url = URI("https://dashboard.360nrs.com/api/rest/groups/1")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Delete.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"

response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
  class HelloWorld {
    static void Main(string[] args) {
      var client = new RestClient("https://dashboard.360nrs.com/api/rest/groups/1");
      client.Timeout = -1;
      var request = new RestRequest(Method.DELETE);
      request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
      request.AddHeader("Content-Type", "application/json");
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

Caso o pedido seja bem sucedido, responderá com um código HTTP 204.

Validação de emails

Listar todas as validações

GET https://dashboard.360nrs.com/api/rest/validation/emails

curl -X GET 'https://dashboard.360nrs.com/api/rest/validation/emails' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/validation/emails',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Basic YOUR_AUTH_TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;

public class App {
  public static void main(String[] args) {
    try {
      URL url = new URL("https://dashboard.360nrs.com/api/rest/validation/emails");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("GET");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      connection.setRequestProperty("Accept", "application/json");
      BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
      }
      in.close();
      System.out.println(response.toString());
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
}
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://dashboard.360nrs.com/api/rest/validation/emails',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/validation/emails"

payload = {}
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Basic YOUR_AUTH_TOKEN'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
require "uri"
require "net/http"

url = URI("https://dashboard.360nrs.com/api/rest/validation/emails")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"

response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
  class HelloWorld {
    static void Main(string[] args) {
      var client = new RestClient("https://dashboard.360nrs.com/api/rest/validation/emails");
      client.Timeout = -1;
      var request = new RestRequest(Method.GET);
      request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
      request.AddHeader("Content-Type", "application/json");
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

Response (HTTP 200)

{
  "data": [
    {
      "id": 1,
      "status": "finished",
      "total": 10,
      "processed": 10,
      "valid": 9,
      "estimatedCost": 0.03,
      "cost": 0.03,
      "currency": "EUR",
      "createdAt": "2018-09-20T08:30:54+00:00",
      "updatedAt": "2018-09-20T08:31:00+00:00",
      "finishedAt": "2018-09-20T08:31:00+00:00",
      "resultUrl": "https://dashboard.360nrs.com/api/rest/validation/emails/1/result"
    }
  ],
  "meta": {
    "pagination": {
      "total": 500,
      "count": 100,
      "per_page": 100,
      "current_page": 1,
      "total_pages": 5,
      "links": {
        "next": "https://dashboard.360nrs.com/api/rest/validation/emails?page=2"
      }
    }
  }
}

Listar uma validação

GET https://dashboard.360nrs.com/api/rest/validation/emails/<ID>

curl -X GET 'https://dashboard.360nrs.com/api/rest/validation/emails/123' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/validation/emails/123',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Basic YOUR_AUTH_TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;

public class App {
  public static void main(String[] args) {
    try {
      URL url = new URL("https://dashboard.360nrs.com/api/rest/validation/emails/123");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("GET");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      connection.setRequestProperty("Accept", "application/json");
      BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
      }
      in.close();
      System.out.println(response.toString());
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
}
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://dashboard.360nrs.com/api/rest/validation/emails/123',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/validation/emails/123"

payload = {}
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Basic YOUR_AUTH_TOKEN'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
require "uri"
require "net/http"

url = URI("https://dashboard.360nrs.com/api/rest/validation/emails/123")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"

response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
  class HelloWorld {
    static void Main(string[] args) {
      var client = new RestClient("https://dashboard.360nrs.com/api/rest/validation/emails/123");
      client.Timeout = -1;
      var request = new RestRequest(Method.GET);
      request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
      request.AddHeader("Content-Type", "application/json");
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

Response (HTTP 200)

{
  "data": {
    "id": 1,
    "status": "finished",
    "total": 2,
    "processed": 2,
    "valid": 1,
    "estimatedCost": 0.007,
    "cost": 0.007,
    "currency": "EUR",
    "createdAt": "2018-09-20T08:30:54+00:00",
    "updatedAt": "2018-09-20T08:31:00+00:00",
    "finishedAt": "2018-09-20T08:31:00+00:00",
    "resultUrl": "https://dashboard.360nrs.com/api/rest/validation/emails/1/result"
  }
}

Resultados de uma validação (CSV)

GET https://dashboard.360nrs.com/api/rest/validation/emails/<ID>/result

curl -X GET 'https://dashboard.360nrs.com/api/rest/validation/emails/123/result' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/validation/emails/123/result',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Basic YOUR_AUTH_TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;

public class App {
  public static void main(String[] args) {
    try {
      URL url = new URL("https://dashboard.360nrs.com/api/rest/validation/emails/123/result");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("GET");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
      }
      in.close();
      System.out.println(response.toString());
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
}
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://dashboard.360nrs.com/api/rest/validation/emails/123/result',
  'headers': {
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/validation/emails/123/result"

payload = {}
headers = {
  'Authorization': 'Basic YOUR_AUTH_TOKEN'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
require "uri"
require "net/http"

url = URI("https://dashboard.360nrs.com/api/rest/validation/emails/123/result")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"

response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
  class HelloWorld {
    static void Main(string[] args) {
      var client = new RestClient("https://dashboard.360nrs.com/api/rest/validation/emails/123/result");
      client.Timeout = -1;
      var request = new RestRequest(Method.GET);
      request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

Response (HTTP 200)

email;result
valid@example.com;deliverable
notvalid@example.com;undeliverable
unknown@example.com;risky

Validar emails

POST https://dashboard.360nrs.com/api/rest/validation/emails

curl -X POST 'https://dashboard.360nrs.com/api/rest/validation/emails' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
    "groupsIds": [1111],
    "force": false,
    "notificationUrl": "https://example.com/notificationUrl"
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/validation/emails',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => '{
    "groupsIds": [1111],
    "force": false,
    "notificationUrl": "https://example.com/notificationUrl"
}',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Basic YOUR_AUTH_TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;

public class App {
  public static void main(String[] args) {
    try {
      URL url = new URL("https://dashboard.360nrs.com/api/rest/validation/emails");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("POST");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      connection.setRequestProperty("Accept", "application/json");
      String requestBody = "{ \"groupsIds\": [1111], \"force\": false, \"notificationUrl\": \"https://example.com/notificationUrl\" }";
      connection.setDoOutput(true);
      DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
      wr.writeBytes(requestBody);
      wr.flush();
      wr.close();
      BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
      }
      in.close();
      System.out.println(response.toString());
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
}
var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://dashboard.360nrs.com/api/rest/validation/emails',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  },
  'body': '{ "groupsIds": [1111], "force": false, "notificationUrl": "https://example.com/notificationUrl" }'
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/validation/emails"

payload = "{ \"groupsIds\": [1111], \"force\": false, \"notificationUrl\": \"https://example.com/notificationUrl\" }"
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Basic YOUR_AUTH_TOKEN'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
require "uri"
require "net/http"

url = URI("https://dashboard.360nrs.com/api/rest/validation/emails")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"
request.body = "{ \"groupsIds\": [1111], \"force\": false, \"notificationUrl\": \"https://example.com/notificationUrl\" }"

response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
  class HelloWorld {
    static void Main(string[] args) {
      var client = new RestClient("https://dashboard.360nrs.com/api/rest/validation/emails");
      client.Timeout = -1;
      var request = new RestRequest(Method.POST);
      request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
      request.AddHeader("Content-Type", "application/json");
      request.AddParameter("application/json", "{ \"groupsIds\": [1111], \"force\": false, \"notificationUrl\": \"https://example.com/notificationUrl\" }",  ParameterType.RequestBody);
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

Response

{
  "data": {
    "id": 2,
    "status": "pending",
    "total": 1,
    "processed": 0,
    "valid": 0,
    "estimatedCost": 0.0035,
    "cost": 0,
    "currency": "EUR",
    "createdAt": "2018-09-20T10:03:22+00:00",
    "updatedAt": "2018-09-20T10:03:22+00:00",
    "finishedAt": null,
    "resultUrl": null
  }
}

Deve realizar a validação da seguinte maneira, enviar uma solicitação indicando os IDs de grupo ou emails para validar um ou vários grupos ou um ou mais emails.

Se tudo correr bem, a solicitação retornará o status "pendente", o que significa que está enfileirado para ser processado.

Uma vez iniciado o processo de validação, será notificado com um status "iniciado" e, quando terminar, notificará com "concluído" com os dados, com o total de processados e o total de dados válidos, entre outros. Também na notificação "concluído", o URL será recebido para obter os detalhes completos.

Parâmetros

Parâmetro Tipo Obrigatório Descrição
groupsIds array Não (sempre que houver emails) Lista de grupos para validar (consultar grupos de terminais) dentro da API de contatos.
emails array Não (sempre que houver groupIds) Lista de emails para validar.
force boolean Não Se for true, serão verificados os emails que já foram verificados previamente. Valor padrão falso.
notificationUrl string Não URL de retorno em que serão recebidas as notificações de progresso(consulte o anexo de notificação)

Eliminar uma validação

DELETE https://dashboard.360nrs.com/api/rest/validation/emails/<ID>

curl -X DELETE 'https://dashboard.360nrs.com/api/rest/validation/emails/123' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/validation/emails/123',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'DELETE',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Basic YOUR_AUTH_TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;

public class App {
  public static void main(String[] args) {
    try {
      URL url = new URL("https://dashboard.360nrs.com/api/rest/validation/emails/123");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("DELETE");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      connection.setRequestProperty("Accept", "application/json");
      BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
      }
      in.close();
      System.out.println(response.toString());
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
}
var request = require('request');
var options = {
  'method': 'DELETE',
  'url': 'https://dashboard.360nrs.com/api/rest/validation/emails/123',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/validation/emails/123"

payload = {}
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Basic YOUR_AUTH_TOKEN'
}

response = requests.request("DELETE", url, headers=headers, data=payload)

print(response.text)
require "uri"
require "net/http"

url = URI("https://dashboard.360nrs.com/api/rest/validation/emails/123")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Delete.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"

response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
  class HelloWorld {
    static void Main(string[] args) {
      var client = new RestClient("https://dashboard.360nrs.com/api/rest/validation/emails/123");
      client.Timeout = -1;
      var request = new RestRequest(Method.DELETE);
      request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
      request.AddHeader("Content-Type", "application/json");
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

É possível excluir uma validação da sua lista de validações.

Caso o pedido seja bem sucedido, responderá com um código HTTP 204.

Exemplos de notificações

Notification STARTED

{
  "data": {
    "id": 2,
    "status": "started",
    "total": 1,
    "processed": 0,
    "valid": 0,
    "estimatedCost": 0.0035,
    "cost": 0.0035,
    "currency": "EUR",
    "createdAt": "2018-09-20T10:03:22+00:00",
    "updatedAt": "2018-09-20T10:03:22+00:00",
    "finishedAt": null,
    "resultUrl": null,
    "error": ""
  }
}

Notification FINISHED

{
  "data": {
    "id": 2,
    "status": "finished",
    "total": 1,
    "processed": 1,
    "valid": 1,
    "estimatedCost": 0.0035,
    "cost": 0.0035,
    "currency": "EUR",
    "createdAt": "2018-09-20T07:23:19+00:00",
    "updatedAt": "2018-09-20T07:23:56+00:00",
    "finishedAt": "2018-09-20T07:23:56+00:00",
    "resultUrl": "https://dashboard.360nrs.com/api/rest/validation/emails/2/result",
    "error": ""
  }
}

Notification FAILED

{
  "data": {
    "id": 2,
    "status": "failed",
    "total": 1,
    "processed": 0,
    "valid": 0,
    "estimatedCost": 0.0035,
    "cost": 0,
    "currency": "EUR",
    "createdAt": "2018-09-20T10:03:22+00:00",
    "updatedAt": "2018-09-20T10:03:22+00:00",
    "finishedAt": null,
    "resultUrl": null,
    "error": "Failed to process email validation"
  }
}

Lista negra

Listado de contactos em lista negra

GET https://dashboard.360nrs.com/api/rest/blacklist

curl -X GET 'https://dashboard.360nrs.com/api/rest/blacklist' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/blacklist',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Basic YOUR_AUTH_TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;

public class App {
  public static void main(String[] args) {
    try {
      URL url = new URL("https://dashboard.360nrs.com/api/rest/blacklist");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("GET");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      connection.setRequestProperty("Accept", "application/json");
      BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
      }
      in.close();
      System.out.println(response.toString());
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
}
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://dashboard.360nrs.com/api/rest/blacklist',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/blacklist"

payload = {}
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Basic YOUR_AUTH_TOKEN'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
require "uri"
require "net/http"

url = URI("https://dashboard.360nrs.com/api/rest/blacklist")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"

response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
  class HelloWorld {
    static void Main(string[] args) {
      var client = new RestClient("https://dashboard.360nrs.com/api/rest/blacklist");
      client.Timeout = -1;
      var request = new RestRequest(Method.GET);
      request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
      request.AddHeader("Content-Type", "application/json");
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

Response

{
  "data": [
    {
      "channel": "sms",
      "campaignName": "TEST_CAMPAIGN",
      "isDefinitive": false,
      "createdAt": "2020-01-01T00:00:00+00:00",
      "contact": {
        "data": {
          "id": 1,
          "email": "test@example.com",
          "phone": "34666666666",
          "countryIso": "ES",
          "landline": null,
          "name": "Contact name",
          "surname": "Contact surname",
          "createdAt": "2020-01-01T00:00:00+00:00",
          "updatedAt": "2020-01-01T00:00:00+00:00",
          "links": {
            "self": "https://dashboard.360nrs.com/api/rest/contacts/1"
          }
        }
      }
    }
  ],
  "meta": {
    "pagination": {
      "total": 500,
      "count": 100,
      "per_page": 100,
      "current_page": 1,
      "total_pages": 5,
      "links": {
        "next": "https://dashboard.360nrs.com/api/rest/groups?page=2"
      }
    }
  }
}

Filtros

Parâmetro Descrição
limit Total de contatos a serem exibidos em uma única petição. Valor por defeito: 100. Máximo: 1000.
channel Filtrar a lista negra por canal. É possível especificar vários valores separando-os por vírgulas. Valores disponíveis: sms ,mailing, landing, text2speech. ?channel=sms,mailing.
campaignName Filtrar a lista negra pelo nome da campanha na qual o contato solicitou a baixa. ?campaignName=TEST_CAMPAIGN.
campaignId Filtrar lista negra pelo ID da campanha na qual o contato solicitou a baixa. ?campaignId=1111.
isDefinitive Filtrar registros finais / editáveis. Quando a baixa é solicitada pelo usuário, a entrada na lista negra não pode ser editada. ?isDefinitive=0.
contactId Filtrar pelo ID de contacto. ?contactId=1111.
phone Filtrar pelo telefone de contacto. ?phone=34666666666.
email Filtrar pelo email de contacto. ?email=test%40example.com.
landline Filtrar pelo telefone fixo de contacto. ?landline=900222222.
countryIso Filtrar pelo país de contacto. ?countryIso=ES.

Adicionar contacto na lista negra

PUT https://dashboard.360nrs.com/api/rest/blacklist

curl -X PUT 'https://dashboard.360nrs.com/api/rest/blacklist' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
  "channel": "sms",
  "phone": "34666666666"
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/blacklist',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'PUT',
  CURLOPT_POSTFIELDS => '{
  "channel": "sms",
  "phone": "34666666666"
}',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Basic YOUR_AUTH_TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;

public class App {
  public static void main(String[] args) {
    try {
      URL url = new URL("https://dashboard.360nrs.com/api/rest/blacklist");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("PUT");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      connection.setRequestProperty("Accept", "application/json");
      String requestBody = "{ \"channel\": \"sms\", \"phone\": \"34666666666\" }";
      connection.setDoOutput(true);
      DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
      wr.writeBytes(requestBody);
      wr.flush();
      wr.close();
      BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
      }
      in.close();
      System.out.println(response.toString());
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
}
var request = require('request');
var options = {
  'method': 'PUT',
  'url': 'https://dashboard.360nrs.com/api/rest/blacklist',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  },
  'body': '{ "channel": "sms", "phone": "34666666666" }'
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/blacklist"

payload = "{ \"channel\": \"sms\", \"phone\": \"34666666666\" }"
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Basic YOUR_AUTH_TOKEN'
}

response = requests.request("PUT", url, headers=headers, data=payload)

print(response.text)
require "uri"
require "net/http"

url = URI("https://dashboard.360nrs.com/api/rest/blacklist")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Put.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"
request.body = "{ \"channel\": \"sms\", \"phone\": \"34666666666\" }"

response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
  class HelloWorld {
    static void Main(string[] args) {
      var client = new RestClient("https://dashboard.360nrs.com/api/rest/blacklist");
      client.Timeout = -1;
      var request = new RestRequest(Method.PUT);
      request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
      request.AddHeader("Content-Type", "application/json");
      request.AddParameter("application/json", "{ \"channel\": \"sms\", \"phone\": \"34666666666\" }",  ParameterType.RequestBody);
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

Response (HTTP 200)

{
  "data": {
    "channel": "sms",
    "campaignName": null,
    "isDefinitive": false,
    "createdAt": "2020-01-01T00:00:00+00:00",
    "contact": {
      "data": {
        "id": 1,
        "email": null,
        "phone": "34666666666",
        "countryIso": "ES",
        "landline": null,
        "name": null,
        "surname": null,
        "createdAt": "2020-01-01T00:00:00+00:00",
        "updatedAt": "2020-01-01T00:00:00+00:00",
        "links": {
          "self": "https://dashboard.360nrs.com/api/rest/contacts/1"
        }
      }
    }
  }
}

Parâmetros

Parâmetro Tipo Obrigatório Descrição
channel string Sim Canal para adicionar o contato à lista negra. Valores permitidos: sms, mailing, landing, text2speech.
contactId integer Obrigatório quando phone, email ou landline não for especificado. ID de contacto.
phone string Obrigatório quando contactId, email ou landline não for especificado. Telefone de contacto.
email string Obrigatório quando contactId, phone o landline não for especificado. Email de contacto.
landline string Obrigatório quando contactId, phone o email não for especificado. Telefone fixo de contacto.

Eliminar contacto da lista negra

DELETE https://dashboard.360nrs.com/api/rest/blacklist

curl -X DELETE 'https://dashboard.360nrs.com/api/rest/blacklist' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
  "channel": "sms",
  "phone": "34666666666"
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/blacklist',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'DELETE',
  CURLOPT_POSTFIELDS => '{
  "channel": "sms",
  "phone": "34666666666"
}',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Basic YOUR_AUTH_TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;

public class App {
  public static void main(String[] args) {
    try {
      URL url = new URL("https://dashboard.360nrs.com/api/rest/blacklist");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("DELETE");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      connection.setRequestProperty("Accept", "application/json");
      String requestBody = "{ \"channel\": \"sms\", \"phone\": \"34666666666\" }";
      connection.setDoOutput(true);
      DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
      wr.writeBytes(requestBody);
      wr.flush();
      wr.close();
      BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
      }
      in.close();
      System.out.println(response.toString());
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
}
var request = require('request');
var options = {
  'method': 'DELETE',
  'url': 'https://dashboard.360nrs.com/api/rest/blacklist',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  },
  'body': '{ "channel": "sms", "phone": "34666666666" }'
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/blacklist"

payload = "{ \"channel\": \"sms\", \"phone\": \"34666666666\" }"
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Basic YOUR_AUTH_TOKEN'
}

response = requests.request("DELETE", url, headers=headers, data=payload)

print(response.text)
require "uri"
require "net/http"

url = URI("https://dashboard.360nrs.com/api/rest/blacklist")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Delete.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"
request.body = "{ \"channel\": \"sms\", \"phone\": \"34666666666\" }"

response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
  class HelloWorld {
    static void Main(string[] args) {
      var client = new RestClient("https://dashboard.360nrs.com/api/rest/blacklist");
      client.Timeout = -1;
      var request = new RestRequest(Method.DELETE);
      request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
      request.AddHeader("Content-Type", "application/json");
      request.AddParameter("application/json", "{ \"channel\": \"sms\", \"phone\": \"34666666666\" }",  ParameterType.RequestBody);
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

Parâmetros

Parâmetro Tipo Obrigatório Descrição
channel string Sim Canal para adicionar o contato à lista negra. Valores permitidos: sms, mailing, landing, text2speech.
contactId integer Obrigatório quando phone, email ou landline não for especificado. ID de contacto.
phone string Obrigatório quando contactId, email ou landline não for especificado. Telefone de contacto.
email string Obrigatório quando contactId, phone o landline não for especificado. Email de contacto.
landline string Obrigatório quando contactId, phone o email não for especificado. Telefone fixo de contacto.

Se a petição for bem-sucedida, será respondida com um código HTTP 204.

Templates e ficheiros

Templates

Lista de templates

GET https://dashboard.360nrs.com/api/rest/templates

curl -X GET 'https://dashboard.360nrs.com/api/rest/templates' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/templates',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Basic YOUR_AUTH_TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;

public class App {
  public static void main(String[] args) {
    try {
      URL url = new URL("https://dashboard.360nrs.com/api/rest/templates");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("GET");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      connection.setRequestProperty("Accept", "application/json");
      BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
      }
      in.close();
      System.out.println(response.toString());
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
}
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://dashboard.360nrs.com/api/rest/templates',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/templates"

payload = {}
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Basic YOUR_AUTH_TOKEN'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
require "uri"
require "net/http"

url = URI("https://dashboard.360nrs.com/api/rest/templates")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"

response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
  class HelloWorld {
    static void Main(string[] args) {
      var client = new RestClient("https://dashboard.360nrs.com/api/rest/templates");
      client.Timeout = -1;
      var request = new RestRequest(Method.GET);
      request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
      request.AddHeader("Content-Type", "application/json");
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

Response

{
  "data": [
    {
      "id": 1,
      "name": "Template 1",
      "html": "<h1>Hello world</h1>",
      "createdAt": "2018-08-17T12:31:10+00:00",
      "updatedAt": null
    }
  ],
  "meta": {
    "pagination": {
      "total": 1,
      "count": 1,
      "per_page": 100,
      "current_page": 1,
      "total_pages": 1,
      "links": []
    }
  }
}

Mostrar um template

GET https://dashboard.360nrs.com/api/rest/templates/<ID>

curl -X GET 'https://dashboard.360nrs.com/api/rest/templates/1' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/templates/1',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Basic YOUR_AUTH_TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;

public class App {
  public static void main(String[] args) {
    try {
      URL url = new URL("https://dashboard.360nrs.com/api/rest/templates/1");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("GET");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      connection.setRequestProperty("Accept", "application/json");
      BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
      }
      in.close();
      System.out.println(response.toString());
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
}
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://dashboard.360nrs.com/api/rest/templates/1',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/templates/1"

payload = {}
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Basic YOUR_AUTH_TOKEN'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
require "uri"
require "net/http"

url = URI("https://dashboard.360nrs.com/api/rest/templates/1")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"

response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
  class HelloWorld {
    static void Main(string[] args) {
      var client = new RestClient("https://dashboard.360nrs.com/api/rest/templates/1");
      client.Timeout = -1;
      var request = new RestRequest(Method.GET);
      request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
      request.AddHeader("Content-Type", "application/json");
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

Response (HTTP 200)

{
  "data": {
    "id": 1,
    "name": "Template 1",
    "html": "<h1>Hello world</h1>",
    "createdAt": "2018-08-17T12:31:10+00:00",
    "updatedAt": null
  }
}

Criar um novo template

POST https://dashboard.360nrs.com/api/rest/templates

curl -X POST 'https://dashboard.360nrs.com/api/rest/templates' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
  "name": "New Template",
  "html": "<h1>Hello world</h1>"    
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/templates',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => '{
  "name": "New Template",
  "html": "<h1>Hello world</h1>"    
}',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Basic YOUR_AUTH_TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;

public class App {
  public static void main(String[] args) {
    try {
      URL url = new URL("https://dashboard.360nrs.com/api/rest/templates");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("POST");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      connection.setRequestProperty("Accept", "application/json");
      String requestBody = "{ \"name\": \"New Template\", \"html\": \"<h1>Hello world</h1>\" }";
      connection.setDoOutput(true);
      DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
      wr.writeBytes(requestBody);
      wr.flush();
      wr.close();
      BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
      }
      in.close();
      System.out.println(response.toString());
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
}
var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://dashboard.360nrs.com/api/rest/templates',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  },
  'body': '{ "name": "New Template", "html": "<h1>Hello world</h1>" }'
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/templates"

payload = "{ \"name\": \"New Template\", \"html\": \"<h1>Hello world</h1>\" }"
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Basic YOUR_AUTH_TOKEN'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
require "uri"
require "net/http"

url = URI("https://dashboard.360nrs.com/api/rest/templates")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"
request.body = "{ \"name\": \"New Template\", \"html\": \"<h1>Hello world</h1>\" }"

response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
  class HelloWorld {
    static void Main(string[] args) {
      var client = new RestClient("https://dashboard.360nrs.com/api/rest/templates");
      client.Timeout = -1;
      var request = new RestRequest(Method.POST);
      request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
      request.AddHeader("Content-Type", "application/json");
      request.AddParameter("application/json", "{ \"name\": \"New Template\", \"html\": \"<h1>Hello world</h1>\" }",  ParameterType.RequestBody);
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

Response (HTTP 201)

{
  "data": {
    "id": 1,
    "name": "New Template",
    "html": "<h1>Hello world</h1>",
    "createdAt": "2020-01-00T00:00:00+00:00",
    "updatedAt": "2020-01-00T00:00:00+00:00",
    "links": {
      "self": "https://dashboard.360nrs.com/api/rest/templates/1",
      "preview": "https://dashboard.360nrs.com/api/rest/templates/1/preview"
    }
  }
}
Parâmetro Tipo Obligatorio Descrição
name string Sim Template Name.
html string Sim Conteúdo do template em formato HTML e codificação UTF-8.

Atualizar um template

PUT https://dashboard.360nrs.com/api/rest/templates/<ID>

curl -X PUT 'https://dashboard.360nrs.com/api/rest/templates/1' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
  "name": "New Template",
  "html": "<h1>Hello world</h1>"    
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/templates/1',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'PUT',
  CURLOPT_POSTFIELDS => '{
  "name": "New Template",
  "html": "<h1>Hello world</h1>"    
}',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Basic YOUR_AUTH_TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;

public class App {
  public static void main(String[] args) {
    try {
      URL url = new URL("https://dashboard.360nrs.com/api/rest/templates/1");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("PUT");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      connection.setRequestProperty("Accept", "application/json");
      String requestBody = "{ \"name\": \"New Template\", \"html\": \"<h1>Hello world</h1>\" }";
      connection.setDoOutput(true);
      DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
      wr.writeBytes(requestBody);
      wr.flush();
      wr.close();
      BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
      }
      in.close();
      System.out.println(response.toString());
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
}
var request = require('request');
var options = {
  'method': 'PUT',
  'url': 'https://dashboard.360nrs.com/api/rest/templates/1',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  },
  'body': '{ "name": "New Template", "html": "<h1>Hello world</h1>" }'
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/templates/1"

payload = "{ \"name\": \"New Template\", \"html\": \"<h1>Hello world</h1>\" }"
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Basic YOUR_AUTH_TOKEN'
}

response = requests.request("PUT", url, headers=headers, data=payload)

print(response.text)
require "uri"
require "net/http"

url = URI("https://dashboard.360nrs.com/api/rest/templates/1")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Put.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"
request.body = "{ \"name\": \"New Template\", \"html\": \"<h1>Hello world</h1>\" }"

response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
  class HelloWorld {
    static void Main(string[] args) {
      var client = new RestClient("https://dashboard.360nrs.com/api/rest/templates/1");
      client.Timeout = -1;
      var request = new RestRequest(Method.PUT);
      request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
      request.AddHeader("Content-Type", "application/json");
      request.AddParameter("application/json", "{ \"name\": \"New Template\", \"html\": \"<h1>Hello world</h1>\" }",  ParameterType.RequestBody);
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

Response (HTTP 201)

{
  "data": {
    "id": 1,
    "name": "New Template",
    "html": "<h1>Hello world</h1>",
    "createdAt": "2020-01-00T00:00:00+00:00",
    "updatedAt": "2020-01-00T00:00:00+00:00",
    "links": {
      "self": "https://dashboard.360nrs.com/api/rest/templates/1",
      "preview": "https://dashboard.360nrs.com/api/rest/templates/1/preview"
    }
  }
}
Parâmetro Tipo Obligatorio Descrição
name string Sim Template Name.
html string Sim Conteúdo do template em formato HTML e codificação UTF-8.

Eliminar um template

DELETE https://dashboard.360nrs.com/api/rest/templates/<ID>

curl -X DELETE 'https://dashboard.360nrs.com/api/rest/templates/1' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/templates/1',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'DELETE',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Basic YOUR_AUTH_TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;

public class App {
  public static void main(String[] args) {
    try {
      URL url = new URL("https://dashboard.360nrs.com/api/rest/templates/1");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("DELETE");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      connection.setRequestProperty("Accept", "application/json");
      BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
      }
      in.close();
      System.out.println(response.toString());
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
}
var request = require('request');
var options = {
  'method': 'DELETE',
  'url': 'https://dashboard.360nrs.com/api/rest/templates/1',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/templates/1"

payload = {}
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Basic YOUR_AUTH_TOKEN'
}

response = requests.request("DELETE", url, headers=headers, data=payload)

print(response.text)
require "uri"
require "net/http"

url = URI("https://dashboard.360nrs.com/api/rest/templates/1")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Delete.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"

response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
  class HelloWorld {
    static void Main(string[] args) {
      var client = new RestClient("https://dashboard.360nrs.com/api/rest/templates/1");
      client.Timeout = -1;
      var request = new RestRequest(Method.DELETE);
      request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
      request.AddHeader("Content-Type", "application/json");
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

Caso o pedido seja bem sucedido, responderá com um código HTTP 204.

Pré-visualizar um template

GET https://dashboard.360nrs.com/api/rest/templates/<ID>/preview

curl -X GET 'https://dashboard.360nrs.com/api/rest/templates/1/preview' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/templates/1/preview',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Basic YOUR_AUTH_TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;

public class App {
  public static void main(String[] args) {
    try {
      URL url = new URL("https://dashboard.360nrs.com/api/rest/templates/1/preview");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("GET");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
      }
      in.close();
      System.out.println(response.toString());
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
}
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://dashboard.360nrs.com/api/rest/templates/1/preview',
  'headers': {
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/templates/1/preview"

payload = {}
headers = {
  'Authorization': 'Basic YOUR_AUTH_TOKEN'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
require "uri"
require "net/http"

url = URI("https://dashboard.360nrs.com/api/rest/templates/1/preview")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"

response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
  class HelloWorld {
    static void Main(string[] args) {
      var client = new RestClient("https://dashboard.360nrs.com/api/rest/templates/1/preview");
      client.Timeout = -1;
      var request = new RestRequest(Method.GET);
      request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

A resposta conterá uma prévia do modelo no formato HTML.

Variáveis personalizadas

Variáveis personalizadas podem ser usadas em modelos. Estas variáveis serão substituídas pelos campos personalizados do contato antes de enviar usando a sintaxe {variable}.

Por exemplo, para incluir a variável personalizada "name" em um modelo HTML:

<html>
<head>
    <title>TEST</title>
</head>
<body>
    <h1>Hello {name}</h1>
</body>
</html>

Os modelos aceitam os seguintes padrões de substituição para o link nos links HTML.

Pattern Description
[unsubscribe_link] Link para a página de cancelamento de inscrição.
[form_{ID}] Link para o formulário com id {ID}.
[show_link] Link para visualizar o modelo no navegador da web. Útil para envio de tipo de correspondência.
[attachment_{ID}] Link para o anexo com o ID {ID}.

Por exemplo, para incluir um link para o formulário com o id "12":

<a href="[form_12]">Form link</a>

Formulários

Criar um formulário

POST https://dashboard.360nrs.com/api/rest/form

curl -X POST 'https://dashboard.360nrs.com/api/rest/forms' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
  "name": "My_form",
  "rejectButton": true,
  "backgroundUrl": "https://dashboard.360nrs.com/assets/login/img/wizard.jpg",
  "logoUrl": "https://dashboard.360nrs.com/assets/img/logo.png",
  "formFields": [
    {"type": "h3", "label": "Your opinion is very important to us"},
    {"type": "text", "label": "Name", "required": true, "description": "Insert your name", "placeholder": "Insert your name", "customField": "form_name"}
  ]
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/forms',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => '{
  "name": "My_form",
  "rejectButton": true,
  "backgroundUrl": "https://dashboard.360nrs.com/assets/login/img/wizard.jpg",
  "logoUrl": "https://dashboard.360nrs.com/assets/img/logo.png",
  "formFields": [
    {"type": "h3", "label": "Your opinion is very important to us"},
    {"type": "text", "label": "Name", "required": true, "description": "Insert your name", "placeholder": "Insert your name", "customField": "form_name"}
  ]
}',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Basic YOUR_AUTH_TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;

public class App {
  public static void main(String[] args) {
    try {
      URL url = new URL("https://dashboard.360nrs.com/api/rest/forms");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("POST");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      connection.setRequestProperty("Accept", "application/json");
      String requestBody = "{ \"name\": \"My_form\", \"rejectButton\": true, \"backgroundUrl\": \"https://dashboard.360nrs.com/assets/login/img/wizard.jpg\", \"logoUrl\": \"https://dashboard.360nrs.com/assets/img/logo.png\", \"formFields\": [ {\"type\": \"h3\", \"label\": \"Your opinion is very important to us\"}, {\"type\": \"text\", \"label\": \"Name\", \"required\": true, \"description\": \"Insert your name\", \"placeholder\": \"Insert your name\", \"customField\": \"form_name\"} ] }";
      connection.setDoOutput(true);
      DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
      wr.writeBytes(requestBody);
      wr.flush();
      wr.close();
      BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
      }
      in.close();
      System.out.println(response.toString());
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
}
var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://dashboard.360nrs.com/api/rest/forms',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  },
  'body': '{ "name": "My_form", "rejectButton": true, "backgroundUrl": "https://dashboard.360nrs.com/assets/login/img/wizard.jpg", "logoUrl": "https://dashboard.360nrs.com/assets/img/logo.png", "formFields": [ {"type": "h3", "label": "Your opinion is very important to us"}, {"type": "text", "label": "Name", "required": true, "description": "Insert your name", "placeholder": "Insert your name", "customField": "form_name"} ] }'
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/forms"

payload = "{ \"name\": \"My_form\", \"rejectButton\": true, \"backgroundUrl\": \"https://dashboard.360nrs.com/assets/login/img/wizard.jpg\", \"logoUrl\": \"https://dashboard.360nrs.com/assets/img/logo.png\", \"formFields\": [ {\"type\": \"h3\", \"label\": \"Your opinion is very important to us\"}, {\"type\": \"text\", \"label\": \"Name\", \"required\": true, \"description\": \"Insert your name\", \"placeholder\": \"Insert your name\", \"customField\": \"form_name\"} ] }"
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Basic YOUR_AUTH_TOKEN'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
require "uri"
require "net/http"

url = URI("https://dashboard.360nrs.com/api/rest/forms")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"
request.body = "{ \"name\": \"My_form\", \"rejectButton\": true, \"backgroundUrl\": \"https://dashboard.360nrs.com/assets/login/img/wizard.jpg\", \"logoUrl\": \"https://dashboard.360nrs.com/assets/img/logo.png\", \"formFields\": [ {\"type\": \"h3\", \"label\": \"Your opinion is very important to us\"}, {\"type\": \"text\", \"label\": \"Name\", \"required\": true, \"description\": \"Insert your name\", \"placeholder\": \"Insert your name\", \"customField\": \"form_name\"} ] }"

response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
  class HelloWorld {
    static void Main(string[] args) {
      var client = new RestClient("https://dashboard.360nrs.com/api/rest/forms");
      client.Timeout = -1;
      var request = new RestRequest(Method.POST);
      request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
      request.AddHeader("Content-Type", "application/json");
      request.AddParameter("application/json", "{ \"name\": \"My_form\", \"rejectButton\": true, \"backgroundUrl\": \"https://dashboard.360nrs.com/assets/login/img/wizard.jpg\", \"logoUrl\": \"https://dashboard.360nrs.com/assets/img/logo.png\", \"formFields\": [ {\"type\": \"h3\", \"label\": \"Your opinion is very important to us\"}, {\"type\": \"text\", \"label\": \"Name\", \"required\": true, \"description\": \"Insert your name\", \"placeholder\": \"Insert your name\", \"customField\": \"form_name\"} ] }",  ParameterType.RequestBody);
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

Example Request

{
  "name": "My_form",
  "rejectButton": true,
  "backgroundUrl": "https://dashboard.360nrs.com/assets/login/img/wizard.jpg",
  "logoUrl": "https://dashboard.360nrs.com/assets/img/logo.png",
  "formFields": [
    {
      "type": "h3",
      "label": "Your opinion is very important to us"
    },
    {
      "type": "text",
      "label": "Name",
      "required": true,
      "description": "Insert your name",
      "placeholder": "Insert your name",
      "customField": "form_name"
    },
    {
      "type": "email",
      "label": "Email",
      "required": true,
      "description": "Insert your email",
      "placeholder": "Insert your email",
      "customField": "form_email"
    },
    {
      "type": "radio",
      "label": "How satisfied are you with our platform?",
      "required": true,
      "description": "Select your response depending on your satisfaction",
      "customField": "form_satisfaction",
      "options": [
        {
          "label": "Very satisfied",
          "value": "10"
        },
        {
          "label": "Somewhat satisfied",
          "value": "8"
        },
        {
          "label": "Neither satisfied nor dissatisfied",
          "value": "6"
        },
        {
          "label": "Somewhat dissatisfied",
          "value": "4"
        },
        {
          "label": "Very dissatisfied",
          "value": "2"
        }
      ]
    }
  ]
}

Parâmetros

Parâmetro Tipo Obrigatório Descrição
name string Sim Nome único do formulário
editable boolean Não 'true': uma vez enviado, o cliente pode enviá-lo novamente.
'false': uma vez enviado, o cliente não poderá enviá-lo novamente.
Por padrão, true.
rejectButton boolean Não 'true': além do botão Enviar, o botão Rejeitar será mostrado. O botão Rejeitar não envia os dados.
'false': somente o botão Submit será mostrado. Por padrão, false.
backgroundUrl string Não Url da imagem de formulário.
logoUrl string Não Url da imagem do logotipo do formulário.
formFields array Sim Conjunto de elementos que terá o formulário. Veja o anexo para ver todos os elementos.

Formulário exemplo:

Atualizar um formulário

PUT https://dashboard.360nrs.com/api/rest/forms/<ID>

curl -X PUT 'https://dashboard.360nrs.com/api/rest/forms' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
  "name": "My_form",
  "rejectButton": true,
  "backgroundUrl": "https://dashboard.360nrs.com/assets/login/img/wizard.jpg",
  "logoUrl": "https://dashboard.360nrs.com/assets/img/logo.png",
  "formFields": [
    {"type": "h3", "label": "Your opinion is very important to us"},
    {"type": "text", "label": "Name", "required": true, "description": "Insert your name", "placeholder": "Insert your name", "customField": "form_name"}
  ]
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/forms',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'PUT',
  CURLOPT_POSTFIELDS => '{
  "name": "My_form",
  "rejectButton": true,
  "backgroundUrl": "https://dashboard.360nrs.com/assets/login/img/wizard.jpg",
  "logoUrl": "https://dashboard.360nrs.com/assets/img/logo.png",
  "formFields": [
    {"type": "h3", "label": "Your opinion is very important to us"},
    {"type": "text", "label": "Name", "required": true, "description": "Insert your name", "placeholder": "Insert your name", "customField": "form_name"}
  ]
}',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Basic YOUR_AUTH_TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;

public class App {
  public static void main(String[] args) {
    try {
      URL url = new URL("https://dashboard.360nrs.com/api/rest/forms");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("PUT");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      connection.setRequestProperty("Accept", "application/json");
      String requestBody = "{ \"name\": \"My_form\", \"rejectButton\": true, \"backgroundUrl\": \"https://dashboard.360nrs.com/assets/login/img/wizard.jpg\", \"logoUrl\": \"https://dashboard.360nrs.com/assets/img/logo.png\", \"formFields\": [ {\"type\": \"h3\", \"label\": \"Your opinion is very important to us\"}, {\"type\": \"text\", \"label\": \"Name\", \"required\": true, \"description\": \"Insert your name\", \"placeholder\": \"Insert your name\", \"customField\": \"form_name\"} ] }";
      connection.setDoOutput(true);
      DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
      wr.writeBytes(requestBody);
      wr.flush();
      wr.close();
      BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
      }
      in.close();
      System.out.println(response.toString());
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
}
var request = require('request');
var options = {
  'method': 'PUT',
  'url': 'https://dashboard.360nrs.com/api/rest/forms',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  },
  'body': '{ "name": "My_form", "rejectButton": true, "backgroundUrl": "https://dashboard.360nrs.com/assets/login/img/wizard.jpg", "logoUrl": "https://dashboard.360nrs.com/assets/img/logo.png", "formFields": [ {"type": "h3", "label": "Your opinion is very important to us"}, {"type": "text", "label": "Name", "required": true, "description": "Insert your name", "placeholder": "Insert your name", "customField": "form_name"} ] }'
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/forms"

payload = "{ \"name\": \"My_form\", \"rejectButton\": true, \"backgroundUrl\": \"https://dashboard.360nrs.com/assets/login/img/wizard.jpg\", \"logoUrl\": \"https://dashboard.360nrs.com/assets/img/logo.png\", \"formFields\": [ {\"type\": \"h3\", \"label\": \"Your opinion is very important to us\"}, {\"type\": \"text\", \"label\": \"Name\", \"required\": true, \"description\": \"Insert your name\", \"placeholder\": \"Insert your name\", \"customField\": \"form_name\"} ] }"
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Basic YOUR_AUTH_TOKEN'
}

response = requests.request("PUT", url, headers=headers, data=payload)

print(response.text)
require "uri"
require "net/http"

url = URI("https://dashboard.360nrs.com/api/rest/forms")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Put.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"
request.body = "{ \"name\": \"My_form\", \"rejectButton\": true, \"backgroundUrl\": \"https://dashboard.360nrs.com/assets/login/img/wizard.jpg\", \"logoUrl\": \"https://dashboard.360nrs.com/assets/img/logo.png\", \"formFields\": [ {\"type\": \"h3\", \"label\": \"Your opinion is very important to us\"}, {\"type\": \"text\", \"label\": \"Name\", \"required\": true, \"description\": \"Insert your name\", \"placeholder\": \"Insert your name\", \"customField\": \"form_name\"} ] }"

response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
  class HelloWorld {
    static void Main(string[] args) {
      var client = new RestClient("https://dashboard.360nrs.com/api/rest/forms");
      client.Timeout = -1;
      var request = new RestRequest(Method.PUT);
      request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
      request.AddHeader("Content-Type", "application/json");
      request.AddParameter("application/json", "{ \"name\": \"My_form\", \"rejectButton\": true, \"backgroundUrl\": \"https://dashboard.360nrs.com/assets/login/img/wizard.jpg\", \"logoUrl\": \"https://dashboard.360nrs.com/assets/img/logo.png\", \"formFields\": [ {\"type\": \"h3\", \"label\": \"Your opinion is very important to us\"}, {\"type\": \"text\", \"label\": \"Name\", \"required\": true, \"description\": \"Insert your name\", \"placeholder\": \"Insert your name\", \"customField\": \"form_name\"} ] }",  ParameterType.RequestBody);
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

Parâmetros

Parâmetro Tipo Obrigatório Descrição
name string Sim Nome único do formulário
editable boolean Não 'true': uma vez enviado, o cliente pode enviá-lo novamente.
'false': uma vez enviado, o cliente não poderá enviá-lo novamente.
Por padrão, true.
rejectButton boolean Não 'true': além do botão Enviar, o botão Rejeitar será mostrado. O botão Rejeitar não envia os dados.
'false': somente o botão Submit será mostrado. Por padrão, false.
backgroundUrl string Não Url da imagem de formulário.
logoUrl string Não Url da imagem do logotipo do formulário.
formFields array Sim Conjunto de elementos que terá o formulário. Veja o anexo para ver todos os elementos.

Lista de formulários

GET https://dashboard.360nrs.com/api/rest/forms

curl -X GET 'https://dashboard.360nrs.com/api/rest/forms' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/forms',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Basic YOUR_AUTH_TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;

public class App {
  public static void main(String[] args) {
    try {
      URL url = new URL("https://dashboard.360nrs.com/api/rest/forms");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("GET");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      connection.setRequestProperty("Accept", "application/json");
      BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
      }
      in.close();
      System.out.println(response.toString());
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
}
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://dashboard.360nrs.com/api/rest/forms',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/forms"

payload = {}
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Basic YOUR_AUTH_TOKEN'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
require "uri"
require "net/http"

url = URI("https://dashboard.360nrs.com/api/rest/forms")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"

response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
  class HelloWorld {
    static void Main(string[] args) {
      var client = new RestClient("https://dashboard.360nrs.com/api/rest/forms");
      client.Timeout = -1;
      var request = new RestRequest(Method.GET);
      request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
      request.AddHeader("Content-Type", "application/json");
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

Response

{
    "data": [
        {
            "id": 1,
            "name": "Form 1",
            "placeholder": "{FORM_1}",
            "createdAt": "2018-08-21T11:51:33+00:00",
            "updatedAt": null
        }
    ],
    "meta": {
        "pagination": {
            "total": 1,
            "count": 1,
            "per_page": 100,
            "current_page": 1,
            "total_pages": 1,
            "links": []
        }
    }
}

Mostrar um formulário

GET https://dashboard.360nrs.com/api/rest/forms/<ID>

curl -X GET 'https://dashboard.360nrs.com/api/rest/forms/1' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/forms/1',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Basic YOUR_AUTH_TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;

public class App {
  public static void main(String[] args) {
    try {
      URL url = new URL("https://dashboard.360nrs.com/api/rest/forms/1");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("GET");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      connection.setRequestProperty("Accept", "application/json");
      BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
      }
      in.close();
      System.out.println(response.toString());
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
}
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://dashboard.360nrs.com/api/rest/forms/1',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/forms/1"

payload = {}
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Basic YOUR_AUTH_TOKEN'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
require "uri"
require "net/http"

url = URI("https://dashboard.360nrs.com/api/rest/forms/1")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"

response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
  class HelloWorld {
    static void Main(string[] args) {
      var client = new RestClient("https://dashboard.360nrs.com/api/rest/forms/1");
      client.Timeout = -1;
      var request = new RestRequest(Method.GET);
      request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
      request.AddHeader("Content-Type", "application/json");
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

Response

{
    "data": {
        "id": 1,
        "name": "Form 1",
        "placeholder": "{FORM_1}",
        "createdAt": "2018-08-21T11:51:33+00:00",
        "updatedAt": null
    }
}

Eliminar um formulário

DELETE https://dashboard.360nrs.com/api/rest/forms/<ID>

curl -X DELETE 'https://dashboard.360nrs.com/api/rest/forms/1' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/forms/1',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'DELETE',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Basic YOUR_AUTH_TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;

public class App {
  public static void main(String[] args) {
    try {
      URL url = new URL("https://dashboard.360nrs.com/api/rest/forms/1");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("DELETE");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      connection.setRequestProperty("Accept", "application/json");
      BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
      }
      in.close();
      System.out.println(response.toString());
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
}
var request = require('request');
var options = {
  'method': 'DELETE',
  'url': 'https://dashboard.360nrs.com/api/rest/forms/1',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/forms/1"

payload = {}
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Basic YOUR_AUTH_TOKEN'
}

response = requests.request("DELETE", url, headers=headers, data=payload)

print(response.text)
require "uri"
require "net/http"

url = URI("https://dashboard.360nrs.com/api/rest/forms/1")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Delete.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"

response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
  class HelloWorld {
    static void Main(string[] args) {
      var client = new RestClient("https://dashboard.360nrs.com/api/rest/forms/1");
      client.Timeout = -1;
      var request = new RestRequest(Method.DELETE);
      request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
      request.AddHeader("Content-Type", "application/json");
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

Caso o pedido seja bem sucedido, responderá com um código HTTP 204.

Pré-visualizar um formulário

GET https://dashboard.360nrs.com/api/rest/forms/<ID>/preview

curl -X GET 'https://dashboard.360nrs.com/api/rest/forms/1/preview' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/forms/1/preview',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Basic YOUR_AUTH_TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;

public class App {
  public static void main(String[] args) {
    try {
      URL url = new URL("https://dashboard.360nrs.com/api/rest/forms/1/preview");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("GET");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
      }
      in.close();
      System.out.println(response.toString());
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
}
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://dashboard.360nrs.com/api/rest/forms/1/preview',
  'headers': {
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/forms/1/preview"

payload = {}
headers = {
  'Authorization': 'Basic YOUR_AUTH_TOKEN'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
require "uri"
require "net/http"

url = URI("https://dashboard.360nrs.com/api/rest/forms/1/preview")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"

response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
  class HelloWorld {
    static void Main(string[] args) {
      var client = new RestClient("https://dashboard.360nrs.com/api/rest/forms/1/preview");
      client.Timeout = -1;
      var request = new RestRequest(Method.GET);
      request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

A resposta conterá uma prévia do modelo no formato HTML. Caso o pedido seja bem sucedido, responderá com um código HTTP 200.

Elementos do formulário

H1

H1

{
  "type": "h1",
  "label": "My title"
}

H2

H2

{
  "type": "h2",
  "label": "My title"
}

H3

H3

{
  "type": "h3",
  "label": "My title"
}

H4

H4

{
  "type": "h4",
  "label": "My title"
}

Paragraph

Paragraph

{
  "type": "p",
  "label": "This is my paragraph"
}

Blockquote

Blockquote

{
  "type": "blockquote",
  "label": "My blockquote"
}

Input text

Input text

{
  "type": "text",
  "label": "My field",
  "required": true,
  "description": "Help text",
  "placeholder": "My placeholder",
  "customField": "my_string_custom_field"
}

Input password

Input password

{
  "type": "password",
  "label": "My field",
  "required": true,
  "description": "Help text",
  "placeholder": "My placeholder",
  "customField": "my_string_custom_field"
}

Input email

Input email

{
  "type": "email",
  "label": "My field",
  "required": true,
  "description": "Help text",
  "placeholder": "My placeholder",
  "customField": "my_string_custom_field"
}

Input number

Input number

{
  "type": "number",
  "label": "My field",
  "required": true,
  "description": "Help text",
  "placeholder": "My placeholder",
  "customField": "my_decimal_custom_field"
}

Textarea

Textarea

{
  "type": "textarea",
  "label": "My field",
  "required": true,
  "description": "Help text",
  "placeholder": "My placeholder",
  "customField": "my_string_custom_field",
  "rows": 3
}

Date picker

Date picker

{
  "type": "date",
  "label": "My field",
  "required": true,
  "description": "Help text",
  "placeholder": "My placeholder",
  "customField": "my_date_custom_field"
}

Color picker

Color picker

{
  "type": "color",
  "label": "My field",
  "required": true,
  "description": "Help text",
  "placeholder": "My placeholder",
  "customField": "my_string_custom_field"
}

Country select

Country select

{
  "type": "countrySelector",
  "label": "My field",
  "required": true,
  "description": "Help text",
  "customField": "my_string_custom_field"
}

Select

Select

{
  "type": "select",
  "label": "My field",
  "required": true,
  "description": "Help text",
  "customField": "my_string_custom_field",
  "options": [
    {"label": "Label 1", "value": "value1"},
    {"label": "Label 2", "value": "value2"},
    {"label": "Label 3", "value": "value3"}
  ]
}

Input radio

Input radio

{
  "type": "radio",
  "label": "My field",
  "required": true,
  "description": "Help text",
  "customField": "my_string_custom_field",
  "options": [
    {"label": "Label 1", "value": "value1"},
    {"label": "Label 2", "value": "value2"},
    {"label": "Label 3", "value": "value3"}
  ]
}

Input checkbox

Input checkbox

{
  "type": "checkbox",
  "label": "My checkbox text",
  "required": true,
  "customField": "my_decimal_custom_field",
}

Encurtador urls

Criação de url curtas

POST https://dashboard.360nrs.com/api/rest/shortener/shorten

Request

curl -X POST 'https://dashboard.360nrs.com/api/rest/shortener/shorten' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
  "urls": [
    {"longUrl": "https://example.com/test1"},
    {"longUrl": "https://example.com/test2"},
    {"longUrl": "invalidUrl"}
  ]
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/shortener/shorten',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => '{
  "urls": [
    {"longUrl": "https://example.com/test1"},
    {"longUrl": "https://example.com/test2"},
    {"longUrl": "invalidUrl"}
  ]
}',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Basic YOUR_AUTH_TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;

public class App {
  public static void main(String[] args) {
    try {
      URL url = new URL("https://dashboard.360nrs.com/api/rest/shortener/shorten");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("POST");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      connection.setRequestProperty("Accept", "application/json");
      String requestBody = "{ \"urls\": [ {\"longUrl\": \"https://example.com/test1\"}, {\"longUrl\": \"https://example.com/test2\"}, {\"longUrl\": \"invalidUrl\"} ] }";
      connection.setDoOutput(true);
      DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
      wr.writeBytes(requestBody);
      wr.flush();
      wr.close();
      BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
      }
      in.close();
      System.out.println(response.toString());
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
}
var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://dashboard.360nrs.com/api/rest/shortener/shorten',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  },
  'body': '{ "urls": [ {"longUrl": "https://example.com/test1"}, {"longUrl": "https://example.com/test2"}, {"longUrl": "invalidUrl"} ] }'
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/shortener/shorten"

payload = "{ \"urls\": [ {\"longUrl\": \"https://example.com/test1\"}, {\"longUrl\": \"https://example.com/test2\"}, {\"longUrl\": \"invalidUrl\"} ] }"
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Basic YOUR_AUTH_TOKEN'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
require "uri"
require "net/http"

url = URI("https://dashboard.360nrs.com/api/rest/shortener/shorten")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"
request.body = "{ \"urls\": [ {\"longUrl\": \"https://example.com/test1\"}, {\"longUrl\": \"https://example.com/test2\"}, {\"longUrl\": \"invalidUrl\"} ] }"

response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
  class HelloWorld {
    static void Main(string[] args) {
      var client = new RestClient("https://dashboard.360nrs.com/api/rest/shortener/shorten");
      client.Timeout = -1;
      var request = new RestRequest(Method.POST);
      request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
      request.AddHeader("Content-Type", "application/json");
      request.AddParameter("application/json", "{ \"urls\": [ {\"longUrl\": \"https://example.com/test1\"}, {\"longUrl\": \"https://example.com/test2\"}, {\"longUrl\": \"invalidUrl\"} ] }",  ParameterType.RequestBody);
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

Response

{
  "data": [
    {
      "longUrl": "https://example.com/test1",
      "shortUrl": "https://nrs.so/dvRINN",
      "error": false
    },
    {
      "longUrl": "https://example.com/test2",
      "shortUrl": "https://nrs.so/GFA6Fm",
      "error": false
    },
    {
      "longUrl": "invalidUrl",
      "shortUrl": null,
      "error": true
    }
  ]
}

Gerador de imagem

Geração de imagens

POST https://dashboard.360nrs.com/api/rest/images/generate

Request

curl -X POST 'https://dashboard.360nrs.com/api/rest/images/generate' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
  "images": [
    {
        "externalId": "test1",
        "extension": "jpg",
        "base64": "BASE64_ENCODED_STRING"
    },
    {
        "externalId": "test2",
        "extension": "png",
        "base64": "BASE64_ENCODED_STRING"
    }
  ]
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/images/generate',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => '{
  "images": [
    {
        "externalId": "test1",
        "extension": "jpg",
        "base64": "BASE64_ENCODED_STRING"
    },
    {
        "externalId": "test2",
        "extension": "png",
        "base64": "BASE64_ENCODED_STRING"
    }
  ]
}',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Basic YOUR_AUTH_TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;

public class App {
  public static void main(String[] args) {
    try {
      URL url = new URL("https://dashboard.360nrs.com/api/rest/images/generate");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("POST");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      connection.setRequestProperty("Accept", "application/json");
      String requestBody = "{ \"images\": [ { \"externalId\": \"test1\", \"extension\": \"jpg\", \"base64\": \"BASE64_ENCODED_STRING\" }, { \"externalId\": \"test2\", \"extension\": \"png\", \"base64\": \"BASE64_ENCODED_STRING\" } ] }";
      connection.setDoOutput(true);
      DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
      wr.writeBytes(requestBody);
      wr.flush();
      wr.close();
      BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
      }
      in.close();
      System.out.println(response.toString());
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
}
var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://dashboard.360nrs.com/api/rest/images/generate',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  },
  'body': '{ "images": [ { "externalId": "test1", "extension": "jpg", "base64": "BASE64_ENCODED_STRING" }, { "externalId": "test2", "extension": "png", "base64": "BASE64_ENCODED_STRING" } ] }'
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/images/generate"

payload = "{ \"images\": [ { \"externalId\": \"test1\", \"extension\": \"jpg\", \"base64\": \"BASE64_ENCODED_STRING\" }, { \"externalId\": \"test2\", \"extension\": \"png\", \"base64\": \"BASE64_ENCODED_STRING\" } ] }"
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Basic YOUR_AUTH_TOKEN'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
require "uri"
require "net/http"

url = URI("https://dashboard.360nrs.com/api/rest/images/generate")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"
request.body = "{ \"images\": [ { \"externalId\": \"test1\", \"extension\": \"jpg\", \"base64\": \"BASE64_ENCODED_STRING\" }, { \"externalId\": \"test2\", \"extension\": \"png\", \"base64\": \"BASE64_ENCODED_STRING\" } ] }"

response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
  class HelloWorld {
    static void Main(string[] args) {
      var client = new RestClient("https://dashboard.360nrs.com/api/rest/images/generate");
      client.Timeout = -1;
      var request = new RestRequest(Method.POST);
      request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
      request.AddHeader("Content-Type", "application/json");
      request.AddParameter("application/json", "{ \"images\": [ { \"externalId\": \"test1\", \"extension\": \"jpg\", \"base64\": \"BASE64_ENCODED_STRING\" }, { \"externalId\": \"test2\", \"extension\": \"png\", \"base64\": \"BASE64_ENCODED_STRING\" } ] }",  ParameterType.RequestBody);
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

Response

{
  "data": [
    {
      "externalId": "test1",
      "imageUrl": "https://dashboard.360nrs.com/uploads/UCuh4pdOsW58ZEXX/1b4f0e9851971998e732078544c96b36c3d01cedf7caa332359d6f1d83567014.jpg",
      "error": false
    },
    {
      "externalId": "test2",
      "imageUrl": "https://dashboard.360nrs.com/uploads/UCuh4pdOsW58ZEXX/60303ae22b998861bce3b28f33eec1be758a213c86c93c076dbe9f558c11c752.jpg",
      "error": false
    }
  ]
}

Parâmetros

Parâmetro Tipo Obrigatório Descrição
externalId string Sim ID externo para identificar a imagem na resposta.
extension string Sim Extensão de imagem. Extensões permitidas: jpg, png.
base64 string Sim Imagem codificada em Base64.

SMS certificados

Baixe o certificado em PDF

GET https://dashboard.360nrs.com/api/rest/sms/certificates/<ID>

curl -X GET 'https://dashboard.360nrs.com/api/rest/sms/certificates/<ID>' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/sms/certificates/<ID>',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Basic YOUR_AUTH_TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;

public class App {
  public static void main(String[] args) {
    try {
      URL url = new URL("https://dashboard.360nrs.com/api/rest/sms/certificates/<ID>");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("GET");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
      }
      in.close();
      System.out.println(response.toString());
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
}
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://dashboard.360nrs.com/api/rest/sms/certificates/<ID>',
  'headers': {
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/sms/certificates/<ID>"

payload = {}
headers = {
  'Authorization': 'Basic YOUR_AUTH_TOKEN'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
require "uri"
require "net/http"

url = URI("https://dashboard.360nrs.com/api/rest/sms/certificates/<ID>")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"

response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
  class HelloWorld {
    static void Main(string[] args) {
      var client = new RestClient("https://dashboard.360nrs.com/api/rest/sms/certificates/<ID>");
      client.Timeout = -1;
      var request = new RestRequest(Method.GET);
      request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}
Parâmetro Tipo Obrigatório Descrição
id string Sim Identificador da mensagem retornada na resposta à chamada para api/rest/sms no campo id.

Eventos

Notificações de eventos

Introdução

O objetivo do serviço de notificação de estados é informar ao servidor do cliente os eventos que são gerados no serviço 360nrs. As notificações serão feitas para os envios feitos por qualquer tipo de canal. Desta forma, o cliente poderá rastrear em tempo real cada envio efetuado.

Um único envio pode provocar múltiplos eventos, pelo que um envio em massa pode gerar um número significativo de notificações ao servidor do cliente. Para evitar a saturação do servidor, os eventos a notificar são colocados em fila na 360nrs, pelo que se podem verificar atrasos na entrega de notificações se o servidor do cliente não for capaz de gerir o volume de notificações gerado.

Para ativar esta funcionalidade, o cliente deve fornecer um URL onde serão feitos os pedidos http POST para notificar um evento.

Receber nova notificação de evento

HTTP METHOD: POST

Parâmetros

Parâmetro Tipo Descrição
id string Identificador alfanumérico que foi entregue no envio por API da mensagem. Se a mensagem foi enviada pela web, não terá valor.
channel string Indica a que canal pertence o envio a que a notificação se refere. Os valores possíveis são: sms, mailing, landing, text2speech.
contactId integer Identificador único do contacto.
campaignId integer Identificador da campanha. Se foi enviado por API e não se especificou campaignName no envio, terá valor 0.
formId integer Identificador único do formulário. (Para eventos de formulário)
campaignName string Nome da campanha.
event string Indica o evento que ocorreu. Os valores possíveis são: delivered, opened, clicked, unsubscribed, hard_bounced, complaint, sent, soft_bounced, undelivered, rejected, expired, unsubscribed_landing, form_opened, form_submitted, form_rejected.
extra string Parâmetro extra com informações adicionais do evento no formato JSON.
O evento "form_submitted" conterá os valores inseridos no formulário pelo usuário no seguinte formato:

{"formValues":{"param1":"value1", "param2": "value2", ...}}

O evento "clicked" contenda a url a la que se ha hecho clic:

{"url":"url_encoded"}
smtpResponse string Variável opcional definida para o canal de e-mail e os eventos delivered, hard_bounced, soft_bounced. A resposta do servidor SMTP do email destinatário é devolvida.

As notificações são reintentadas em 5 ocasiões caso que o servidor do cliente responder a um código HTTP distinto a 200 OK.

O tempo de espera entre as notificações é progressivo, portanto a primeira tentativa será feita em 1 minuto, a segunda após 2 minutos desde a tentativa anterior, a terceira após 3 minutos, etc.

Relatório de eventos por envio

Reporte de eventos

GET https://dashboard.360nrs.com/api/rest/sendings/<sendingId>/reports/events

curl -X GET 'https://dashboard.360nrs.com/api/rest/sendings/1/reports/events' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/sendings/1/reports/events',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Basic YOUR_AUTH_TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;

public class App {
  public static void main(String[] args) {
    try {
      URL url = new URL("https://dashboard.360nrs.com/api/rest/sendings/1/reports/events");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("GET");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
      }
      in.close();
      System.out.println(response.toString());
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
}
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://dashboard.360nrs.com/api/rest/sendings/1/reports/events',
  'headers': {
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/sendings/1/reports/events"

payload = {}
headers = {
  'Authorization': 'Basic YOUR_AUTH_TOKEN'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
require "uri"
require "net/http"

url = URI("https://dashboard.360nrs.com/api/rest/sendings/1/reports/events")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"

response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
  class HelloWorld {
    static void Main(string[] args) {
      var client = new RestClient("https://dashboard.360nrs.com/api/rest/sendings/1/reports/events");
      client.Timeout = -1;
      var request = new RestRequest(Method.GET);
      request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

Filtros

Parámetro Descripción
beforeDate Mostrar os resultados anterores a data indicada. A data deve ser especificada no formato ISO 8601.
afterDate Mostrar os resultados posteriores a data indicada. A data deve ser especificada no formato ISO 8601.

Os parâmetros devem ser corretamente codificados (urlencode) em relação ao padrão RFC 3986 para ser admitido pelo servidor. Por exemplo, para consultar o relatório de eventos entre as datas 2019-01-01T00:00:00+00:00 y 2019-02-01T00:00:00+00:00:

https://dashboard.360nrs.com/api/rest/sendings/{sendingId}/reports/events?afterDate=2019-01-01T00%3A00%3A00%2B00%3A00&beforeDate=2019-02-01T00%3A00%3A00%2B00%3A00

Obter o relatório detalhado dos eventos gerados por uma remessa. A resposta estará no formato text/csv e conterá as seguintes colunas:

Para envíos text2speech: campaignName ,campaignId, sendingId, contactId, event, phone, email, landline, countryIso, callDurationSeconds, createdAt

Para o resto dos canais: campaignName, campaignId, sendingId, contactId, event, phone, email, landline, countryIso, browser, os, url, createdAt

Relatório de pressionamentos

Introdução

Retorna um relatório com os números de telefone junto com a tecla pressionada e a mensagem da locução.

Url

GET https://dashboard.360nrs.com/api/rest/sendings/<sendingId>/reports/keys

curl -X GET 'https://dashboard.360nrs.com/api/rest/sendings/1/reports/keys' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/sendings/1/reports/keys',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Basic YOUR_AUTH_TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;

public class App {
  public static void main(String[] args) {
    try {
      URL url = new URL("https://dashboard.360nrs.com/api/rest/sendings/1/reports/keys");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("GET");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
      }
      in.close();
      System.out.println(response.toString());
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
}
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://dashboard.360nrs.com/api/rest/sendings/1/reports/keys',
  'headers': {
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/sendings/1/reports/keys"

payload = {}
headers = {
  'Authorization': 'Basic YOUR_AUTH_TOKEN'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
require "uri"
require "net/http"

url = URI("https://dashboard.360nrs.com/api/rest/sendings/1/reports/keys")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"

response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
  class HelloWorld {
    static void Main(string[] args) {
      var client = new RestClient("https://dashboard.360nrs.com/api/rest/sendings/1/reports/keys");
      client.Timeout = -1;
      var request = new RestRequest(Method.GET);
      request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

Filtros

Parámetro Descripción
beforeDate Mostrar os resultados anterores a data indicada. A data deve ser especificada no formato ISO 8601.
afterDate Mostrar os resultados posteriores a data indicada. A data deve ser especificada no formato ISO 8601.

Os parâmetros devem ser corretamente codificados (urlencode) em relação ao padrão RFC 3986 para ser admitido pelo servidor. Por exemplo, para consultar o relatório de eventos entre as datas 2019-01-01T00:00:00+00:00 y 2019-02-01T00:00:00+00:00:

https://dashboard.360nrs.com/api/rest/sendings/{sendingId}/reports/keys?afterDate=2019-01-01T00%3A00%3A00%2B00%3A00&beforeDate=2019-02-01T00%3A00%3A00%2B00%3A00

Obtenha o relatório detalhado de pressionamentos de tecla de um envio de voz interativa. A resposta estará no formato text/csv e conterá as seguintes colunas: phonenumber, key, message

Conta

Retorna informação da conta como nome de usuário, email, fuso horário, idioma, saldo, data de criação, país e moeda.

GET https://dashboard.360nrs.com/api/rest/account

curl -X GET 'https://dashboard.360nrs.com/api/rest/account' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/account',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Basic YOUR_AUTH_TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;

public class App {
  public static void main(String[] args) {
    try {
      URL url = new URL("https://dashboard.360nrs.com/api/rest/account");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("GET");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      connection.setRequestProperty("Accept", "application/json");
      BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();
      while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
      }
      in.close();
      System.out.println(response.toString());
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
}
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://dashboard.360nrs.com/api/rest/account',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/account"

payload = {}
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Basic YOUR_AUTH_TOKEN'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
require "uri"
require "net/http"

url = URI("https://dashboard.360nrs.com/api/rest/account")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"

response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
  class HelloWorld {
    static void Main(string[] args) {
      var client = new RestClient("https://dashboard.360nrs.com/api/rest/account");
      client.Timeout = -1;
      var request = new RestRequest(Method.GET);
      request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
      request.AddHeader("Content-Type", "application/json");
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

Erros

Error Code HTTP Code Description
0 202 Accepted for delivery
101 500 Internal Database error
102 400 No valid recipients
103 401 Username or password unknown
104 400 Text message missing
105 400 Text message too long
106 400 Sender missing
107 400 Sender too long
108 400 No valid Datetime for send
109 400 Notification URL incorrect
110 400 Exceeded maximum parts allowed or incorrect number of parts
111 402 Not enough credits
112 401 IP address not allowed
113 400 Invalid coding
114 400 Invalid subject
115 400 Sender is not verified
116 400 Invalid replyTo
117 400 ReplyTo is not verified
118 401 Email blocked for exceeding the hard-bounced limit allowed
119 400 Invalid expiration date
120 400 Invalid GUID
121 400 Invalid scheduled date
122 500 Update error
123 500 Delete error
125 400 Invalid JSON
126 400 Empty campaign name
130 400 Invalid voice language
131 400 Invalid voice gender
132 400 Invalid voice caller
133 400 Invalid audio URL
134 400 Unsupported audio format
140 400 Template missing
141 400 Missing landing placeholder
142 400 Can't split variable placeholders
150 400 Missing billing profile
151 400 Error retrieving TPV url
152 400 Invalid VAT
153 400 Invalid method
154 400 Invalid conversion rate
155 400 Max limit reached
156 400 Min limit reached
157 400 Error generating invoice
160 400 Invalid voice interactive language
161 400 Invalid voice interactive gender
162 400 Invalid voice interactive caller
163 400 Invalid voice interactive audio URL
164 400 Unsupported voice interactive audio format
165 400 Invalid voice interactive speech type
166 400 Ivalid voice interactive menu option type
167 400 Trying to save an existing campaign
168 400 Empty speech type
169 400 Empty menu
170 400 Empty phone key
171 400 Phone Key is not a number
172 400 Phone key out of range
173 400 Empty menu options for sub menu
174 400 Empty phone prefix for call transfer
175 400 Empty phone for call transfer
176 400 Call retries value is not an integer
177 400 Call retries value out of range
178 400 Cost limit value is not an integer
179 400 Speech retries value is not an integer
180 400 Speech retries value out of range
181 400 Speech timeout seconds value is not an integer
182 400 Speech timeout seconds value out of range
183 400 Available times value is not an array
184 400 Available times day is not an integer
185 400 Available times day out of range
186 400 Available times from hour format error
187 400 Available times to hour format error
188 400 Available times from hour is greater than to hour
189 400 Missing available time object property
190 400 Call Retries is specified but its value is empty
191 400 Cost limit is specified but its value is empty
192 400 Speech Retries is specified but its value is empty
193 400 Speech timeout seconds is specified but its value is empty
194 400 Available times is specified but its value is empty
195 400 No valid contacts external IDs
196 400 Available times range is too short

Anexos

Conjunto de caracteres básico GSM7

 

0x00

0x10

0x20

0x30

0x40

0x50

0x60

0x70

0x00

@

Δ

SP

0

¡

P

¿

p

0x01

£

_

!

1

A

Q

a

q

0x02

$

Φ

"

2

B

R

b

r

0x03

¥

Γ

#

3

C

S