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:apiPassword 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 axios = require('axios');
var config = {
  method: 'post',
  url: 'https://dashboard.360nrs.com/api/rest/sms',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  },
  data: '{ "to": ["34666555444"], "from": "TEST", "message": "SMS text message" }'
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
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,
  "sendingId": 100001,
  "result": [
    {
      "accepted": true,
      "to": "34666555444",
      "id": "XXXXXXXXXXXXX",
      "parts": 1,
      "scheduledAt": null,
      "expiresAt": null
    }
  ]
}

HTTP Response Code 207 (MULTI-STATUS)

{
  "campaignId": 100000,
  "sendingId": 100001,
  "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 é 15.
notificationUrl string|array 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.
otpConfig object Não No caso de adicionar a variável {OTP_CODE} dentro do parâmetro "message" os parâmetros do código OTP podem ser especificados. Por exemplo:

{"alpha": true, "length": 5}

alpha: indique se o código é alfanumérico ou numérico. O valor padrão é false.
length: tamanho do código. O valor mínimo é 3 e o valor máximo é 10. O valor padrão é 4.
maxAttempts: número máximo de tentativas. O valor mínimo é 1 e o valor máximo é 10. O valor padrão é 3.
maxSecondsValidity: número máximo de segundos entre a criação e validação do código. O valor mínimo é 30 e o valor máximo é 600. O valor padrão é 60.
appId: o mesmo telefone ou e-mail pode ser validado ao mesmo tempo, desde que seja com um appId diferente. O valor padrão é "".
rejectIfPendingCode: impede a geração de um novo código OTP se existir um anterior em estado pendente. O valor por defeito é false.

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.

Vários URLs de notificação

Ao usar vários URLs de notificação, a matriz deve conter tantos itens quanto os destinatários de envio.

{
  "from": "TEST",
  "to": ["34666555444", "34666555333"],
  "message": "SMS text message",
  "notificationUrl": [
    "https://example.com/first-notification-url",
    "https://example.com/second-notification-url"
  ]
}

É possível especificar um URL de notificação diferente por destinatário.
Para isso você tem que usar um array para o parâmetro notificationUrl. A matriz deve conter tantos elementos quantos os destinatários de envio.

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:

https://example.com/notify.php?sender=%p&phone=%P&status=%s

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

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

https://example.com/notify.php?sender=%p&phone=%P&status=%s&customId=123456

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 axios = require('axios');
var config = {
  method: 'get',
  url: 'https://dashboard.360nrs.com/api/rest/sms/<ID>',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
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 axios = require('axios');
var config = {
  method: 'post',
  url: 'https://dashboard.360nrs.com/api/rest/mailing',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  },
  data: '{ "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" }'
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
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,
  "sendingId": 100001,
  "result": [
    {
      "accepted": true,
      "to": "test@example.com",
      "id": "XXXXXXXXXXXXX",
      "scheduledAt": null
    }
  ]
}

HTTP Response Code 207 (MULTI-STATUS)

{
  "campaignId": 100000,
  "sendingId": 100001,
  "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 legacy para enviar como o corpo do email. Necessário sem body. Este ID refere-se a modelos criados a partir da versão anterior (https://dashboard.360nrs.com) da aplicação 360NRS. Recomenda-se a utilização do parâmetro templateV2Id sempre que possível.
templateV2Id integer Não ID do modelo para enviar como o corpo do email. Necessário sem body. Este ID refere-se à versão atual (https://app.360nrs.com) da aplicação 360NRS.
to array Sim Emails destinatários do envio. É permitido indicar múltiplos destinatários.
cc array Não Emails destinatários em cópia do envio. É permitido indicar múltiplos destinatários.
bcc array Não Emails destinatários em cópia oculta 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.
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.Los archivos adjuntos tienen coste adicional
attachments array Não Anexos do email. Uma array de objetos é definido da seguinte maneira:

[{
"name": "filename.txt",
"content": "Ci4vYmluL3pvb2tlZ...",
"contentType": "text/plain"
}]


name: nome do arquivo.
content: conteúdo do arquivo em base64.
contentType: Content type do arquivo.

* Os anexos têm um custo adicional
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.
otpConfig object Não No caso de adicionar a variável {OTP_CODE} dentro do parâmetro "body" os parâmetros do código OTP podem ser especificados. Por exemplo:

{"alpha": true, "length": 5}

alpha: indique se o código é alfanumérico ou numérico. O valor padrão é false.
length: tamanho do código. O valor mínimo é 3 e o valor máximo é 10. O valor padrão é 4.
maxAttempts: número máximo de tentativas. O valor mínimo é 1 e o valor máximo é 10. O valor padrão é 3.
maxSecondsValidity: número máximo de segundos entre a criação e validação do código. O valor mínimo é 30 e o valor máximo é 600. O valor padrão é 60.
appId: o mesmo telefone ou e-mail pode ser validado ao mesmo tempo, desde que seja com um appId diferente. O valor padrão é "".
rejectIfPendingCode: impede a geração de um novo código OTP se existir um anterior em estado pendente. O valor por defeito é false.

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 axios = require('axios');
var config = {
  method: 'post',
  url: 'https://dashboard.360nrs.com/api/rest/voice',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  },
  data: '{ "to": ["34666666666"], "message": "Esto es un test de mensaje de voz", "gender": "F", "language": "es_ES" }'
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
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,
  "sendingId": 100001,
  "result": [
    {
      "accepted": true,
      "to": "34666666666",
      "id": "XXXXXXXXXXXXX",
      "scheduledAt": null,
      "expiresAt": null
    }
  ]
}

HTTP Response Code 207 (MULTI-STATUS)

{
  "campaignId": 100000,
  "sendingId": 100001,
  "result": [
    {
      "accepted": true,
      "to": "34666666666",
      "id": "XXXXXXXXXXXXX",
      "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.
retries integer Não Número máximo de tentativas. Máximo 5. Se não for especificado, não haverá novas tentativas.
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.
amd boolean Não Answer Machine Detection (AMD): Detecta se a chamada foi atendida por uma secretária eletrônica, em caso afirmativo, automaticamente encerra a chamada. O valor padrão é false.

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 axios = require('axios');
var config = {
  method: 'post',
  url: 'https://dashboard.360nrs.com/api/rest/voiceAudio',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  },
  data: '{ "to": ["34666666666"], "audioUrl": "https://example.com/audio.mp3" }'
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
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,
  "sendingId": 100001,
  "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.
retries integer No Número máximo de tentativas. Máximo 5. Se não for especificado, não haverá novas tentativas.
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.
amd boolean Não Answer Machine Detection (AMD): Detecta se a chamada foi atendida por uma secretária eletrônica, em caso afirmativo, automaticamente encerra a chamada. O valor padrão é false.

Política de tentativas

Se o número máximo de tentativas for especificado na variável opcional retries, o sistema tentará automaticamente novas chamadas não atendidas. 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 10 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 10 minutos.

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 axios = require('axios');
var config = {
  method: 'post',
  url: 'https://dashboard.360nrs.com/api/rest/landingsms',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  },
  data: '{ "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>" }'
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
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,
  "sendingId": 100001,
  "result": [
    {
      "accepted": true,
      "to": "34666555444",
      "id": "XXXXXXXXXXXXX",
      "parts": 1,
      "scheduledAt": null,
      "expiresAt": null
    }
  ]
}

HTTP Response Code 207 (MULTI-STATUS)

{
  "campaignId": 100000,
  "sendingId": 100001,
  "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 legacy para enviar como conteúdo da página de destino. Obrigatório sem templateBody. Este ID refere-se a modelos criados a partir da versão anterior (https://dashboard.360nrs.com) da aplicação 360NRS. Recomenda-se a utilização do parâmetro templateV2Id sempre que possível.
templateV2Id integer Não ID do modelo para enviar como conteúdo da página de destino. Obrigatório sem templateBody. Este ID refere-se à versão atual (https://app.360nrs.com) da aplicação 360NRS.

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

WhatsApp

Enviar modelo do WhatsApp

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

curl -X POST 'https://dashboard.360nrs.com/api/rest/whatsapp' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
    "templateId": 123,
    "from": "34666777555",
    "messages": [
        {
            "to": "34666555444"
        }
    ]
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/whatsapp',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => '{
    "templateId": 123,
    "from": "34666777555",
    "messages": [
        {
            "to": "34666555444"
        }
    ]
}',
  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/whatsapp");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("POST");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      connection.setRequestProperty("Accept", "application/json");
      String requestBody = "{ \"templateId\": 123, \"from\": \"34666777555\", \"messages\": [ { \"to\": \"34666555444\" } ] }";
      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 axios = require('axios');
var config = {
  method: 'post',
  url: 'https://dashboard.360nrs.com/api/rest/whatsapp',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  },
  data: '{ "templateId": 123, "from": "34666777555", "messages": [ { "to": "34666555444" } ] }'
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
import requests

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

payload = "{ \"templateId\": 123, \"from\": \"34666777555\", \"messages\": [ { \"to\": \"34666555444\" } ] }"
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/whatsapp")

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 = "{ \"templateId\": 123, \"from\": \"34666777555\", \"messages\": [ { \"to\": \"34666555444\" } ] }"

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/whatsapp");
      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", "{ \"templateId\": 123, \"from\": \"34666777555\", \"messages\": [ { \"to\": \"34666555444\" } ] }",  ParameterType.RequestBody);
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

Response

HTTP Response Code 202 (ACCEPTED)

{
  "campaignId": 100000,
  "sendingId": 100001,
  "result": [
    {
      "accepted": true,
      "to": "34666555444",
      "id": "04c80b02-8c0c-4884-bab8-89d6bc1fe406"
    }
  ]
}

HTTP Response Code 207 (MULTI-STATUS)

{
  "campaignId": 100000,
  "sendingId": 100001,
  "result": [
    {
      "accepted": true,
      "to": "34666555444",
      "id": "8b4e5d35-dc16-4e2e-8a9c-c222db81f5ba"
    },
    {
      "accepted": false,
      "to": "34",
      "error": {
        "code": 102,
        "description": "The messages.1.to field does not contain a valid phone number"
      }
    }
  ]
}

Error response (HTTP 400)

{
  "error": {
    "code": 140,
    "description": "Invalid template"
  }
}

Parâmetros

Parâmetro Tipo Obrigatório Descrição
templateId integer Sim ID do modelo WhatsApp a enviar. O modelo deve ser aprovado para envio a partir da plataforma.
from string Sim Remetente da mensagem. O remetente deve estar registado na plataforma.
messages array Sim Conjunto de mensagens a enviar.
messages.*.to string Sim Número do telefone móvel destinatário da mensagem. Deve-se incluir o prefixo do país destinatário. (Exemplo Brasil 5511966778899).
messages.*.headerFields array Não* Matriz de variáveis de substituição posicionais a serem aplicadas ao cabeçalho. Necessário para modelos com variáveis de cabeçalho.
messages.*.bodyFields array Não* Matriz de variáveis de substituição posicionais a aplicar ao corpo da mensagem. Necessário para modelos com variáveis de mensagem.
messages.*.callToActionFields array Não* Conjunto de variáveis de substituição posicional a aplicar aos botões de interação. Necessário para modelos com variáveis de ação.
messages.*.defaultAnswer array Não Resposta por defeito à primeira mensagem do utilizador.
messages.*.buttonAnswers array Não Conjunto de respostas posicionais para botões de resposta rápida.
messages.*.location object Não* Informações sobre a localização. Obrigatório para os modelos que contêm a localização.
messages.*.location.lat string Não* Latitude do ponto geográfico. Obrigatório para os modelos que contêm a localização.
messages.*.location.long string Não* Longitude do ponto geográfico. Obrigatório para os modelos que contêm a localização.
messages.*.location.name string Não Nome da localização.
messages.*.location.address string Não Endereço da localização.
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 Lista de tags para adicionar à campanha. As tags podem ser usadas para filtrar as estatísticas no painel.

Exemplos de envio

Exemplos de envio de vários tipos de modelos do WhatsApp.

Modelo de envio com variáveis e respostas automáticas.

{
  "templateId": 123,
  "from": "34666777555",
  "messages": [
    {
      "to": "34666555444",
      "headerFields": ["headerField1"],
      "bodyFields": ["bodyField1", "bodyField2"],
      "callToActionFields": ["actionField1"],
      "defaultAnswer": "Example answer",
      "buttonAnswers": [
        "first button answer",
        "second button answer",
      ]
    }
  ]
}

Envio de modelo com localização.

{
  "templateId": 123,
  "from": "34666777555",
  "messages": [
    {
      "to": "34666555444",
      "location": {
        "lat": "39.92516922986921",
        "long": "-0.10572674363232447",
        "name": "NRS-Group",
        "address": "Carrer, Av. Arcadi Garcia Sanz, 19, 12540 Vila-real, Castelló"
      }
    }
  ]
}

Envio de modelo com código de autenticação.

{
  "templateId": 123,
  "from": "34666777555",
  "messages": [
    {
      "to": "34666555444",
      "bodyFields": ["auth_code"]
    }
  ]
}

Lista de conversas

GET https://dashboard.360nrs.com/api/rest/whatsapp/conversations

curl -X GET 'https://dashboard.360nrs.com/api/rest/whatsapp/conversations' \
-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/whatsapp/conversations',
  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/whatsapp/conversations");
      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 axios = require('axios');
var config = {
  method: 'get',
  url: 'https://dashboard.360nrs.com/api/rest/whatsapp/conversations',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
import requests

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

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/whatsapp/conversations")

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/whatsapp/conversations");
      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": [
    {
      "from": "34666777555",
      "to": "34666555444",
      "totalMessages": 10,
      "status": "OPEN",
      "isSessionActive": true,
      "sessionExpiresAt": "2024-01-02T10:00:00+00:00",
      "createdAt": "2024-01-01T10:00:00+00:00",
      "updatedAt": "2024-01-01T10:00:00+00:00",
      "links": {
        "messages": "https://dashboard.360nrs.com/api/rest/whatsapp/conversations/34666777555/34666555444/messages"
      },
      "contact": {
        "data": {
          "msisdn": "34666555444",
          "firstName": "First",
          "lastName": "Last",
          "email": "email@example.com",
          "interest": "Interest example",
          "comment": "Comment example",
          "country": "ES"
        }
      }
    }
  ],
  "meta": {
    "pagination": {
      "total": 500,
      "count": 100,
      "per_page": 100,
      "current_page": 1,
      "total_pages": 5,
      "links": {
        "next": "https://dashboard.360nrs.com/api/rest/whatsapp/conversations&page=2"
      }
    }
  }
}

Filtros

Parâmetro Descrição
limit Número total de conversas a apresentar num único pedido. Valor por defeito: 100. Máximo: 1000.
from Filtrar por remetente.
to Filtrar por destinatário.

Mostrar uma conversa

GET https://dashboard.360nrs.com/api/rest/whatsapp/conversations/<from>/<to>

curl -X GET 'https://dashboard.360nrs.com/api/rest/whatsapp/conversations/34666777555/34666555444' \
-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/whatsapp/conversations/34666777555/34666555444',
  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/whatsapp/conversations/34666777555/34666555444");
      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 axios = require('axios');
var config = {
  method: 'get',
  url: 'https://dashboard.360nrs.com/api/rest/whatsapp/conversations/34666777555/34666555444',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/whatsapp/conversations/34666777555/34666555444"

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/whatsapp/conversations/34666777555/34666555444")

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/whatsapp/conversations/34666777555/34666555444");
      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": {
    "from": "34666777555",
    "to": "34666555444",
    "totalMessages": 10,
    "status": "OPEN",
    "isSessionActive": true,
    "sessionExpiresAt": "2024-01-02T10:00:00+00:00",
    "createdAt": "2024-01-01T10:00:00+00:00",
    "updatedAt": "2024-01-01T10:00:00+00:00",
    "links": {
      "messages": "https://dashboard.360nrs.com/api/rest/whatsapp/conversations/34666777555/34666555444/messages"
    },
    "contact": {
      "data": {
        "msisdn": "34666555444",
        "firstName": "First",
        "lastName": "Last",
        "email": "email@example.com",
        "interest": "Interest example",
        "comment": "Comment example",
        "country": "ES"
      }
    }
  }
}

Mostrar as mensagens numa conversa

GET https://dashboard.360nrs.com/api/rest/whatsapp/conversations/<from>/<to>/messages

curl -X GET 'https://dashboard.360nrs.com/api/rest/whatsapp/conversations/34666777555/34666555444/messages' \
-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/whatsapp/conversations/34666777555/34666555444/messages',
  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/whatsapp/conversations/34666777555/34666555444/messages");
      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 axios = require('axios');
var config = {
  method: 'get',
  url: 'https://dashboard.360nrs.com/api/rest/whatsapp/conversations/34666777555/34666555444/messages',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/whatsapp/conversations/34666777555/34666555444/messages"

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/whatsapp/conversations/34666777555/34666555444/messages")

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/whatsapp/conversations/34666777555/34666555444/messages");
      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": "f564433e-7cd1-47fa-af98-1bd632411b26",
      "type": "text",
      "msisdn": "34666555444",
      "content": "User response",
      "reactions": [],
      "sentAt": "2024-01-01T11:00:00+00:00",
      "deliveredAt": "2024-01-01T11:00:00+00:00",
      "readAt": "2024-01-01T11:01:00+00:00",
      "failedAt": null
    },
    {
      "id": "a8249e62-55a8-4f17-bf6c-c7ad2d844374",
      "type": "template",
      "msisdn": "34666777555",
      "content": "Template content",
      "reactions": ["👍"],
      "sentAt": "2024-01-01T10:00:00+00:00",
      "deliveredAt": "2024-01-01T10:00:00+00:00",
      "readAt": "2024-01-01T10:01:00+00:00",
      "failedAt": null
    }
  ],
  "meta": {
    "status": "OPEN",
    "isSessionActive": true,
    "sessionExpiresAt": "2024-01-02T10:00:00+00:00",
    "pagination": {
      "total": 500,
      "count": 100,
      "per_page": 100,
      "current_page": 1,
      "total_pages": 5,
      "links": {
        "next": "https://dashboard.360nrs.com/api/rest/whatsapp/conversations/34666777555/34666555444/messages&page=2"
      }
    }
  }
}

Filtros

Parâmetro Descrição
limit Número total de mensagens a apresentar num único pedido. Valor por defeito: 100. Máximo: 1000.

Enviar uma mensagem para uma conversa

POST https://dashboard.360nrs.com/api/rest/whatsapp/conversations/<from>/<to>/messages

curl -X POST 'https://dashboard.360nrs.com/api/rest/whatsapp/conversations/34666777555/34666555444/messages' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
    "content": "Message content"
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/whatsapp/conversations/34666777555/34666555444/messages',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => '{
    "content": "Message content"
}',
  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/whatsapp/conversations/34666777555/34666555444/messages");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("POST");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      connection.setRequestProperty("Accept", "application/json");
      String requestBody = "{ \"content\": \"Message content\" }";
      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 axios = require('axios');
var config = {
  method: 'post',
  url: 'https://dashboard.360nrs.com/api/rest/whatsapp/conversations/34666777555/34666555444/messages',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  },
  data: '{ "content": "Message content" }'
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/whatsapp/conversations/34666777555/34666555444/messages"

payload = "{ \"content\": \"Message content\" }"
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/whatsapp/conversations/34666777555/34666555444/messages")

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 = "{ \"content\": \"Message content\" }"

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/whatsapp/conversations/34666777555/34666555444/messages");
      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", "{ \"content\": \"Message content\" }",  ParameterType.RequestBody);
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

Parâmetros

Parâmetro Tipo Obrigatório Descrição
content string Sim Conteúdo da mensagem. Pode alterar o formato de texto das suas mensagens.

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 axios = require('axios');
var config = {
  method: 'get',
  url: 'https://dashboard.360nrs.com/api/rest/scheduled',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
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",
      "sending_id": 123,
      "updated_at": "2017-09-18 10:49:12",
      "scheduled_at": "2017-11-11 10:10:10"
    },
    {
      "guid": "101",
      "type": "SMS",
      "sending_id": 123,
      "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",
      "sending_id": 123,
      "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": {
        "to": "34666555444",
        "from": "360NRS",
        "encoding": "gsm",
        "message": "This is a test",
        "campaignId": 456,
        "sendingId": 123
    },
    "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
sendingId integer Não Identificador de envio.

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 axios = require('axios');
var config = {
  method: 'put',
  url: 'https://dashboard.360nrs.com/api/rest/scheduled',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  },
  data: '{ "guid": [100,101], "scheduleDate": "20171011093000" }'
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
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 axios = require('axios');
var config = {
  method: 'delete',
  url: 'https://dashboard.360nrs.com/api/rest/scheduled',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  },
  data: '{ "guid": [100, 101] }'
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
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 axios = require('axios');
var config = {
  method: 'get',
  url: 'https://dashboard.360nrs.com/api/rest/campaigns',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
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, voice-interactive. 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, text2speech, voice-interactive.
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 voz.
opened_unique: Total de aberturas únicas. Não aplicável a sms e voz.
clicked: O contato clicou em um link incluído na mensagem. Não aplicável a sms e voz.
clicked_unique: Total de cliques únicos. Não aplicável a sms e voz.
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 axios = require('axios');
var config = {
  method: 'get',
  url: 'https://dashboard.360nrs.com/api/rest/contacts?include=customFields,groups',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
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.
email Filtrar os contactos para um e-mail especificado: email=myemail@example.com.
phone Filtrar os contactos para um telefone especificado: phone=34666666666.
landline Filtrar os contactos para um telefone fixo especificado: landline=900222222.
countryIso Filtrar os contactos para um país especificado: countryIso=ES.
externalId Filtrar os contactos para um externalId especificado: externalId=EXT1.

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 axios = require('axios');
var config = {
  method: 'get',
  url: 'https://dashboard.360nrs.com/api/rest/contacts/1?include=customFields,groups',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
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.

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 axios = require('axios');
var config = {
  method: 'post',
  url: 'https://dashboard.360nrs.com/api/rest/contacts',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  },
  data: '{ "email": "new.contact@example.com", "phone": "3466666666", "countryIso": "ES", "groupsNames": ["My contact list"], "customFields": [ { "key": "company", "value": "ACME inc." } ] }'
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
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 axios = require('axios');
var config = {
  method: 'put',
  url: 'https://dashboard.360nrs.com/api/rest/contacts/1',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  },
  data: '{ "email": "new.contact@example.com", "phone": "3466666666", "countryIso": "ES", "groupsNames": ["My contact list"], "customFields": [ { "key": "company", "value": "ACME inc." } ] }'
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
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 axios = require('axios');
var config = {
  method: 'delete',
  url: 'https://dashboard.360nrs.com/api/rest/contacts/1',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
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 axios = require('axios');
var config = {
  method: 'get',
  url: 'https://dashboard.360nrs.com/api/rest/groups',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
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 axios = require('axios');
var config = {
  method: 'get',
  url: 'https://dashboard.360nrs.com/api/rest/groups/1',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
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"
  }
}

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 axios = require('axios');
var config = {
  method: 'post',
  url: 'https://dashboard.360nrs.com/api/rest/groups',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  },
  data: '{ "name": "My new contact list" }'
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
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/<ID>

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 axios = require('axios');
var config = {
  method: 'put',
  url: 'https://dashboard.360nrs.com/api/rest/groups',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  },
  data: '{ "name": "My new contact list" }'
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
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 axios = require('axios');
var config = {
  method: 'delete',
  url: 'https://dashboard.360nrs.com/api/rest/groups/1',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
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 axios = require('axios');
var config = {
  method: 'get',
  url: 'https://dashboard.360nrs.com/api/rest/validation/emails',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
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 axios = require('axios');
var config = {
  method: 'get',
  url: 'https://dashboard.360nrs.com/api/rest/validation/emails/123',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
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 axios = require('axios');
var config = {
  method: 'get',
  url: 'https://dashboard.360nrs.com/api/rest/validation/emails/123/result',
  headers: {
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
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 axios = require('axios');
var config = {
  method: 'post',
  url: 'https://dashboard.360nrs.com/api/rest/validation/emails',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  },
  data: '{ "groupsIds": [1111], "force": false, "notificationUrl": "https://example.com/notificationUrl" }'
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
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.
allowRisky boolean No Valor por defeito false. Se o valor for false, os e-mails duvidosos serão adicionados à lista negra, impedindo-os de serem enviados. Se o valor for true, estes e-mails serão autorizados a serem enviados.
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 axios = require('axios');
var config = {
  method: 'delete',
  url: 'https://dashboard.360nrs.com/api/rest/validation/emails/123',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
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/v2/blacklist/{type}

curl -X GET 'https://dashboard.360nrs.com/api/rest/v2/blacklist/mailing' \
-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/v2/blacklist/mailing',
  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/v2/blacklist/mailing");
      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 axios = require('axios');
var config = {
  method: 'get',
  url: 'https://dashboard.360nrs.com/api/rest/v2/blacklist/mailing',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
import requests

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

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/v2/blacklist/mailing")

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/v2/blacklist/mailing");
      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": [
    {
      "type": "mailing",
      "recipient": "test@example.com",
      "isDefinitive": false,
      "sendingId": 123,
      "campaignName": "TEST_CAMPAIGN",
      "createdAt": "2020-01-01T00:00:00+00:00"
    }
  ],
  "meta": {
    "pagination": {
      "total": 500,
      "count": 100,
      "per_page": 100,
      "current_page": 1,
      "total_pages": 5,
      "links": {
        "next": "https://dashboard.360nrs.com/api/rest/v2/blacklist/mailing?page=2"
      }
    }
  }
}

Parâmetros de URL

Parâmetro Descrição
type Tipo de lista negra: sms, mailing, voice.

Filtros

Parâmetro Descrição
limit Total de contatos a serem exibidos em uma única petição. Valor por defeito: 100. Máximo: 1000.
recipient Filtrar por destinatário. Exemplo: ?recipient=test%40example.com
sendingId Filtrar por sendingId. Exemplo: ?sendingId=123

Adicionar contacto na lista negra

PUT https://dashboard.360nrs.com/api/rest/v2/blacklist/{type}

curl -X PUT 'https://dashboard.360nrs.com/api/rest/v2/blacklist/mailing' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
  "recipient": "test@example.com"
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/v2/blacklist/mailing',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'PUT',
  CURLOPT_POSTFIELDS => '{
  "recipient": "test@example.com"
}',
  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/v2/blacklist/mailing");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("PUT");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      connection.setRequestProperty("Accept", "application/json");
      String requestBody = "{ \"recipient\": \"test@example.com\" }";
      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 axios = require('axios');
var config = {
  method: 'put',
  url: 'https://dashboard.360nrs.com/api/rest/v2/blacklist/mailing',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  },
  data: '{ "recipient": "test@example.com" }'
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
import requests

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

payload = "{ \"recipient\": \"test@example.com\" }"
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/v2/blacklist/mailing")

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 = "{ \"recipient\": \"test@example.com\" }"

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/v2/blacklist/mailing");
      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", "{ \"recipient\": \"test@example.com\" }",  ParameterType.RequestBody);
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

Response (HTTP 200)

{
  "data": {
    "type": "mailing",
    "recipient": "test@example.com",
    "isDefinitive": false,
    "campaignName": null,
    "createdAt": "2020-01-01T00:00:00+00:00"
  }
}

Parâmetros de URL

Parâmetro Descrição
type Tipo de lista negra: sms, mailing, voice.

Parâmetros

Parâmetro Tipo Obrigatório Descrição
recipient string Sim Destinatário para adicionar à lista negra.

Eliminar contacto da lista negra

DELETE https://dashboard.360nrs.com/api/rest/v2/blacklist/{type}

curl -X DELETE 'https://dashboard.360nrs.com/api/rest/v2/blacklist/mailing' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
  "recipient": "test@example.com"
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/v2/blacklist/mailing',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'DELETE',
  CURLOPT_POSTFIELDS => '{
  "recipient": "test@example.com"
}',
  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/v2/blacklist/mailing");
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setRequestMethod("DELETE");
      connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
      connection.setRequestProperty("Accept", "application/json");
      String requestBody = "{ \"recipient\": \"test@example.com\" }";
      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 axios = require('axios');
var config = {
  method: 'delete',
  url: 'https://dashboard.360nrs.com/api/rest/v2/blacklist/mailing',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  },
  data: '{ "recipient": "test@example.com" }'
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
import requests

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

payload = "{ \"recipient\": \"test@example.com\" }"
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/v2/blacklist/mailing")

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 = "{ \"recipient\": \"test@example.com\" }"

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/v2/blacklist/mailing");
      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", "{ \"recipient\": \"test@example.com\" }",  ParameterType.RequestBody);
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

Parâmetros de URL

Parâmetro Descrição
type Tipo de lista negra: sms, mailing, voice.

Parâmetros

Parâmetro Tipo Obrigatório Descrição
recipient string Sim Destinatário a ser removido da lista negra.

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 axios = require('axios');
var config = {
  method: 'get',
  url: 'https://dashboard.360nrs.com/api/rest/templates',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
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 axios = require('axios');
var config = {
  method: 'get',
  url: 'https://dashboard.360nrs.com/api/rest/templates/1',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
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 axios = require('axios');
var config = {
  method: 'post',
  url: 'https://dashboard.360nrs.com/api/rest/templates',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  },
  data: '{ "name": "New Template", "html": "<h1>Hello world</h1>" }'
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
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 axios = require('axios');
var config = {
  method: 'put',
  url: 'https://dashboard.360nrs.com/api/rest/templates/1',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  },
  data: '{ "name": "New Template", "html": "<h1>Hello world</h1>" }'
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
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 axios = require('axios');
var config = {
  method: 'delete',
  url: 'https://dashboard.360nrs.com/api/rest/templates/1',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
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 axios = require('axios');
var config = {
  method: 'get',
  url: 'https://dashboard.360nrs.com/api/rest/templates/1/preview',
  headers: {
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
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>

Templates V2

Lista de templates

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

curl -X GET 'https://dashboard.360nrs.com/api/rest/v2/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/v2/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/v2/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 axios = require('axios');
var config = {
  method: 'get',
  url: 'https://dashboard.360nrs.com/api/rest/v2/templates',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/v2/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/v2/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/v2/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",
      "type": "HTML",
      "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/v2/templates/<ID>

curl -X GET 'https://dashboard.360nrs.com/api/rest/v2/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/v2/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/v2/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 axios = require('axios');
var config = {
  method: 'get',
  url: 'https://dashboard.360nrs.com/api/rest/v2/templates/1',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/v2/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/v2/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/v2/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",
    "type": "HTML",
    "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/v2/templates

curl -X POST 'https://dashboard.360nrs.com/api/rest/v2/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/v2/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/v2/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 axios = require('axios');
var config = {
  method: 'post',
  url: 'https://dashboard.360nrs.com/api/rest/v2/templates',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  },
  data: '{ "name": "New Template", "html": "<h1>Hello world</h1>" }'
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/v2/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/v2/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/v2/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",
    "type": "HTML",
    "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/v2/templates/1",
      "preview": "https://dashboard.360nrs.com/api/rest/v2/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/v2/templates/<ID>

curl -X PUT 'https://dashboard.360nrs.com/api/rest/v2/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/v2/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/v2/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 axios = require('axios');
var config = {
  method: 'put',
  url: 'https://dashboard.360nrs.com/api/rest/v2/templates/1',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  },
  data: '{ "name": "New Template", "html": "<h1>Hello world</h1>" }'
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/v2/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/v2/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/v2/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",
    "type": "HTML",
    "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/v2/templates/1",
      "preview": "https://dashboard.360nrs.com/api/rest/v2/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/v2/templates/<ID>

curl -X DELETE 'https://dashboard.360nrs.com/api/rest/v2/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/v2/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/v2/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 axios = require('axios');
var config = {
  method: 'delete',
  url: 'https://dashboard.360nrs.com/api/rest/v2/templates/1',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/v2/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/v2/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/v2/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/v2/templates/<ID>/preview

curl -X GET 'https://dashboard.360nrs.com/api/rest/v2/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/v2/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/v2/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 axios = require('axios');
var config = {
  method: 'get',
  url: 'https://dashboard.360nrs.com/api/rest/v2/templates/1/preview',
  headers: {
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
import requests

url = "https://dashboard.360nrs.com/api/rest/v2/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/v2/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/v2/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 axios = require('axios');
var config = {
  method: 'post',
  url: 'https://dashboard.360nrs.com/api/rest/forms',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  },
  data: '{ "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"} ] }'
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
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 axios = require('axios');
var config = {
  method: 'put',
  url: 'https://dashboard.360nrs.com/api/rest/forms',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  },
  data: '{ "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"} ] }'
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
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 axios = require('axios');
var config = {
  method: 'get',
  url: 'https://dashboard.360nrs.com/api/rest/forms',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
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 axios = require('axios');
var config = {
  method: 'get',
  url: 'https://dashboard.360nrs.com/api/rest/forms/1',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Basic YOUR_AUTH_TOKEN'
  }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
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 axios = require('axios');
var config = {
  method: