Documentation de l'API Joomag 2.0

Contacts

Obtenir la liste de contacts

Renvoie la liste des contacts sous votre compte.

GET /api/2.0/contacts

Exemple:

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

Réponse:

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

Créez un contact

Crée un contact dans le compte

POST /api/2.0/contacts
Paramètre Type Explication
email séquence Adresse e-mail du contact
full_name séquence Nom complet du contact
country séquence Pays du contact
city séquence Ville de l'adresse
street séquence Rue
zip séquence Code postal du contact

Exemple:

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

Réponse:

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

Créer un jeton

Crée un jeton d'accès pour le contact.

POST /api/2.0/contacts/<email>/token
Paramètre Type Explication
is_single_use booléen Un indicateur booléen signale si l'élément est destiné à un usage unique, devrait avoir une valeur de no ou yes
expiration_date séquence Décrivez la date d'expiration du jeton. Format valide : 2015-03-29 ou 29-03-2015 17:55:34.

Exemple:

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

Réponse:

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

Envoyer un seul numéro

Envoyer un seul numéro à contact spécifique.

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

Exemple:

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

Réponse:

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

Envoyer l'abonnement au magazine

Fournir l'abonnement d'un magazine à un contact spécifique.

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

Exemple:

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

Réponse:

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

Supprimer le contact

Supprime le contact désiré.

DELETE /api/2.0/contacts/<email>

Exemple:

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

Réponse:

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

Supprimer les jetons

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

Exemple:

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

Réponse:

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