Joomag API 2.0 文件

在PDF创建期刊

通过PDF文件创建杂志期数

POST /api/2.0/magazines/<id>
参数 类型 解释
pdf 文件 PDF文件创建杂志期刊
volume 字符串 当期卷号有待创建
description 字符串 将要创建期刊的描述
keywords 字符串 一列用逗号分隔的与该期有关的关键词
category int 发行物的种类,持续来自 杂志种类列表
allow_print 布尔值 Boolean标示指出期刊是否是可打印的,应该在数值为no或者yes
allow_download 布尔值 标上旗帜以说明该期杂志是否应设为可下载,值或者是no,或者是yes
privacy 字符串 隐私等级或者期刊,可以是 private 或者 unlisted

举例:

# Include the API wrapper class
require "JoomagREST.php";

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

# ID of the magazine
$magazineID = "M0250759001409245540";

# Path to the PDF file
$pdf = __DIR__ . "/magazine.pdf";

# Make the call to the client.
$result = $jmClient->createIssueFromPDF( $magazineID, $pdf, array(
    "volume" => "Jul 2014",
    "description" => "Magazine description goes here...",
    "keywords" => "Comma,separated,keywords",
    "category" => 1,
    "allow_print" => 'yes',
    "allow_download" => 'no'
));

回复:

议题 TempID 是在将 PDF 转换为 Joomag 议题时的临时 ID

{
  "error": 0,
  "message": "OK",
  "data": {
    "issueTempID": "1d6bb45be5cf7e3778985467bea009c4"
  }
}

获取期刊转换状态

将从 PDF 进行转换的当前阶段返回到 Joomag 期刊。

GET /api/2.0/magazines/<id>/issues/<issueTempID>/status
GET /api/2.0/issues/<issueTempID>/status
参数 类型 解释
issueTempID 字符串 这是在将PDF转换为Joomag Issue期间的临时ID。 从createIssuePDF的回应中使用issueTempID。

举例:

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

回复:

{
  "error": 0,
  "message": "OK",
  "data": [
    {
      "status": "ready",
      "ID": "0806746001433247707",
      "url": "http://www.joomag.com/magazine/mag/0806746001433247707",
      "cover": "https://s1.joomag.net/res_mag/3/3222/3222314/287017/thumbs/6637753.jpg?1433247710",
      "pages_count": 2
    }
  ]
}

获取期详情

返回被请求期刊的属性

GET /api/2.0/magazines/<id>/issues/<id>
GET /api/2.0/issues/<id>

举例:

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

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

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

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

回复:

{
  "error": 0,
  "message": "OK",
  "data": {
    "ID": "0980693001409324380",
    "title": "Cars Magazine Pro Jul 2014",
    "volume": "Jul 2014",
    "description": "Magazine description goes here...",
    "language": "es",
    "type": 1,
    "category": 8,
    "secondary_category": null,
    "is_published": true,
    "privacy": "private",
    "creation_date": "2014-08-29 09:59:40",
    "page_height": 841,
    "page_width": 595,
    "preview_pages": null,
    "adult_content": false,
    "pages_count": 6,
    "cover": "http:\/\/s1.joomag.com\/res_mag\/0\/178\/178119\/316952\/thumbs\/7463808.jpg",
    "mobile_support": true,
    "allow_download": false,
    "allow_print": false,
    "tags": ["keywords", "comma", "separated"]
  }
}

获取嵌入代码

为请求的杂志获得HTML嵌入码。

GET /api/2.0/magazines/<id>/issues/<id>/embed-code
POST /api/2.0/issues/<id>/embed-code
参数 类型 解释
width int 嵌入事件宽度。可以用百分比(例如:100%)或者用像素(例如:500px)。
height int 出版嵌入的高度。可以为百分比(例如100%)或像素(例如500像素)。
start_page int 应打开嵌入的页码的页码号。
auto_flip int 数秒内自动翻页。忽略以禁用自动翻页。
background_color 字符串 背景颜色嵌入。颜色的RGB十六进制(例子:e2e2d1)

举例:

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

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

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

# Make the call to the client.
$result = $jmClient->get("issues/$issueID/embed-code", array(
    'width' => 800,
    'height' => 600,
    'start_page' => 2,
    'auto_flip' => 5,
    'background_color' => '567147'
));

回复:

{
  "error": 0,
  "message": "OK",
  "data": {
    "embed_code": "<iframe name=\"Joomag_embed_47ccbf7a-6e78-4755-9920-53d568472b51\" style=\"width:800px;height:600px\" width=\"800px\" height=\"600px\" hspace=\"0\" vspace=\"0\" frameborder=\"0\" src=\"http:\/\/www.joomag.com\/magazine\/paid-test-clone-\/0827766001386622771?p=2&amp;e=1&amp;autoFlipDelay=5&amp;embedInfo=;solid,567147\"><\/iframe>"
  }
}

删除议题

删除杂志期刊申请

DELETE /api/2.0/magazines/<id>/issues/<id>
DELETE /api/2.0/issues/<id>

举例:

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

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

# ID of the issue
$issueID = "0727865001409319307";

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

回复:

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

更新刊物详情

更新所请求的杂志期刊的属性

PUT /api/2.0/magazines/<id>/issues/<id>
PUT /api/2.0/issues/<id>
参数 类型 解释
volume 字符串 期刊卷号
description 字符串 期刊描述
secondary_category int 第二类期刊,杂志类别列表的常见问题
adult_content 布尔值 布尔标志表示杂志是否包含成人内容,应具有值 noyes
allow_print 布尔值
allow_download 布尔值

举例:

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

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

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

# Make the call to the client.
$result = $jmClient->updateIssue( $issueID, array(
    'volume' => 'Aug 2014',
    'description' => 'The newest issue',
    'adult_content' => 'yes',
    'allow_print' => 'yes',
    'allow_download' => 'yes'
));

回复:

{
  "error": 0,
  "message": "OK",
  "data": {
    "ID": "0980693001409324380",
    "title": "Cars Magazine Pro Jul 2014",
    "volume": "Aug 2014",
    "description": "The newest issue",
    "language": "es",
    "type": 1,
    "category": 8,
    "secondary_category": null,
    "price": 0,
    "privacy": "unlisted",
    "creation_date": "2014-08-29 09:59:40",
    "page_height": 841,
    "page_width": 595,
    "preview_pages": null,
    "adult_content": true,
    "pages_count": 6,
    "cover": "http:\/\/s1.joomag.com\/res_mag\/0\/178\/178119\/316952\/thumbs\/7463808.jpg",
    "mobile_support": true,
    "allow_download": true,
    "allow_print": true,
    "tags": ["keywords", "comma", "separated"]
  }
}

发布期刊

出版了要求的杂志期刊

PUT /api/2.0/issues/<id>/publish-state
参数 类型 解释
privacy 字符串 隐私等级或期号可以是privateunlisted

举例:

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

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

# ID of the issue
$issueID = "0649338001409248394";

# Make the call to the client.
$result = $jmClient->publishIssue( $issueID, 'unlisted' );

回复:

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

取消出版

取消出版要求的杂志期刊。

DELETE /api/2.0/issues/<id>/publish-state

举例:

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

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

# ID of the issue
$issueID = "0727865001409319307";

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

回复:

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

检查发布状态

检查期刊是否已发布。

GET /api/2.0/issues/<id>/publish-state

举例:

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

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

# ID of the issue
$issueID = "0727865001409319307";

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

回复:

{
  "error": 0,
  "message": "OK",
  "data": {
    "is_published": true
  }
}