Documentação Joomag API 2.0

Contatos

Obter Lista de Contatos

Devolve lista de contatos da sua conta.

GET /api/2.0/contacts

Exemplo:

# 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();

Resposta:

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

Criar um Contato

Criar um contato na conta

POST /api/2.0/contacts
Parâmetro Tipo Explicação
email cadeia Endereço de email do contato
full_name cadeia Nome completo do contato
country cadeia Pais do contato
city cadeia Cidade do contato
street cadeia Rua
zip cadeia Código postal do contato

Exemplo:

# 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"
) );

Resposta:

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

Criar um Token

Cria acesso token para o contato.

POST /api/2.0/contacts/<email>/token
Parâmetro Tipo Explicação
is_single_use bool Bandeira booleana que indica se o token deve ser para somente um uso, deve ter valor de no o yes
expiration_date cadeia Descrever vencimento do token. Formato válido: 2015-03-29 ou 2015-03-29 17:55:34.

Exemplo:

# 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"
) );

Resposta:

{
  "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 Edição Única

Entregar edição única para o contato especificado.

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

Exemplo:

# 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" );

Resposta:

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

Enviar Assinatura da Revista

Entregar assinatura da revista para contato especificado.

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

Exemplo:

# 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" );

Resposta:

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

Excluir Contato

Exclui o contato solicitado

DELETE /api/2.0/contacts/<email>

Exemplo:

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

Resposta:

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

Excluir Tokens

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

Exemplo:

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

Resposta:

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