Joomag API 2.0 Documentation

Contacts

Get Contacts List

Returns list of contacts under your account.

GET /api/2.0/contacts

Example:

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

Response:

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

Create a Contact

Creates a contact in the account.

POST /api/2.0/contacts
Parameter Type Explanation
email string Email address of the contact
full_name string Full name of the contact
country string Country of the contact
city string City of address
street string Street
zip string Zip code of the contact

Example:

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

Response:

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

Create a Token

Creates access token for contact.

POST /api/2.0/contacts/<email>/token
Parameter Type Explanation
is_single_use bool Boolean flag to indicate whether the token should be for single use, should have value of either no or yes
expiration_date string Describe Expiration date of token. Valid format: 2015-03-29 or 2015-03-29 17:55:34.

Example:

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

Response:

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

Send Single Issue

Deliver single issue to specified contact.

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

Example:

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

Response:

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

Send Magazine Subscription

Deliver magazine Subscription to specified contact.

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

Example:

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

Response:

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

Delete Contact

Deletes the requested contact.

DELETE /api/2.0/contacts/<email>

Example:

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

Response:

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

Delete Tokens

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

Example:

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

Response:

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