NAV
shell php java python nodejs ruby c#

Autenticación

Cada petición que se realice tendrá que incluir en la cabecera de la petición http la autenticación del cliente. Para ello se utiliza la autenticación de acceso básica de HTTP.

La cabecera de autorización se construye combinando la cadena usuario:apiPassword y codificándola en base64. A esta cadena se antepone la cadena Authorization: Basic

Por ejemplo, para el usuario username y el password apiPassword la cabecera resultante sería:

Authorization: Basic dXNlcm5hbWU6YXBpUGFzc3dvcmQ=

Campañas

SMS

Envío 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 Obligatorio Descripción
message string Texto del mensaje. Como máximo puede tener 160 caracteres si no se especifica que el mensaje sea multiparte (ver parámetro parts). El texto tiene que estar codificado en UTF-8.
to array Número de teléfono móvil destinatario del mensaje. Debe incluir el prefijo. Ejemplo: En España 34666666666. Este campo permite indicar multiples destinatarios.
from string Texto del Remitente, esta etiqueta se compondrá de 15 números o 11 caracteres alfanuméricos.
encoding string No Los posibles valores son 'gsm', 'gsm-pt' y 'utf-16'. El valor gsm para envíos normales con codificación GSM7 y 160 caracteres por mensaje y el valor utf-16 para codificación UCS2 (UTF16) y 70 caracteres por mensaje. En caso de no especificarse, el valor por defecto es gsm.
scheduleDate string No Fecha de envió 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. Ejemplo: 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.
expirationDate string No Fecha de expiración del mensaje en formato UTC. Formato YYYYmmddHHiiss. Ejemplo: 20130215142000 sería el 15 de febrero de 2013 a las 14:20:00.
parts integer No Indica el número máximo de partes en que se dividirá el mensaje para su envío. Esta variable tiene valor 1 por defecto, por lo que si no se especifica y se envía un mensaje de más de 160 caracteres para codificación gsm, el mensaje fallará. Hay que tener en cuenta que los mensajes concatenados solo pueden tener 153 caracteres por parte en gsm y 67 caracteres por parte en utf-16 y que cada parte se tarifica como un envío. El servidor solo utilizará el mínimo de partes necesaria para realizar el envío del texto aunque el número de partes especificado sea superior al necesario. En caso de que el número de partes sea inferior al necesario para el envío del texto, el envío fallará con el error 105. El número máximo de partes permitido es de 15.
notificationUrl string|array No URL en la que recibir las notificaciones de entrega.
trans integer No Los valores posibles son 1 y 0. Con el valor 0 el servidor no modifica ningún carácter del mensaje, este es el valor por defecto. Con el valor 1 el servidor se encarga de modificar los caracteres comunes no validos en GSM7 a caracteres validos con la siguiente tabla de traducción: 'á' => '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 No Nombre de campaña. Si se especifica se creará una campaña con el nombre indicado en el dashboard que contendrá las estadísticas del envío. Si una campaña con este nombre ya existe, las estadísticas de envío se añadirán a la campaña existente.
tags array No campaignName es requerido si se especifica este parámetro. Listado de tags a añadir a la campaña. Los tags pueden ser utilizados para filtrar las estadísticas en el dashboard.
certified boolean No Si se especifica como true el mensaje se enviará como certificado. * Los mensajes certificados tienen coste adicional
sub array No array con variables de sustitución que se aplicarán al mensaje.
splitParts boolean No Para mensajes que superen el tamaño máximo de SMS, el servidor dividirá el mensaje en múltiples SMS en lugar de utilizar SMS concatenados. El valor por defecto es false.
flash boolean No Un SMS flash es un mensaje que aparece directamente en la pantalla del dispositivo. Dependiendo del modelo y del sistema operativo es posible almacenarlo en la bandeja de entrada y enviar mensajes concatenados.
availableTimes array No Indica los horarios en los que se enviarán los SMS. Se definen objetos json de la forma:

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

day: se indica un dia del rango entre los días lunes a domingo debe ser un número entre 1 y 7. Opcional: Si no se especifica, el rango se aplicará a todos los días de la semana.
from: hora que define el inicio del rango de horario en formato UTC 24 horas,
to: hora que define el fin del rango de horario en formato UTC 24 horas.
otpConfig object No En el caso de añadir la variable {OTP_CODE} dentro del parámetro "message", se pueden especificar los parámetros del código OTP. Por ejemplo:

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

alpha: indica si el código es alfanumérico o numérico. El valor por defecto es false.
length: tamaño del código. El valor mínimo es 3 y el valor máximo es 10. El valor por defecto es 4.
maxAttempts: número máximo de reintentos. El valor mínimo es 1 y el valor máximo es 10. El valor por defecto es 3.
maxSecondsValidity: número máximo de segundos entre la generación y la validación del código. El valor mínimo es 30 y el valor máximo es 600. El valor por defecto es 60.
appId: un mismo teléfono o email puede validarse a la vez siempre que sea con un appId distinto. El valor por defecto es "".
rejectIfPendingCode: evita la generación de un nuevo código OTP si existe uno anterior en estado pendiente. El valor por defecto es false.

Variables de sustitución

Al utilizar el parámetro sub, el array ha de contener tantos elementos como destinatarios del envío.

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

Es posible indicar variables personalizadas en el cuerpo del mensaje que serán sustituidas por las variables personalizadas del contacto o por las variables indicadas en el parámetro sub.

Múltiples URLs de notificación

Al utilizar múltiples URLs de notificación, el array ha de contener tantos elementos como destinatarios del envío.

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

Es posible especificar una url de notificación distinta por destinatario.
Para esto hay que utilizar un array para el parámetro notificationUrl. El array ha de contener tantos elementos como destinatarios del envío.

Filtros de variables personalizadas

Es posible añadir los siguientes filtros a las variables personalizadas.

Filtro Descripción Ejemplo Resultado
lower Devuelve el texto en minúsculas. {name|lower} my name
upper Devuelve el texto en mayúsculas. {name|upper} MY NAME
capitalize Devuelve el texto con la primera letra de la primera palabra en mayúsculas. {name|capitalize} My name
capitalizeAll Devuelve el texto con la primera letra de cada palabra en mayúsculas. {name|capitalizeAll} My Name
formatDotComma Devuelve el número con punto como separador de miles y coma como separador de decimales. {number|formatDotComma} 1.234,56
formatCommaDot Devuelve el número con coma como separador de miles y punto como separador de decimales. {number|formatCommaDot} 1,234.56
shorten Devuelve una url acortada. Debe ser una url válida. {url|shorten} https://nrs.so/xxxxxx

Acuses de recibo

Si se desean recibir los acuses de recibo en tiempo real se deberá especificar la variable notificationUrl con la URL del cliente donde quiere que se notifique es estado del envío.

El funcionamiento consiste en especificar en cada petición http la URL donde se desea que realice una petición de nuestro servidor cuando se reciba una notificación por parte de la operadora. Para ello el cliente debe disponer de un servidor http capaz de recibir esas notificaciones.

Nuestro servidor enviará las variables por el método GET tal como el cliente quiera, para ello en la URL que nos envía tiene que poner el nombre de la variable seguido de un carácter de escape que contendrá el valor, los caracteres de escape tienen la forma del carácter % seguido de una letra. Este sería un ejemplo de URL:

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

Estos son los caracteres de escape definidos:

Para explicar mejor el proceso, a continuación se da un ejemplo de cómo sería el envío de un sms y la recepción de su acuse de recibo.

En primer lugar enviamos el sms con la variable notificationUrl donde indicaremos la URL donde queremos recibir la notificación de entrega, añadiremos a esta URL nuestro identificador de envío para poder identificar inequívocamente cuando lo recibamos. La url final para la notificación sería:

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

Información del SMS por id de mensaje

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 Obligatorio Descripción
id string Identificador del mensaje devuelto en la respuesta a la llamada a api/rest/sms en el campo id. Es posible especificar múltiples identificadores separados por comas.

Email

Envío 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 Obligatorio Descripción
body string No Cuerpo del email en formato HTML y codificación UTF-8. Requerido sin templateId.
templateId integer No ID de plantilla legacy para enviar como cuerpo del email. Requerido sin body. Este ID hace referencia a plantillas creadas desde la versión anterior (https://dashboard.360nrs.com) de la aplicación de 360NRS. Se recomienda utilizar el parámetro templateV2Id cuando sea posible.
templateV2Id integer No ID de plantilla para enviar como cuerpo del email. Requerido sin body. Este ID hace referencia a la versión actual (https://app.360nrs.com) de la aplicación de 360NRS.
to array Emails de los destinatarios del envío. Este campo permite indicar multiples destinatarios.
cc array No Emails de los destinatarios en copia del envío. Este campo permite indicar multiples destinatarios.
bcc array No Emails de los destinatarios en copia oculta del envío. Este campo permite indicar multiples destinatarios.
fromEmail string Email del remitente. La dirección de correo indicada debe estar validada en la plataforma de 360NRS.
subject string Breve resumen del tema del mensaje.
fromName string No Nombre del remitente del envío.
replyTo string Dirección que debe utilizarse para responder al mensaje.
scheduleDate string No 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. Ejemplo: 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.
campaignName string No Nombre de campaña. Si se especifica se creará una campaña con el nombre indicado en el dashboard que contendrá las estadísticas del envío. Si una campaña con este nombre ya existe, las estadísticas de envío se añadirán a la campaña existente.
tags array No campaignName es requerido si se especifica este parámetro. Listado de tags a añadir a la campaña. Los tags pueden ser utilizados para filtrar las estadísticas en el dashboard.
certified boolean No Si se especifica como true el mensaje se enviará como certificado. * Los mensajes certificados tienen coste adicional
sub array No array con variables de sustitución que se aplicarán al mensaje.
attachments array No Adjuntos del email. Se define un array de objetos de la siguiente forma:

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


name: nombre del archivo.
content: contenido del archivo en base64.
contentType: Content Type del archivo.

* Los archivos adjuntos tienen coste adicional
trackOpens boolean No Añade un pixel para poder obtener estadísticas de apertura. El valor por defecto es true.
trackClicks boolean No Trackea los enlaces para poder obtener estadísticas de clicks. El valor por defecto es true.
otpConfig object No En el caso de añadir la variable {OTP_CODE} dentro del parámetro "body", se pueden especificar los parámetros del código OTP. Por ejemplo:

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

alpha: indica si el código es alfanumérico o numérico. El valor por defecto es false.
length: tamaño del código. El valor mínimo es 3 y el valor máximo es 10. El valor por defecto es 4.
maxAttempts: número máximo de reintentos. El valor mínimo es 1 y el valor máximo es 10. El valor por defecto es 3.
maxSecondsValidity: número máximo de segundos entre la generación y la validación del código. El valor mínimo es 30 y el valor máximo es 600. El valor por defecto es 60.
appId: un mismo teléfono o email puede validarse a la vez siempre que sea con un appId distinto. El valor por defecto es "".
rejectIfPendingCode: evita la generación de un nuevo código OTP si existe uno anterior en estado pendiente. El valor por defecto es false.

Variables de sustitución

Al utilizar el parámetro sub, el array ha de contener tantos elementos como destinatarios del envío.

{
  "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"}
  ]
}

Es posible indicar variables personalizadas en el cuerpo del mensaje que serán sustituidas por las variables personalizadas del contacto o por las variables indicadas en el parámetro sub.

Voz

Envío mensaje 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 Obligatorio Descripción
message string Texto del mensaje. Como máximo puede tener 500 caracteres. El texto tiene que estar codificado en UTF-8.
to array Número de teléfono móvil destinatario del mensaje. Debe incluir el prefijo. Ejemplo: En España 34666666666. Este campo permite indicar multiples destinatarios.
language string Idioma para convertir el texto, las opciones son:

'en_GB': Inglés - Reino Unido,
'en_US': Inglés - Estados Unidos,
'es_ES': Español - España,
'es_US': Español - Latino,
'pt_PT': Portugués - Portugal,
'pt_BR': Portugués - Brasil,
'cmn_CN': Chino mandarín - China *,
'arb': Árabe *,
'de_DE': Alemán - Alemania,
'fr_FR': Francés - Francia,
'it_IT': Italiano - Italia,
'hi_IN': Indi - India *.

* Disponible únicamente en género femenino.
gender string Género de la voz, los valores permitidos son 'F' para voz de mujer y 'M' para voz de hombre.
callers object No Objecto con lista de remitentes personalizados por país a utilizar en la llamada. Si no se especifica el remitente para un país determinado se usará el remitente por defecto. Para configurar un remitente personalizado contactar con el departamento de soporte. Ejemplo:

{"ES": "6123456789", "PT": "6987654321"}
scheduleDate string No Fecha de envió 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. Ejemplo: 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.
retries integer No Número máximo de reintentos. Máximo 5. Si no se especifica, no habrá reintentos.
expirationDate string No Permite determinar la fecha máxima en la que la llamada se puede realizar. Transcurrida esta fecha límite, la llamada será cancelada. Especificando el periodo de validez se activará automáticamente los reintentos de llamada, que volverá a realizar la llamada si el destinatario no atiende la llamada. La fecha debe tener el formato YYYYmmddHHiiss. Ejemplo: 20130215142000 sería el 15 de febrero de 2013 a las 14:20.
campaignName string No Nombre de campaña. Si se especifica se creará una campaña con el nombre indicado en el dashboard que contendrá las estadísticas del envío. Si una campaña con este nombre ya existe, las estadísticas de envío se añadirán a la campaña existente.
tags array No campaignName es requerido si se especifica este parámetro. Listado de tags a añadir a la campaña. Los tags pueden ser utilizados para filtrar las estadísticas en el dashboard.
sub array No array con variables de sustitución que se aplicarán al mensaje.
amd boolean No Answer Machine Detection (AMD): Detecta si la llamada ha sido atendida por un contestador automático, si es así, finaliza automáticamente la llamada. El valor por defecto es false.

Variables de sustitución

Es posible indicar variables personalizadas en el cuerpo del mensaje que serán sustituidas por las variables personalizadas del contacto o por las variables indicadas en el parámetro sub. Al utilizar el parámetro sub, el array ha de contener tantos elementos como destinatarios del envío.

Envío mensaje de Voz con Url a archivo de audio

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 Obligatorio Descripción
to array Número de teléfono móvil destinatario del mensaje. Debe incluir el prefijo. Ejemplo: En España 34666666666. Este campo permite indicar multiples destinatarios.
audioUrl string URL del audio a enviar. Ejemplo: https://example.com/audio.mp3.
callers object No Objecto con lista de remitentes personalizados por país a utilizar en la llamada. Si no se especifica el remitente para un país determinado se usará el remitente por defecto. Para configurar un remitente personalizado contactar con el departamento de soporte. Ejemplo:

{"ES": "6123456789", "PT": "6987654321"}
scheduleDate string No Fecha de envió 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. Ejemplo: 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.
retries integer No Número máximo de reintentos. Máximo 5. Si no se especifica, no habrá reintentos.
expirationDate string No Permite determinar la fecha máxima en la que la llamada se puede realizar. Transcurrida esta fecha límite, la llamada será cancelada. Especificando el periodo de validez se activará automáticamente los reintentos de llamada, que volverá a realizar la llamada si el destinatario no atiende la llamada. La fecha debe tener el formato YYYYmmddHHiiss. Ejemplo: 20130215142000 sería el 15 de febrero de 2013 a las 14:20.
campaignName string No Nombre de campaña. Si se especifica se creará una campaña con el nombre indicado en el dashboard que contendrá las estadísticas del envío. Si una campaña con este nombre ya existe, las estadísticas de envío se añadirán a la campaña existente.
tags array No campaignName es requerido si se especifica este parámetro. Listado de tags a añadir a la campaña. Los tags pueden ser utilizados para filtrar las estadísticas en el dashboard.
amd boolean No Answer Machine Detection (AMD): Detecta si la llamada ha sido atendida por un contestador automático, si es así, finaliza automáticamente la llamada. El valor por defecto es false.

Política de reintentos

Si se expecifica en número máximo de reintentos en la variable opcional retries, el sistema reintentará automáticamente las llamadas no atendidas. Esta funcionalidad no genera costes añadidos, ya que solo se cobrarán las llamadas que sean atendidas por el destinatario.

Cuando el sistema detecta que la llamada no ha sido atendida, se encola nuevamente pasados 10 minutos. El tiempo transcurrido desde la llamada no atendida hasta el reintento será variable dependiendo de la cola existente, pero siempre superior a 10 minutos.

Landing SMS

Envío Landing 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 Obligatorio Descripción
message string Texto del mensaje. Como máximo puede tener 160 caracteres si no se especifica que el mensaje sea multiparte (ver parámetro parts). El texto tiene que estar codificado en UTF-8. Es necesario incluir el patrón "{LAND_URL}" en el cuerpo del mensaje. Este patrón será sustituido por el enlace a la landing page.
to array Número de teléfono móvil destinatario del mensaje. Debe incluir el prefijo. Ejemplo: En España 34666666666. Este campo permite indicar multiples destinatarios.
from string Texto del Remitente, esta etiqueta se compondrá de 15 números o 11 caracteres alfanuméricos.
encoding string No Los posibles valores son 'gsm', 'gsm-pt' y 'utf-16'. El valor gsm para envíos normales con codificación GSM7 y 160 caracteres por mensaje y el valor utf-16 para codificación UCS2 (UTF16) y 70 caracteres por mensaje. En caso de no especificarse, el valor por defecto es gsm.
scheduleDate string No Fecha de envió 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. Ejemplo: 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.
expirationDate string No Fecha de expiración del mensaje en formato UTC. Formato YYYYmmddHHiiss. Ejemplo: 20130215142000 sería el 15 de febrero de 2013 a las 14:20:00.
parts integer No Indica el número máximo de partes en que se dividirá el mensaje para su envío. Esta variable tiene valor 1 por defecto, por lo que si no se especifica y se envía un mensaje de más de 160 caracteres para codificación gsm, el mensaje fallará. Hay que tener en cuenta que los mensajes concatenados solo pueden tener 153 caracteres por parte en gsm y 67 caracteres por parte en utf-16 y que cada parte se tarifica como un envío. El servidor solo utilizará el mínimo de partes necesaria para realizar el envío del texto aunque el número de partes especificado sea superior al necesario. En caso de que el número de partes sea inferior al necesario para el envío del texto, el envío fallará con el error 105. El número máximo de partes permitido es de 8.
notificationUrl string No URL en la que recibir las notificaciones de entrega.
trans integer No Los valores posibles son 1 y 0. Con el valor 0 el servidor no modifica ningún carácter del mensaje, este es el valor por defecto. Con el valor 1 el servidor se encarga de modificar los caracteres comunes no validos en GSM7 a caracteres validos con la siguiente tabla de traducción: 'á' => '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 No Nombre de campaña. Si se especifica se creará una campaña con el nombre indicado en el dashboard que contendrá las estadísticas del envío. Si una campaña con este nombre ya existe, las estadísticas de envío se añadirán a la campaña existente.
tags array No campaignName es requerido si se especifica este parámetro. Listado de tags a añadir a la campaña. Los tags pueden ser utilizados para filtrar las estadísticas en el dashboard.
certified boolean No Si se especifica como true el mensaje se enviará como certificado. * Los mensajes certificados tienen coste adicional
sub array No array con variables de sustitución que se aplicarán al mensaje.
splitParts boolean No Para mensajes que superen el tamaño máximo de SMS, el servidor dividirá el mensaje en múltiples SMS en lugar de utilizar SMS concatenados. El valor por defecto es false.
flash boolean No Un SMS flash es un mensaje que aparece directamente en la pantalla del dispositivo. Dependiendo del modelo y del sistema operativo es posible almacenarlo en la bandeja de entrada y enviar mensajes concatenados.
templateBody string No Contenido de la landing page en formato HTML y codificación UTF-8. Requerido sin templateId.
templateId integer No ID de plantilla legacy para enviar como contenido de la landing page. Requerido sin templateBody. Este ID hace referencia a plantillas creadas desde la versión anterior (https://dashboard.360nrs.com) de la aplicación de 360NRS. Se recomienda utilizar el parámetro templateV2Id cuando sea posible.
templateV2Id integer No ID de plantilla para enviar como contenido de la landing page. Requerido sin templateBody. Este ID hace referencia a la versión actual (https://app.360nrs.com) de la aplicación de 360NRS.

Variables de sustitución

Al utilizar el parámetro sub, el array ha de contener tantos elementos como destinatarios del envío.

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

Es posible indicar variables personalizadas en el cuerpo del mensaje que serán sustituidas por las variables personalizadas del contacto o por las variables indicadas en el parámetro sub.

Filtros de variables personalizadas

Es posible añadir los siguientes filtros a las variables personalizadas.

Filtro Descripción Ejemplo Resultado
lower Devuelve el texto en minúsculas. {name|lower} my name
upper Devuelve el texto en mayúsculas. {name|upper} MY NAME
capitalize Devuelve el texto con la primera letra de la primera palabra en mayúsculas. {name|capitalize} My name
capitalizeAll Devuelve el texto con la primera letra de cada palabra en mayúsculas. {name|capitalizeAll} My Name
formatDotComma Devuelve el número con punto como separador de miles y coma como separador de decimales. {number|formatDotComma} 1.234,56
formatCommaDot Devuelve el número con coma como separador de miles y punto como separador de decimales. {number|formatCommaDot} 1,234.56
shorten Devuelve una url acortada. Debe ser una url válida. {url|shorten} https://nrs.so/xxxxxx

WhatsApp

Envío de plantilla 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 Obligatorio Descripción
templateId integer ID de plantilla de WhatsApp a enviar. La plantilla debe estar aprobada para envío desde la plataforma.
from string Remitente del mensaje. El remitente debe estar dado de alta en la plataforma.
messages array Array de mensajes a enviar.
messages.*.to string Número de teléfono móvil destinatario del mensaje. Debe incluir el prefijo internacional. Ejemplo: En España 34666666666.
messages.*.headerFields array No* Array de variables de sustitución posicionales a aplicar a la cabecera. Requerido para plantillas con variables de cabecera.
messages.*.bodyFields array No* Array de variables de sustitución posicionales a aplicar al cuerpo del mensaje. Requerido para plantillas con variables de mensaje.
messages.*.callToActionFields array No* Array de variables de sustitución posicionales a aplicar a los botones de interacción. Requerido para plantillas con variables de acción.
messages.*.defaultAnswer array No Respuesta por defecto al primer mensaje del usuario.
messages.*.buttonAnswers array No Array de respuestas posicionales a los botones de respuesta rápida.
messages.*.location object No* Información de ubicación. Requerido para plantillas que contengan ubicación.
messages.*.location.lat string No* Latitud del punto geográfico. Requerido para plantillas que contengan ubicación.
messages.*.location.long string No* Longitud del punto geográfico. Requerido para plantillas que contengan ubicación.
messages.*.location.name string No Nombre de la ubicación.
messages.*.location.address string No Dirección de la ubicación.
campaignName string No Nombre de campaña. Si se especifica se creará una campaña con el nombre indicado en el dashboard que contendrá las estadísticas del envío. Si una campaña con este nombre ya existe, las estadísticas de envío se añadirán a la campaña existente.
tags array No Listado de tags a añadir a la campaña. Los tags pueden ser utilizados para filtrar las estadísticas en el dashboard.

Ejemplos de envío

Ejemplos de envío de varios tipos de plantillas de WhatsApp.

Envío de plantilla con variables y auto respuestas.

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

Envío de plantilla con ubicación.

{
  "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ó"
      }
    }
  ]
}

Envío de plantilla con código de autenticación.

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

Listado de conversaciones

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 Descripción
limit Total de conversaciones a mostrar en una única petición. Valor por defecto: 100. Máximo: 1000.
from Filtrar por remitente.
to Filtrar por destinatario.

Mostrar una conversación

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 los mensajes de una conversación

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 Descripción
limit Total de mensajes a mostrar en una única petición. Valor por defecto: 100. Máximo: 1000.

Enviar un mensaje a una conversación

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 Obligatorio Descripción
content string Contenido del mensaje. Puedes cambiar el formato del texto de tus mensajes.

Mensajes programados

Listado

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
}

Lista todos los envíos programados. Puede filtrarse por tipo (SMS o MAILING) y puede especificarse un GUID, varios GUID o ningún GUID (para listar todos).

El contenido del mensaje no se muestra en la lista, a no ser que se especifique un único GUID.

Parámetro Tipo Obligatorio Descripción
guid integer, array No Identificador del mensaje o mensajes. Se le puede pasar un identificador, un array de identificadores o ninguno para mostrarlos todos.
type string No SMS o MAILING
sendingId integer No Identificador del envío.

Actualizar

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
}

Actualiza la fecha de programación un envío, varios envíos o todos los envíos programados. Puede filtrarse por GUID y/o tipo.

Parámetro Tipo Obligatorio Descripción
guid integer, array No Identificador del mensaje o mensajes. Se le puede pasar un identificador, un array de identificadores o ninguno para mostrarlos todos.
type string No SMS o MAILING
scheduleDate string 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. Ejemplo: 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
}

Elimina un envío, varios envíos o todos los envíos programados. Puede filtrarse por GUID y/o tipo.

Parámetro Tipo Obligatorio Descripción
guid integer, array No Identificador del mensaje o mensajes. Se le puede pasar un identificador, un array de identificadores o ninguno para mostrarlos todos.
type string No SMS o MAILING

Listado de campañas

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 Descripción
name Filtrar por nombre de campaña. Es posible utilizar el carácter "*" como "wildcard". Ejemplo: ?name=CAMPAIGN_2020_*.
channel Filtrar por canal. Valores disponibles: sms, mailing, landing, text2speech. Ejemplo: ?channel=sms.
beforeDate Mostrar los resultados anteriores a la fecha indicada. La fecha se debe especificar en formato ISO 8601. Ejemplo: ?beforeDate=2019-01-01T00%3A00%3A00%2B00%3A00.
afterDate Mostrar los resultados posteriores a la fecha indicada. La fecha se debe especificar en formato ISO 8601. Ejemplo: ?afterDate=2019-01-01T00%3A00%3A00%2B00%3A00.

Los parámetros deben estar codificados correctamente (urlencode) respecto al estándar RFC 3986 para ser admitidos por el servidor.

Campos de la respuesta

Parámetro Descripción
name Nombre asignado a la campaña.
type Tipo de campaña. Posibles valores: basic, automatic, trigger, testab.
sendings Listado de envíos asociado a la campaña. Para campañas de tipo basic y automatic el número de envíos siempre será 1.
sendings.*.status Estado del envío. Posibles valores:
PENDING: Envío programado para una fecha futura.
SAVED: Envío guardado. No se enviará hasta que se confirme la campaña desde la plataforma.
SENDING: Envío en progreso.
PAUSED: Envío pausado.
FINISHED: Envío finalizado.
CANCELLED: Envío cancelado.
EDITING: El envío está siendo editado desde la plataforma.
OPENED: Los envíos por API reportarán este estado. Indica que el envío puede aceptar más mensajes.
AUTOMATED: Envío automatizado a la espera de que se cumplan las condiciones de automatización.
WAITING: Envío trigger a la espera de que se cumplan las condiciones de envío.
sendings.*.channel Canal del envío. Posibles valores: sms, mailing, landing y text2speech.
sendings.*.total Total de mensajes a ser enviados.
sendings.*.processed Total de mensajes enviados.
sendings.*.totalSmsParts Solo aplicable a envíos SMS. Se indicará el total de partes de sms enviadas para envíos concatenados.
sendings.*.cost Coste del envío.
sendings.*.currency Código de moneda para el coste.
sendings.*.tags Etiquetas asignadas al envío.
sendings.*.scheduledAt Fecha de programación de la campaña. No se enviará ningún mensaje antes de esta fecha.
sendings.*.expiresAt Fecha de expiración de la campaña. Pasada esta fecha no se enviarán más mensajes.
sendings.*.events Resumen de totales de eventos producidos en el envío. Eventos:
delivered: El mensaje ha sido entregado al contacto.
opened: El contacto ha abierto el mensaje. No aplicable a sms y text2speech.
opened_unique: Total de aperturas únicas. No aplicable a sms y text2speech.
clicked: El contacto ha hecho click en un enlace del mensaje. No aplicable a sms y text2speech.
clicked_unique: Total de clicks únicos. No aplicable a sms y text2speech.
unsubscribed: El contacto se ha dado de baja de la lista.
hard_bounced: Total hard bounces generados por el envío. Solo aplicable a mailing.
complaint: El contacto ha marcado el mensaje como no deseado.
sent: El mensaje ha sido enviado al contacto.
soft_bounced: Total soft bounces generados por el envío. Solo aplicable a mailing.
undelivered: No ha sido posible entregar el mensaje al contacto.
rejected: Se ha rechazado el intento de envío del mensaje.
expired: El mensaje ha sido rechazado por cumplirse la fecha de expiración de la campaña.
unsubscribed_landing: El contacto se ha dado de baja de la lista desde la landing page incluida en el mensaje.

Bases de datos

Contactos

Listado 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 Descripción
limit Total de contactos a mostrar en una única petición. Valor por defecto: 100. Máximo: 1000.
include Incluir los subrecursos asociados en la respuesta. Es posible especificar varios valores separándolos por comas. Valores disponibles: customFields, groups.
email Filtrar los contactos por el email especificado: Ejemplo: email=myemail@example.com.
phone Filtrar los contactos por el teléfono especificado: Ejemplo: phone=34666666666.
landline Filtrar los contactos por el teléfono fijo especificado: Ejemplo: landline=900222222.
countryIso Filtrar los contactos por el país especificado: Ejemplo: countryIso=ES.
externalId Filtrar los contactos por el externalId especificado: Ejemplo: externalId=EXT1.

Mostrar un 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 Descripción
include Incluir los subrecursos asociados en la respuesta. Es posible especificar varios valores separándolos por comas. Valores disponibles: customFields, groups.

Crear un nuevo 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 Obligatorio Descripción
email string Obligatorio cuando no se especifica phone o landline Email del nuevo contacto.
phone string Obligatorio cuando no se especifica email o landline Número de teléfono móvil del contacto.
landline string Obligatorio cuando no se especifica email o phone Número de teléfono fijo del contacto.
countryIso string Obligatorio cuando se especifica phone o landline ISO code de 2 letras del país del contacto.
groupsIds array Obligatorio si no se especifica groupsNames Lista de grupos en los que se añadirá el nuevo contacto. Para obtener las ids de grupos consultar la documentación para el endpoint correspondiente.
groupsNames array Obligatorio si no se especifica groupsIds Alternativamente, si no se dispone del listado de IDs de grupos, se puede especificar un listado con los nombres de los grupos a los que añadir el contacto.
name string No Nombre del contacto.
surname string No Apellidos del contacto.
customFields[]key string No Nombre del campo personalizado a añadir.
customFields[]type string No Tipo del campo personalizado. Posibles valores: string, date, decimal. Para utilizar un campo fecha el valor debe estar en formato ISO8601. Valor por defecto: string.
customFields[]value string No Valor del campo personalizado.

Actualizar un 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 Obligatorio Descripción
email string Obligatorio cuando no se especifica phone o landline Email del nuevo contacto.
phone string Obligatorio cuando no se especifica email o landline Número de teléfono móvil del contacto.
landline string Obligatorio cuando no se especifica email o phone Número de teléfono fijo del contacto.
countryIso string Obligatorio cuando se especifica phone o landline ISO code de 2 letras del país del contacto.
groupsIds array Obligatorio si no se especifica groupsNames Lista de grupos en los que se añadirá el nuevo contacto. Para obtener las ids de grupos consultar la documentación para el endpoint correspondiente.
groupsNames array Obligatorio si no se especifica groupsIds Alternativamente, si no se dispone del listado de IDs de grupos, se puede especificar un listado con los nombres de los grupos a los que añadir el contacto.
name string No Nombre del contacto.
surname string No Apellidos del contacto.
customFields[]key string No Nombre del campo personalizado a añadir.
customFields[]type string No Tipo del campo personalizado. Posibles valores: string, date, decimal. Para utilizar un campo fecha el valor debe estar en formato ISO8601. Valor por defecto: string.
customFields[]value string No Valor del campo personalizado.

Eliminar un 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);
    }
  }
}

Si la petición ha sido correcta se responderá con un código HTTP 204.

Grupos

Listado 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 Descripción
limit Total de contactos a mostrar en una única petición. Valor por defecto: 100. Máximo: 1000.

Mostrar un 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"
  }
}

Crear un nuevo 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 Obligatorio Descripción
name string Nombre del nuevo grupo.

Actualizar un 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 Obligatorio Descripción
name string Nombre del nuevo grupo.

Eliminar un 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);
    }
  }
}

Si la petición ha sido correcta se responderá con un código HTTP 204.

Validación de emails

Listado de validaciones

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"
      }
    }
  }
}

Mostrar una validación

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 una validación (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
  }
}

La validación se realiza de la siguiente forma, se hace una petición indicando los IDs de grupo o los emails para validar uno o varios grupos o uno o varios emails.

Si todo va bien, la petición devolverá el estado "pending", que significa que está en cola para ser procesado.

Una vez empiece el proceso de validación notificará con un estado "started" y cuando acabe notificará con "finished" con los datos con el total de procesados y el total de válidos entre otros datos. Además en la notificación de "finished" se recibirá la url para poder obtener el detalle completo.

Parámetros

Parámetro Tipo Obligatorio Descripción
groupsIds array No (siempre que haya emails) Listado de grupos a validar (consultar endpoint grupos) dentro del API contactos.
emails array No (siempre que haya groupIds) Listado de emails a validar.
force boolean No En caso de ser true, se verificarán emails que ya han sido verificados anteriormente. Valor por defecto false.
allowRisky boolean No Valor por defecto false. Si el valor es false, se añadirán los correos dudosos a la lista negra, impidiendo su envío. Si el valor es true, se permitirá el envío de estos correos.
notificationUrl string No URL de callback en la que se recibirán las notificaciones de progreso (ver anexo de notificaciones).

Eliminar una validación

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);
    }
  }
}

Es posible eliminar una validación de tu lista de validaciones.

Si la petición ha sido correcta se responderá con un código HTTP 204.

Ejemplos de notificaciones

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 en 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 URL

Parámetro Descripción
type Tipo de blacklist: sms, mailing, voice.

Filtros

Parámetro Descripción
limit Total de contactos a mostrar en una única petición. Valor por defecto: 100. Máximo: 1000.
recipient Filtrar por destinatario. Ejemplo: ?recipient=test%40example.com
sendingId Filtrar por sendingId. Ejemplo: ?sendingId=123

Añadir contacto a la 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 URL

Parámetro Descripción
type Tipo de blacklist: sms, mailing, voice.

Parámetros

Parámetro Tipo Obligatorio Descripción
recipient string Destinatario a añadir en la lista negra.

Eliminar un contacto de la 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 URL

Parámetro Descripción
type Tipo de blacklist: sms, mailing, voice.

Parámetros

Parámetro Tipo Obligatorio Descripción
recipient string Destinatario a eliminar de la lista negra.

Si la petición ha sido correcta se responderá con un código HTTP 204.

Plantillas y archivos

Plantillas

Listado de plantillas

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 una plantilla

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
  }
}

Crear una nueva plantilla

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 Descripción
name string Nombre de la plantilla
html string Contenido de la plantilla en formato HTML y codificación UTF-8.

Actualizar una plantilla

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 Descripción
name string Nombre de la plantilla
html string Contenido de la plantilla en formato HTML y codificación UTF-8.

Eliminar una plantilla

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);
    }
  }
}

Si la petición ha sido correcta se responderá con un código HTTP 204.

Previsualizar una plantilla

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);
    }
  }
}

La respuesta contendrá una vista previa de la plantilla en formato HTML.

Variables personalizadas en plantillas

Es posible utilizar variables personalizadas en las plantillas, que serán sustituidas por los campos personalizados del contacto en el momento del envío, utilizando la sintaxis {variable}.

Por ejemplo, para incluir la variable personalizada "name" en una plantilla HTML:

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

Las plantillas aceptan los siguientes patrones de sustitución para el link en los enlaces HTML.

Patrón Descripción
[unsubscribe_link] Enlace a la página de baja.
[form_{ID}] Enlace al formulario con id {ID}
[show_link] Enlace para ver la plantilla desde el navegador web. Útil para los envíos de tipo mailing.
[attachment_{ID}] Enlace al archivo adjunto con id {ID}

Por ejemplo para incluir un enlace al formulario con id "12":

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

Plantillas V2

Listado de plantillas

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 una plantilla

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
  }
}

Crear una nueva plantilla

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 Descripción
name string Nombre de la plantilla
html string Contenido de la plantilla en formato HTML y codificación UTF-8.

Actualizar una plantilla

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 Descripción
name string Nombre de la plantilla
html string Contenido de la plantilla en formato HTML y codificación UTF-8.

Eliminar una plantilla

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);
    }
  }
}

Si la petición ha sido correcta se responderá con un código HTTP 204.

Previsualizar una plantilla

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);
    }
  }
}

La respuesta contendrá una vista previa de la plantilla en formato HTML.

Variables personalizadas en plantillas

Es posible utilizar variables personalizadas en las plantillas, que serán sustituidas por los campos personalizados del contacto en el momento del envío, utilizando la sintaxis {variable}.

Por ejemplo, para incluir la variable personalizada "name" en una plantilla HTML:

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

Las plantillas aceptan los siguientes patrones de sustitución para el link en los enlaces HTML.

Patrón Descripción
[unsubscribe_link] Enlace a la página de baja.
[form_{ID}] Enlace al formulario con id {ID}
[show_link] Enlace para ver la plantilla desde el navegador web. Útil para los envíos de tipo mailing.
[attachment_{ID}] Enlace al archivo adjunto con id {ID}

Por ejemplo para incluir un enlace al formulario con id "12":

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

Formularios

Crear un formulario

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 Obligatorio Descripción
name string Nombre único del formulario.
editable boolean No 'true': una vez enviado el cliente podrá volver a enviarlo.
'false': una vez enviado el cliente no podrá volver a enviarlo. Por defecto true.
rejectButton boolean No 'true': además del botón de Enviar aparecerá el botón de Rechazar. El botón de Rechazar no envía los datos.
'false': únicamente aparecerá el botón de Enviar. Por defecto false.
backgroundUrl string No Url de imagen de fondo del formulario.
logoUrl string No Url de imagen de logo del formulario.
formFields array Conjunto de elementos que tendrá el formulario. Ver anexo para ver todos los elementos.

Formulario de ejemplo:

Actualizar un formulario

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 Obligatorio Descripción
name string Nombre único del formulario.
editable boolean No 'true': una vez enviado el cliente podrá volver a enviarlo.
'false': una vez enviado el cliente no podrá volver a enviarlo. Por defecto true.
rejectButton boolean No 'true': además del botón de Enviar aparecerá el botón de Rechazar. El botón de Rechazar no envía los datos.
'false': únicamente aparecerá el botón de Enviar. Por defecto false.
backgroundUrl string No Url de imagen de fondo del formulario.
logoUrl string No Url de imagen de logo del formulario.
formFields array Conjunto de elementos que tendrá el formulario. Ver anexo para ver todos los elementos.

Listado de formularios

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 un formulario

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 un formulario

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