Joomag API 2.0 文件

联系人

获得联系人列表

您帐户下的联系人的返回列表。

GET /api/2.0/contacts

举例:

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

回复:

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

创建联系人

在帐户中创建联系人。

POST /api/2.0/contacts
参数 类型 解释
email 字符串 联系人的电子邮件地址
full_name 字符串 联系人的全名
country 字符串 联系人的国家/地区
city 字符串 城市地址
street 字符串 街道
zip 字符串 合同邮政编码

举例:

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

回复:

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

创建一个令牌

为联系人创建访问令牌。

POST /api/2.0/contacts/<email>/token
参数 类型 解释
is_single_use 布尔值 用于指示该令牌是否应仅供单个人使用的布尔标记的值应为 noyes
expiration_date 字符串 描述代币的过期日。正确格式:2015-03-292015-03-29 17:55:34

举例:

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

回复:

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

发送单刊

将一份出版物发送给特定的联系人。

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

举例:

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

回复:

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

发送杂志订阅

向指定联系人交付订阅的杂志。

POST /api/2.0/contacts/<email>/subscription/<magazine_id>
参数 类型 解释
cycle int 杂志的订阅周期。必须仅在提供付费订阅时发送。可以有以下值:
  • 1 - 7天的subscription
  • 2 - 1个月subscription
  • 3 - 2个月subscription
  • 4 - 3个月subscription
  • 5 - 6个月subscription
  • 6 - 1年subscription

举例:

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

回复:

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

删除联系人

删除请求的联系人。

DELETE /api/2.0/contacts/<email>

举例:

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

回复:

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

删除符号

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

举例:

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

回复:

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