Documentación API Joomag 2.0

Contactos

Obtener Lista de Contactos

Recupere lista de contactos en su cuenta.

GET /api/2.0/contacts

Ejemplo:

# Include the API wrapper class (see "Libraries" for instructions)
require 'JoomagREST.php';

# Instantiate the client.
$jmClient = new JoomagREST(
    'api_de81b9eb3ff797796edc0cd00020b6c8',
    'sec_e8ff4e7e74c64fcfd63dcf728040ba3e5b29aa398e5cc1cb414011661c75fd19'
);

# Make the call to the client.
$result = $jmClient->getContactsList();

Respuesta:

{
  "error": 0,
  "message": "OK",
  "data": [
    {
      "email": "john@example.com"
    },
    {
      "email": "ketty@example.com"
    },
    {
      "email": "baz@example.com"
    },
    {
      "email": "foo@example.com"
    }
  ]
}

Crear un Contacto

Crear un contacto en esta cuenta.

POST /api/2.0/contacts
Parámetro Tipo Explicación
email cadena Correo del contacto
full_name cadena Nombre completo del contacto
country cadena País del contacto
city cadena Ciudad de correo
street cadena Calle
zip cadena Código postal del contacto

Ejemplo:

# Include the API wrapper class (see "Libraries" for instructions)
require 'JoomagREST.php';

# Instantiate the client.
$jmClient = new JoomagREST(
    'api_de81b9eb3ff797796edc0cd00020b6c8',
    'sec_e8ff4e7e74c64fcfd63dcf728040ba3e5b29aa398e5cc1cb414011661c75fd19'
);

# Make the call to the client.
$result = $jmClient->post( "contacts", array(
    "email"     => "john@example.com",
    "full_name" => "John Smith",
    "country"   => "US",
    "city"      => "New York",
    "street"    => "2250 Lexington Avenue",
    "zip"       => "10035"
) );

Respuesta:

{
  "error": 0,
  "message": "OK",
  "data": {
    "email": "john@example.com"
  }
}

Crear un Token

Crear acceso token para el contacto.

POST /api/2.0/contacts/<email>/token
Parámetro Tipo Explicación
is_single_use bool Bandera booleana para indicar si el token debe ser de un solo uso, debe tener un valor de no o yes
expiration_date cadena Describir fecha de Expiración del token. Formato válido: 2015-03-29 o 2015-03-29 17:55:34.

Ejemplo:

# Include the API wrapper class (see "Libraries" for instructions)
require 'JoomagREST.php';

# Instantiate the client.
$jmClient = new JoomagREST(
    'api_de81b9eb3ff797796edc0cd00020b6c8',
    'sec_e8ff4e7e74c64fcfd63dcf728040ba3e5b29aa398e5cc1cb414011661c75fd19'
);

# Subscriber email
$email = 'john@example.com';

# Make the call to the client.
$result = $jmClient->createToken( $email, array(
    "is_single_use"     => 'yes',
    "expiration_date"   => "2015-03-29"
) );

Respuesta:

{
  "error": 0,
  "message": "OK",
  "data": {
    "email": "john@example.com",
    "token": "r5ekPZLBUo/qNcPEAvB+3piXmSkFfoTORvI4VznS7yN29d/hrZwfBgvHLSfqC09+Zct7FZ/m5rM/X9Bp3qBEnKvZsXDsYIVs",
    "is_single_use": true,
    "expiration_date": "2015-03-29"
  },
}

Enviar Única Edición

Entregar Edición Única al contacto especificado.

POST /api/2.0/contacts/<email>/issue/<issue_id>

Ejemplo:

# Include the API wrapper class (see "Libraries" for instructions)
require 'JoomagREST.php';

# Instantiate the client.
$jmClient = new JoomagREST(
    'api_de81b9eb3ff797796edc0cd00020b6c8',
    'sec_e8ff4e7e74c64fcfd63dcf728040ba3e5b29aa398e5cc1cb414011661c75fd19'
);

# Subscriber email
$email = 'john@example.com';

# ID of the issue
$issueID = '0980693001409324380';

# Make the call to the client.
$result = $jmClient->post( "contacts/$email/issue/$issueID" );

Respuesta:

{
  "error": 0,
  "message": "OK",
  "data": []
}

Enviar Suscripción de la Revista

Entregar suscripción de la revista al contacto especificado.

POST /api/2.0/contacts/<email>/subscription/<magazine_id>

Ejemplo:

# Include the API wrapper class (see "Libraries" for instructions)
require 'JoomagREST.php';

# Instantiate the client.
$jmClient = new JoomagREST(
    'api_de81b9eb3ff797796edc0cd00020b6c8',
    'sec_e8ff4e7e74c64fcfd63dcf728040ba3e5b29aa398e5cc1cb414011661c75fd19'
);

# Subscriber email
$email = 'john@example.com';

# ID of the magazine
$magazineID = 'M0166830001409317679';

# Make the call to the client.
$result = $jmClient->post( "contacts/$email/subscription/$magazineID" );

Respuesta:

{
  "error": 0,
  "message": "OK",
  "data": []
}

Eliminar Contacto

Eliminar el contacto solicitado.

DELETE /api/2.0/contacts/<email>

Ejemplo:

# Include the API wrapper class (see "Libraries" for instructions)
require 'JoomagREST.php';

# Instantiate the client.
$jmClient = new JoomagREST(
    'api_de81b9eb3ff797796edc0cd00020b6c8',
    'sec_e8ff4e7e74c64fcfd63dcf728040ba3e5b29aa398e5cc1cb414011661c75fd19'
);

# Subscriber email
$email = 'john@example.com';

# Make the call to the client.
$result = $jmClient->deleteContact( $email );

Respuesta:

{
  "error": 0,
  "message": "OK",
  "data": []
}

Eliminar Tokens

DELETE /api/2.0/contacts/<email>/tokens

Ejemplo:

# Include the API wrapper class (see "Libraries" for instructions)
require 'JoomagREST.php';

# Instantiate the client.
$jmClient = new JoomagREST(
    'api_de81b9eb3ff797796edc0cd00020b6c8',
    'sec_e8ff4e7e74c64fcfd63dcf728040ba3e5b29aa398e5cc1cb414011661c75fd19'
);

# Subscriber email
$email = 'john@example.com';

# Make the call to the client.
$result = $jmClient->deleteAllTokens( $email );

Respuesta:

{
  "error": 0,
  "message": "OK",
  "data": []
}