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:
%i
ID da 360NRS que é gerado no momento do envio.%p
remetente utilizado no envio da mensagem.%P
número do telefone utilizado no envio da mensagem SMS.%t
data do envio da mensagem no formatoYYYY-MM-DD HH:MM
, exemplo: 2015-09-21 14:18.%c
custo da mensagem.%s
status:REJECTD
,DELIVRD
,EXPIRED
,DELETED
,UNDELIV
,ACCEPTD
,UNKNOWN
,RECEIVED
.%m
mnc da operadora (em países onde disponível).%y
data do DLR da mensagem no formatoYYYY-MM-DD HH:MM
, exemplo: 2020-09-21 14:19%n
número da parte (mensagens concatenadas).%C
identificador de campanha.%S
identificador de envio.
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. |
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 : 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 |
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 . |
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 |
---|---|---|---|
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 |
---|---|---|---|
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>
Links personalizados
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>
Links personalizados
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: 'delete',
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("DELETE", url, headers=headers, data=payload)
print(response.text)
require "uri"
require "net/http"
url = URI("https://dashboard.360nrs.com/api/rest/forms/1")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"
response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
class HelloWorld {
static void Main(string[] args) {
var client = new RestClient("https://dashboard.360nrs.com/api/rest/forms/1");
client.Timeout = -1;
var request = new RestRequest(Method.DELETE);
request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
request.AddHeader("Content-Type", "application/json");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
}
}
}
Caso o pedido seja bem sucedido, responderá com um código HTTP 204.
Pré-visualizar um formulário
GET
https://dashboard.360nrs.com/api/rest/forms/<ID>/preview
curl -X GET 'https://dashboard.360nrs.com/api/rest/forms/1/preview' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/forms/1/preview',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;
public class App {
public static void main(String[] args) {
try {
URL url = new URL("https://dashboard.360nrs.com/api/rest/forms/1/preview");
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
} catch (Exception e) {
// TODO: handle exception
}
}
}
var axios = require('axios');
var config = {
method: 'get',
url: 'https://dashboard.360nrs.com/api/rest/forms/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/forms/1/preview"
payload = {}
headers = {
'Authorization': 'Basic YOUR_AUTH_TOKEN'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
require "uri"
require "net/http"
url = URI("https://dashboard.360nrs.com/api/rest/forms/1/preview")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"
response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
class HelloWorld {
static void Main(string[] args) {
var client = new RestClient("https://dashboard.360nrs.com/api/rest/forms/1/preview");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
}
}
}
A resposta conterá uma prévia do modelo no formato HTML. Caso o pedido seja bem sucedido, responderá com um código HTTP 200.
Elementos do formulário
H1
H1
{
"type": "h1",
"label": "My title"
}
H2
H2
{
"type": "h2",
"label": "My title"
}
H3
H3
{
"type": "h3",
"label": "My title"
}
H4
H4
{
"type": "h4",
"label": "My title"
}
Paragraph
Paragraph
{
"type": "p",
"label": "This is my paragraph"
}
Blockquote
Blockquote
{
"type": "blockquote",
"label": "My blockquote"
}
Input text
Input text
{
"type": "text",
"label": "My field",
"required": true,
"description": "Help text",
"placeholder": "My placeholder",
"customField": "my_string_custom_field"
}
Input password
Input password
{
"type": "password",
"label": "My field",
"required": true,
"description": "Help text",
"placeholder": "My placeholder",
"customField": "my_string_custom_field"
}
Input email
Input email
{
"type": "email",
"label": "My field",
"required": true,
"description": "Help text",
"placeholder": "My placeholder",
"customField": "my_string_custom_field"
}
Input number
Input number
{
"type": "number",
"label": "My field",
"required": true,
"description": "Help text",
"placeholder": "My placeholder",
"customField": "my_decimal_custom_field"
}
Textarea
Textarea
{
"type": "textarea",
"label": "My field",
"required": true,
"description": "Help text",
"placeholder": "My placeholder",
"customField": "my_string_custom_field",
"rows": 3
}
Date picker
Date picker
{
"type": "date",
"label": "My field",
"required": true,
"description": "Help text",
"placeholder": "My placeholder",
"customField": "my_date_custom_field"
}
Color picker
Color picker
{
"type": "color",
"label": "My field",
"required": true,
"description": "Help text",
"placeholder": "My placeholder",
"customField": "my_string_custom_field"
}
Country select
Country select
{
"type": "countrySelector",
"label": "My field",
"required": true,
"description": "Help text",
"customField": "my_string_custom_field"
}
Select
Select
{
"type": "select",
"label": "My field",
"required": true,
"description": "Help text",
"customField": "my_string_custom_field",
"options": [
{"label": "Label 1", "value": "value1"},
{"label": "Label 2", "value": "value2"},
{"label": "Label 3", "value": "value3"}
]
}
Input radio
Input radio
{
"type": "radio",
"label": "My field",
"required": true,
"description": "Help text",
"customField": "my_string_custom_field",
"options": [
{"label": "Label 1", "value": "value1"},
{"label": "Label 2", "value": "value2"},
{"label": "Label 3", "value": "value3"}
]
}
Input checkbox
Input checkbox
{
"type": "checkbox",
"label": "My checkbox text",
"required": true,
"customField": "my_decimal_custom_field",
}
Encurtador urls
Criação de url curtas
POST
https://dashboard.360nrs.com/api/rest/shortener/shorten
Request
curl -X POST 'https://dashboard.360nrs.com/api/rest/shortener/shorten' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
"urls": [
{"longUrl": "https://example.com/test1"},
{"longUrl": "https://example.com/test2"},
{"longUrl": "invalidUrl"}
]
}'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/shortener/shorten',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => '{
"urls": [
{"longUrl": "https://example.com/test1"},
{"longUrl": "https://example.com/test2"},
{"longUrl": "invalidUrl"}
]
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;
public class App {
public static void main(String[] args) {
try {
URL url = new URL("https://dashboard.360nrs.com/api/rest/shortener/shorten");
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
connection.setRequestMethod("POST");
connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
connection.setRequestProperty("Accept", "application/json");
String requestBody = "{ \"urls\": [ {\"longUrl\": \"https://example.com/test1\"}, {\"longUrl\": \"https://example.com/test2\"}, {\"longUrl\": \"invalidUrl\"} ] }";
connection.setDoOutput(true);
DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
wr.writeBytes(requestBody);
wr.flush();
wr.close();
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
} catch (Exception e) {
// TODO: handle exception
}
}
}
var axios = require('axios');
var config = {
method: 'post',
url: 'https://dashboard.360nrs.com/api/rest/shortener/shorten',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic YOUR_AUTH_TOKEN'
},
data: '{ "urls": [ {"longUrl": "https://example.com/test1"}, {"longUrl": "https://example.com/test2"}, {"longUrl": "invalidUrl"} ] }'
};
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/shortener/shorten"
payload = "{ \"urls\": [ {\"longUrl\": \"https://example.com/test1\"}, {\"longUrl\": \"https://example.com/test2\"}, {\"longUrl\": \"invalidUrl\"} ] }"
headers = {
'Content-Type': 'application/json',
'Authorization': 'Basic YOUR_AUTH_TOKEN'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
require "uri"
require "net/http"
url = URI("https://dashboard.360nrs.com/api/rest/shortener/shorten")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"
request.body = "{ \"urls\": [ {\"longUrl\": \"https://example.com/test1\"}, {\"longUrl\": \"https://example.com/test2\"}, {\"longUrl\": \"invalidUrl\"} ] }"
response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
class HelloWorld {
static void Main(string[] args) {
var client = new RestClient("https://dashboard.360nrs.com/api/rest/shortener/shorten");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{ \"urls\": [ {\"longUrl\": \"https://example.com/test1\"}, {\"longUrl\": \"https://example.com/test2\"}, {\"longUrl\": \"invalidUrl\"} ] }", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
}
}
}
Response
{
"data": [
{
"longUrl": "https://example.com/test1",
"shortUrl": "https://nrs.so/dvRINN",
"error": false
},
{
"longUrl": "https://example.com/test2",
"shortUrl": "https://nrs.so/GFA6Fm",
"error": false
},
{
"longUrl": "invalidUrl",
"shortUrl": null,
"error": true
}
]
}
Gerador de imagem
Geração de imagens
POST
https://dashboard.360nrs.com/api/rest/images/generate
Request
curl -X POST 'https://dashboard.360nrs.com/api/rest/images/generate' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
"images": [
{
"externalId": "test1",
"extension": "jpg",
"base64": "BASE64_ENCODED_STRING"
},
{
"externalId": "test2",
"extension": "png",
"base64": "BASE64_ENCODED_STRING"
}
]
}'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/images/generate',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => '{
"images": [
{
"externalId": "test1",
"extension": "jpg",
"base64": "BASE64_ENCODED_STRING"
},
{
"externalId": "test2",
"extension": "png",
"base64": "BASE64_ENCODED_STRING"
}
]
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;
public class App {
public static void main(String[] args) {
try {
URL url = new URL("https://dashboard.360nrs.com/api/rest/images/generate");
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
connection.setRequestMethod("POST");
connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
connection.setRequestProperty("Accept", "application/json");
String requestBody = "{ \"images\": [ { \"externalId\": \"test1\", \"extension\": \"jpg\", \"base64\": \"BASE64_ENCODED_STRING\" }, { \"externalId\": \"test2\", \"extension\": \"png\", \"base64\": \"BASE64_ENCODED_STRING\" } ] }";
connection.setDoOutput(true);
DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
wr.writeBytes(requestBody);
wr.flush();
wr.close();
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
} catch (Exception e) {
// TODO: handle exception
}
}
}
var axios = require('axios');
var config = {
method: 'post',
url: 'https://dashboard.360nrs.com/api/rest/images/generate',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic YOUR_AUTH_TOKEN'
},
data: '{ "images": [ { "externalId": "test1", "extension": "jpg", "base64": "BASE64_ENCODED_STRING" }, { "externalId": "test2", "extension": "png", "base64": "BASE64_ENCODED_STRING" } ] }'
};
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/images/generate"
payload = "{ \"images\": [ { \"externalId\": \"test1\", \"extension\": \"jpg\", \"base64\": \"BASE64_ENCODED_STRING\" }, { \"externalId\": \"test2\", \"extension\": \"png\", \"base64\": \"BASE64_ENCODED_STRING\" } ] }"
headers = {
'Content-Type': 'application/json',
'Authorization': 'Basic YOUR_AUTH_TOKEN'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
require "uri"
require "net/http"
url = URI("https://dashboard.360nrs.com/api/rest/images/generate")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"
request.body = "{ \"images\": [ { \"externalId\": \"test1\", \"extension\": \"jpg\", \"base64\": \"BASE64_ENCODED_STRING\" }, { \"externalId\": \"test2\", \"extension\": \"png\", \"base64\": \"BASE64_ENCODED_STRING\" } ] }"
response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
class HelloWorld {
static void Main(string[] args) {
var client = new RestClient("https://dashboard.360nrs.com/api/rest/images/generate");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{ \"images\": [ { \"externalId\": \"test1\", \"extension\": \"jpg\", \"base64\": \"BASE64_ENCODED_STRING\" }, { \"externalId\": \"test2\", \"extension\": \"png\", \"base64\": \"BASE64_ENCODED_STRING\" } ] }", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
}
}
}
Response
{
"data": [
{
"externalId": "test1",
"imageUrl": "https://dashboard.360nrs.com/uploads/UCuh4pdOsW58ZEXX/1b4f0e9851971998e732078544c96b36c3d01cedf7caa332359d6f1d83567014.jpg",
"error": false
},
{
"externalId": "test2",
"imageUrl": "https://dashboard.360nrs.com/uploads/UCuh4pdOsW58ZEXX/60303ae22b998861bce3b28f33eec1be758a213c86c93c076dbe9f558c11c752.jpg",
"error": false
}
]
}
Parâmetros
Parâmetro | Tipo | Obrigatório | Descrição |
---|---|---|---|
externalId | string | Sim | ID externo para identificar a imagem na resposta. |
extension | string | Sim | Extensão de imagem. Extensões permitidas: jpg, png. |
base64 | string | Sim | Imagem codificada em Base64. |
Baixar certificados
SMS certificados
GET
https://dashboard.360nrs.com/api/rest/sms/certificates/<ID>
curl -X GET 'https://dashboard.360nrs.com/api/rest/sms/certificates/<ID>' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/sms/certificates/<ID>',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;
public class App {
public static void main(String[] args) {
try {
URL url = new URL("https://dashboard.360nrs.com/api/rest/sms/certificates/<ID>");
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
} catch (Exception e) {
// TODO: handle exception
}
}
}
var axios = require('axios');
var config = {
method: 'get',
url: 'https://dashboard.360nrs.com/api/rest/sms/certificates/<ID>',
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/sms/certificates/<ID>"
payload = {}
headers = {
'Authorization': 'Basic YOUR_AUTH_TOKEN'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
require "uri"
require "net/http"
url = URI("https://dashboard.360nrs.com/api/rest/sms/certificates/<ID>")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"
response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
class HelloWorld {
static void Main(string[] args) {
var client = new RestClient("https://dashboard.360nrs.com/api/rest/sms/certificates/<ID>");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
}
}
}
Parâmetro | Tipo | Obrigatório | Descrição |
---|---|---|---|
id | string | Sim | Identificador da mensagem retornada na resposta à chamada para api/rest/sms no campo id . |
Emails certificados
GET
https://dashboard.360nrs.com/api/rest/mailing/certificates/<ID>
curl -X GET 'https://dashboard.360nrs.com/api/rest/mailing/certificates/<ID>' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/mailing/certificates/<ID>',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;
public class App {
public static void main(String[] args) {
try {
URL url = new URL("https://dashboard.360nrs.com/api/rest/mailing/certificates/<ID>");
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
} catch (Exception e) {
// TODO: handle exception
}
}
}
var axios = require('axios');
var config = {
method: 'get',
url: 'https://dashboard.360nrs.com/api/rest/mailing/certificates/<ID>',
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/mailing/certificates/<ID>"
payload = {}
headers = {
'Authorization': 'Basic YOUR_AUTH_TOKEN'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
require "uri"
require "net/http"
url = URI("https://dashboard.360nrs.com/api/rest/mailing/certificates/<ID>")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"
response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
class HelloWorld {
static void Main(string[] args) {
var client = new RestClient("https://dashboard.360nrs.com/api/rest/mailing/certificates/<ID>");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
}
}
}
Parâmetro | Tipo | Obrigatório | Descrição |
---|---|---|---|
id | string | Sim | Identificador da mensagem retornada na resposta à chamada para api/rest/mailing no campo id . |
Eventos
Notificações de eventos
Introdução
O objetivo do serviço de notificação de estados é informar ao servidor do cliente os eventos que são gerados no serviço 360nrs. As notificações serão feitas para os envios feitos por qualquer tipo de canal. Desta forma, o cliente poderá rastrear em tempo real cada envio efetuado.
Um único envio pode provocar múltiplos eventos, pelo que um envio em massa pode gerar um número significativo de notificações ao servidor do cliente. Para evitar a saturação do servidor, os eventos a notificar são colocados em fila na 360nrs, pelo que se podem verificar atrasos na entrega de notificações se o servidor do cliente não for capaz de gerir o volume de notificações gerado.
Para ativar esta funcionalidade, o cliente deve fornecer um URL onde serão feitos os pedidos http POST para notificar um evento.
Receber nova notificação de evento
HTTP METHOD: POST
Content-Type: application/x-www-form-urlencoded
Parâmetros
Parâmetro | Tipo | Descrição |
---|---|---|
id | string | Identificador alfanumérico que foi entregue no envio por API da mensagem. Se a mensagem foi enviada pela web, não terá valor. |
channel | string | Indica a que canal pertence o envio a que a notificação se refere. Os valores possíveis são: sms , mailing , landing , text2speech . |
contactId | integer | Identificador único do contacto. |
campaignId | integer | Identificador da campanha. Se foi enviado por API e não se especificou campaignName no envio, terá valor 0. |
formId | integer | Identificador único do formulário. (Para eventos de formulário) |
campaignName | string | Nome da campanha. |
event | string | Indica o evento que ocorreu. Os valores possíveis são: delivered , opened , clicked , unsubscribed , hard_bounced , complaint , sent , soft_bounced , undelivered , rejected , expired , unsubscribed_landing , form_opened , form_submitted , form_rejected . |
extra | string | Parâmetro extra com informações adicionais do evento no formato JSON. O evento "form_submitted" conterá os valores inseridos no formulário pelo usuário no seguinte formato: {"formValues":{"param1":"value1", "param2": "value2", ...}} O evento "clicked" contenda a url a la que se ha hecho clic: {"url":"url_encoded"} |
smtpResponse | string | Variável opcional definida para o canal de e-mail e os eventos delivered , hard_bounced , soft_bounced . A resposta do servidor SMTP do email destinatário é devolvida. |
eventDate | string | Data em que aconteceu o evento. |
As notificações são reintentadas em 5 ocasiões caso que o servidor do cliente responder a um código HTTP distinto a 200 OK.
O tempo de espera entre as notificações é progressivo, portanto a primeira tentativa será feita em 1 minuto, a segunda após 2 minutos desde a tentativa anterior, a terceira após 3 minutos, etc.
Relatório de eventos por envio
Reporte de eventos
GET
https://dashboard.360nrs.com/api/rest/sendings/<sendingId>/reports/events
curl -X GET 'https://dashboard.360nrs.com/api/rest/sendings/1/reports/events' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/sendings/1/reports/events',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;
public class App {
public static void main(String[] args) {
try {
URL url = new URL("https://dashboard.360nrs.com/api/rest/sendings/1/reports/events");
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
} catch (Exception e) {
// TODO: handle exception
}
}
}
var axios = require('axios');
var config = {
method: 'get',
url: 'https://dashboard.360nrs.com/api/rest/sendings/1/reports/events',
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/sendings/1/reports/events"
payload = {}
headers = {
'Authorization': 'Basic YOUR_AUTH_TOKEN'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
require "uri"
require "net/http"
url = URI("https://dashboard.360nrs.com/api/rest/sendings/1/reports/events")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"
response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
class HelloWorld {
static void Main(string[] args) {
var client = new RestClient("https://dashboard.360nrs.com/api/rest/sendings/1/reports/events");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
}
}
}
Filtros
Parámetro | Descripción |
---|---|
beforeDate | Mostrar os resultados anterores a data indicada. A data deve ser especificada no formato ISO 8601 . |
afterDate | Mostrar os resultados posteriores a data indicada. A data deve ser especificada no formato ISO 8601 . |
Os parâmetros devem ser corretamente codificados (urlencode) em relação ao padrão RFC 3986 para ser admitido pelo servidor. Por exemplo, para consultar o relatório de eventos entre as datas 2019-01-01T00:00:00+00:00 y 2019-02-01T00:00:00+00:00:
https://dashboard.360nrs.com/api/rest/sendings/{sendingId}/reports/events?afterDate=2019-01-01T00%3A00%3A00%2B00%3A00&beforeDate=2019-02-01T00%3A00%3A00%2B00%3A00
Obter o relatório detalhado dos eventos gerados por uma remessa. A resposta estará no formato text/csv
e conterá as seguintes colunas:
Para envios de voz:
campaignName
,campaignId
, sendingId
, contactId
, event
, phone
, email
, landline
, countryIso
, callDurationSeconds
, createdAt
Para o resto dos canais:
campaignName
, campaignId
, sendingId
, contactId
, event
, phone
, email
, landline
, countryIso
, browser
, os
, url
, createdAt
Relatório de pressionamentos
Introdução
Retorna um relatório com os números de telefone junto com a tecla pressionada e a mensagem da locução.
Url
GET
https://dashboard.360nrs.com/api/rest/sendings/<sendingId>/reports/keys
curl -X GET 'https://dashboard.360nrs.com/api/rest/sendings/1/reports/keys' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/sendings/1/reports/keys',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;
public class App {
public static void main(String[] args) {
try {
URL url = new URL("https://dashboard.360nrs.com/api/rest/sendings/1/reports/keys");
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
} catch (Exception e) {
// TODO: handle exception
}
}
}
var axios = require('axios');
var config = {
method: 'get',
url: 'https://dashboard.360nrs.com/api/rest/sendings/1/reports/keys',
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/sendings/1/reports/keys"
payload = {}
headers = {
'Authorization': 'Basic YOUR_AUTH_TOKEN'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
require "uri"
require "net/http"
url = URI("https://dashboard.360nrs.com/api/rest/sendings/1/reports/keys")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"
response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
class HelloWorld {
static void Main(string[] args) {
var client = new RestClient("https://dashboard.360nrs.com/api/rest/sendings/1/reports/keys");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
}
}
}
Filtros
Parámetro | Descripción |
---|---|
beforeDate | Mostrar os resultados anterores a data indicada. A data deve ser especificada no formato ISO 8601 . |
afterDate | Mostrar os resultados posteriores a data indicada. A data deve ser especificada no formato ISO 8601 . |
Os parâmetros devem ser corretamente codificados (urlencode) em relação ao padrão RFC 3986 para ser admitido pelo servidor. Por exemplo, para consultar o relatório de eventos entre as datas 2019-01-01T00:00:00+00:00 y 2019-02-01T00:00:00+00:00:
https://dashboard.360nrs.com/api/rest/sendings/{sendingId}/reports/keys?afterDate=2019-01-01T00%3A00%3A00%2B00%3A00&beforeDate=2019-02-01T00%3A00%3A00%2B00%3A00
Obtenha o relatório detalhado de pressionamentos de tecla de um envio de voz interativa. A resposta estará no formato text/csv
e conterá as seguintes colunas: phonenumber
, key
, message
OTP
Generar código
POST
https://dashboard.360nrs.com/api/rest/otp/generate
curl -X POST 'https://dashboard.360nrs.com/api/rest/otp/generate' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
"recipient": "34666555444"
}'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/otp/generate',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => '{
"recipient": "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/otp/generate");
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
connection.setRequestMethod("POST");
connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
connection.setRequestProperty("Accept", "application/json");
String requestBody = "{ \"recipient\": \"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/otp/generate',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic YOUR_AUTH_TOKEN'
},
data: '{ "recipient": "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/otp/generate"
payload = "{ \"recipient\": \"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/otp/generate")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"
request.body = "{ \"recipient\": \"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/otp/generate");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{ \"recipient\": \"34666555444\" }", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
}
}
}
Response
HTTP Response Code 200 (OK)
{
"data": {
"recipient": "34666555444",
"code": "1234",
"attempts": 0,
"maxAttempts": 3,
"maxSecondsValidity": 60,
"appId": "",
"createdAt": "2020-01-01T12:00:00+00:00",
"updatedAt": "2020-01-01T12:00:00+00:00",
"expiresAt": "2020-01-01T12:01:00+00:00"
}
}
Error response (HTTP 422)
{
"error": {
"code": 422,
"description": "The recipient field must be a valid phone or email."
}
}
Parâmetros
Parâmetro | Tipo | Obrigatório | Descrição |
---|---|---|---|
recipient | string | Sim | Número de telefone ou e-mail do usuário. |
alpha | boolean | Não | Indique se o código é alfanumérico ou numérico. O valor padrão é false . |
length | integer | Não | Tamanho do código. O valor mínimo é 3 e o valor máximo é 10 .O valor padrão é 4 . |
maxAttempts | integer | Não | Número máximo de tentativas. O valor mínimo é 1 e o valor máximo é 10 .O valor padrão é 3 . |
maxSecondsValidity | integer | Não | 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 | string | Não | O mesmo telefone ou e-mail pode ser validado ao mesmo tempo, desde que seja com um appId diferente.O valor padrão é "" . |
rejectIfPendingCode | boolean | Não | Impede a geração de um novo código OTP se existir um anterior em estado pendente. O valor por defeito é false . |
Comprobar código
POST
https://dashboard.360nrs.com/api/rest/otp/check
curl -X POST 'https://dashboard.360nrs.com/api/rest/otp/check' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
"recipient": "34666555444",
"code": "1234"
}'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/otp/check',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => '{
"recipient": "34666555444",
"code": "1234"
}',
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/otp/check");
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
connection.setRequestMethod("POST");
connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
connection.setRequestProperty("Accept", "application/json");
String requestBody = "{ \"recipient\": \"34666555444\", \"code\": \"1234\" }";
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/otp/check',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic YOUR_AUTH_TOKEN'
},
data: '{ "recipient": "34666555444", "code": "1234" }'
};
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/otp/check"
payload = "{ \"recipient\": \"34666555444\", \"code\": \"1234\" }"
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/otp/check")
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 = "{ \"recipient\": \"34666555444\", \"code\": \"1234\" }"
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/otp/check");
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", "{ \"recipient\": \"34666555444\", \"code\": \"1234\" }", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
}
}
}
Response
HTTP Response Code 200 (OK)
{
"data": {
"valid": true,
"reason": "Valid",
"otp": {
"data": {
"recipient": "34666555444",
"code": "1234",
"attempts": 1,
"maxAttempts": 3,
"maxSecondsValidity": 60,
"appId": "",
"createdAt": "2020-01-01T12:00:00+00:00",
"updatedAt": "2020-01-01T12:00:00+00:00",
"expiresAt": "2020-01-01T12:01:00+00:00"
}
}
}
}
{
"data": {
"valid": false,
"reason": "Expired",
"otp": {
"data": {
"recipient": "34666555444",
"code": "1234",
"attempts": 1,
"maxAttempts": 3,
"maxSecondsValidity": 60,
"appId": "",
"createdAt": "2020-01-01T12:00:00+00:00",
"updatedAt": "2020-01-01T12:00:00+00:00",
"expiresAt": "2020-01-01T12:01:00+00:00"
}
}
}
}
Error response (HTTP 422)
{
"error": {
"code": 422,
"description": "The recipient field is required."
}
}
Parâmetros
Parâmetro | Tipo | Obrigatório | Descrição |
---|---|---|---|
recipient | string | Sim | Número de telefone ou e-mail do usuário. |
code | string | Sim | Código a ser verificado. |
caseSensitive | boolean | Não | Diferencia maiúsculas de minúsculas na comparação de códigos. O valor padrão é false . |
appId | string | Não | O mesmo telefone ou e-mail pode ser validado ao mesmo tempo, desde que seja com um appId diferente.O valor padrão é "" . |
Respostas
Razão | Válido | Descrição |
---|---|---|
Valid | Sim | O código é válido. |
Invalid code | Não | O código não é válido. |
Maximum attempts reached | Não | O número de tentativas excedeu o máximo. |
Expired | Não | O tempo de validação excedeu o máximo. |
Conta
Retorna informação da conta como nome de usuário
, email
, fuso horário
, idioma
, saldo
, data de criação
, país
e moeda
.
GET
https://dashboard.360nrs.com/api/rest/account
curl -X GET 'https://dashboard.360nrs.com/api/rest/account' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://dashboard.360nrs.com/api/rest/account',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.HttpsURLConnection;
public class App {
public static void main(String[] args) {
try {
URL url = new URL("https://dashboard.360nrs.com/api/rest/account");
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setRequestProperty("Authorization", "Basic YOUR_AUTH_TOKEN");
connection.setRequestProperty("Accept", "application/json");
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
} catch (Exception e) {
// TODO: handle exception
}
}
}
var axios = require('axios');
var config = {
method: 'get',
url: 'https://dashboard.360nrs.com/api/rest/account',
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/account"
payload = {}
headers = {
'Content-Type': 'application/json',
'Authorization': 'Basic YOUR_AUTH_TOKEN'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
require "uri"
require "net/http"
url = URI("https://dashboard.360nrs.com/api/rest/account")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Basic YOUR_AUTH_TOKEN"
response = https.request(request)
puts response.read_body
using System;
using RestSharp;
namespace HelloWorldApplication {
class HelloWorld {
static void Main(string[] args) {
var client = new RestClient("https://dashboard.360nrs.com/api/rest/account");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Basic YOUR_AUTH_TOKEN");
request.AddHeader("Content-Type", "application/json");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
}
}
}
Cobertura
Cobertura SMS por operadora
Retorna a cobertura completa de SMS
por portadora
.
GET
https://dashboard.360nrs.com/api/rest/sms/coverage
curl -X GET 'https://dashboard.360nrs.com/api/rest/sms/coverage' \
-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/coverage',
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/coverage");
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/coverage',
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/coverage"
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/coverage")
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/coverage");
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": [
{
"countryIso": "AD",
"countryName": "Andorra",
"networkName": "Default",
"mcc": "213",
"mnc": null,
"cost": 0.065,
"currencyCode": "EUR",
"currencySymbol": "€"
},
{
"countryIso": "AD",
"countryName": "Andorra",
"networkName": "Servei De Tele. DAndorra",
"mcc": "213",
"mnc": "003",
"cost": 0.065,
"currencyCode": "EUR",
"currencySymbol": "€"
},
{
"countryIso": "AE",
"countryName": "United Arab Emirates",
"networkName": "Default",
"mcc": "424",
"mnc": null,
"cost": 0.0868,
"currencyCode": "EUR",
"currencySymbol": "€"
}
]
}
Cobertura SMS por país
Retorna a cobertura SMS
agrupada por país
indicando o custo mínimo e máximo de cada país.
GET
https://dashboard.360nrs.com/api/rest/sms/coverageByCountry
curl -X GET 'https://dashboard.360nrs.com/api/rest/sms/coverageByCountry' \
-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/coverageByCountry',
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/coverageByCountry");
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/coverageByCountry',
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/coverageByCountry"
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/coverageByCountry")
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/coverageByCountry");
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": [
{
"countryIso": "AD",
"countryName": "Andorra",
"networks": [
"Servei De Tele. DAndorra"
],
"minCost": 0.065,
"maxCost": 0.065,
"currencyCode": "EUR",
"currencySymbol": "€"
},
{
"countryIso": "AE",
"countryName": "United Arab Emirates",
"networks": [
"DU",
"Etisalat"
],
"minCost": 0.0868,
"maxCost": 0.0868,
"currencyCode": "EUR",
"currencySymbol": "€"
}
]
}
Erros
Error Code | HTTP Code | Description |
---|---|---|
0 | 202 | Accepted for delivery |
101 | 500 | Internal Database error |
102 | 400 | No valid recipients |
103 | 401 | Username or password unknown |
104 | 400 | Text message missing |
105 | 400 | Text message too long |
106 | 400 | Sender missing |
107 | 400 | Sender too long |
108 | 400 | No valid Datetime for send |
109 | 400 | Notification URL incorrect |
110 | 400 | Exceeded maximum parts allowed or incorrect number of parts |
111 | 402 | Not enough credits |
112 | 401 | IP address not allowed |
113 | 400 | Invalid coding |
114 | 400 | Invalid subject |
115 | 400 | Sender is not verified |
116 | 400 | Invalid replyTo |
117 | 400 | ReplyTo is not verified |
118 | 401 | Email blocked for exceeding the hard-bounced limit allowed |
119 | 400 | Invalid expiration date |
120 | 400 | Invalid GUID |
121 | 400 | Invalid scheduled date |
122 | 500 | Update error |
123 | 500 | Delete error |
125 | 400 | Invalid JSON |
126 | 400 | Empty campaign name |
130 | 400 | Invalid voice language |
131 | 400 | Invalid voice gender |
132 | 400 | Invalid voice caller |
133 | 400 | Invalid audio URL |
134 | 400 | Unsupported audio format |
140 | 400 | Template missing |
141 | 400 | Missing landing placeholder |
142 | 400 | Can't split variable placeholders |
150 | 400 | Missing billing profile |
151 | 400 | Error retrieving TPV url |
152 | 400 | Invalid VAT |
153 | 400 | Invalid method |
154 | 400 | Invalid conversion rate |
155 | 400 | Max limit reached |
156 | 400 | Min limit reached |
157 | 400 | Error generating invoice |
160 | 400 | Invalid voice interactive language |
161 | 400 | Invalid voice interactive gender |
162 | 400 | Invalid voice interactive caller |
163 | 400 | Invalid voice interactive audio URL |
164 | 400 | Unsupported voice interactive audio format |
165 | 400 | Invalid voice interactive speech type |
166 | 400 | Ivalid voice interactive menu option type |
167 | 400 | Trying to save an existing campaign |
168 | 400 | Empty speech type |
169 | 400 | Empty menu |
170 | 400 | Empty phone key |
171 | 400 | Phone Key is not a number |
172 | 400 | Phone key out of range |
173 | 400 | Empty menu options for sub menu |
174 | 400 | Empty phone prefix for call transfer |
175 | 400 | Empty phone for call transfer |
176 | 400 | Call retries value is not an integer |
177 | 400 | Call retries value out of range |
178 | 400 | Cost limit value is not an integer |
179 | 400 | Speech retries value is not an integer |
180 | 400 | Speech retries value out of range |
181 | 400 | Speech timeout seconds value is not an integer |
182 | 400 | Speech timeout seconds value out of range |
183 | 400 | Available times value is not an array |
184 | 400 | Available times day is not an integer |
185 | 400 | Available times day out of range |
186 | 400 | Available times from hour format error |
187 | 400 | Available times to hour format error |
188 | 400 | Available times from hour is greater than to hour |
189 | 400 | Missing available time object property |
190 | 400 | Call Retries is specified but its value is empty |
191 | 400 | Cost limit is specified but its value is empty |
192 | 400 | Speech Retries is specified but its value is empty |
193 | 400 | Speech timeout seconds is specified but its value is empty |
194 | 400 | Available times is specified but its value is empty |
195 | 400 | No valid contacts external IDs |
196 | 400 | Available times range is too short |
422 | 422 | Input validation error |
Anexos
Conjunto de caracteres GSM
Conjunto de caracteres básico
GSM
0x00 | 0x10 | 0x20 | 0x30 | 0x40 | 0x50 | 0x60 | 0x70 | |
0x00 | @ | Δ | SP | 0 | ¡ | P | ¿ | p |
0x01 | £ | _ | ! | 1 | A | Q | a | q |
0x02 | $ | Φ | " | 2 | B | R | b | r |
0x03 | ¥ | Γ | # | 3 | C | S | c | s |
0x04 | è | Λ | ¤ | 4 | D | T | d | t |
0x05 | é | Ω | % | 5 | E | U | e | u |
0x06 | ù | Π | & | 6 | F | V | f | v |
0x07 | ì | Ψ | ' | 7 | G | W | g | w |
0x08 | ò | Σ | ( | 8 | H | X | h | x |
0x09 | Ç | Θ | ) | 9 | I | Y | i | y |
0x0A | LF | Ξ | * | : | J | Z | j | z |
0x0B | Ø | ESC | + | ; | K | Ä | k | ä |
0x0C | ø | Æ | , | < | L | Ö | l | ö |
0x0D | CR | æ | - | = | M | Ñ | m | ñ |
0x0E | Å | ß | . | > | N | Ü | n | ü |
0x0F | å | É | / | ? | O | § | o | à |
* Caracteres especiais
Conjunto de caracteres estendidos
GSM
0x00 | 0x10 | 0x20 | 0x30 | 0x40 | 0x50 | 0x60 | 0x70 | |
0x00 | | | |||||||
0x01 | ||||||||
0x02 | ||||||||
0x03 | ||||||||
0x04 | ^ | |||||||
0x05 | € | |||||||
0x06 | ||||||||
0x07 | ||||||||
0x08 | { | |||||||
0x09 | } | |||||||
0x0A | FF | |||||||
0x0B | SS2 | |||||||
0x0C | [ | |||||||
0x0D | CR2 | ~ | ||||||
0x0E | ] | |||||||
0x0F | \ |
* Caracteres especiais
Conjunto de caracteres GSM-PT
Conjunto de caracteres básico
GSM-PT
0x00 | 0x10 | 0x20 | 0x30 | 0x40 | 0x50 | 0x60 | 0x70 | |
0x00 | @ | Δ | SP | 0 | Í | P | ~ | p |
0x01 | £ | _ | ! | 1 | A | Q | a | q |
0x02 | $ | ª | " | 2 | B | R | b | r |
0x03 | ¥ | Ç | # | 3 | C | S | c | s |
0x04 | ê | À | º | 4 | D | T | d | t |
0x05 | é | ∞ | % | 5 | E | U | e | u |
0x06 | ú | ^ | & | 6 | F | V | f | v |
0x07 | í | \ | ' | 7 | G | W | g | w |
0x08 | ó | € | ( | 8 | H | X | h | x |
0x09 | ç | Ó | ) | 9 | I | Y | i | y |
0x0A | LF | | | * | : | J | Z | j | z |
0x0B | Ô | ESC | + | ; | K | Ã | k | ã |
0x0C | ô | Â | , | < | L | Õ | l | õ |
0x0D | CR | â | - | = | M | Ú | m | ` |
0x0E | Á | Ê | . | > | N | Ü | n | ü |
0x0F | á | É | / | ? | O | § | o | à |
* Caracteres especiais
** Caracteres diferentes de GSM
Conjunto de caracteres estendidos
GSM-PT
0x00 | 0x10 | 0x20 | 0x30 | 0x40 | 0x50 | 0x60 | 0x70 | |
0x00 | | | |||||||
0x01 | À | Â | ||||||
0x02 | Φ | |||||||
0x03 | Γ | |||||||
0x04 | ^ | |||||||
0x05 | ê | Ω | Ú | € | ú | |||
0x06 | Π | |||||||
0x07 | Ψ | |||||||
0x08 | Σ | { | ||||||
0x09 | ç | Θ | } | Í | í | |||
0x0A | FF | |||||||
0x0B | Ô | SS2 | Ã | ã | ||||
0x0C | ô | [ | Õ | õ | ||||
0x0D | CR2 | ~ | ||||||
0x0E | Á | ] | ||||||
0x0F | á | Ê | \ | Ó | ó | â |
* Caracteres especiais
** Caracteres diferentes de GSM