Login
Request
<?php
$client = new http\Client;
$request = new http\Client\Request;
$body = new http\Message\Body;
$body->append('{
"email": "user@email.com",
"password": "user_pwd"
}');
$request->setRequestUrl('https://api-ne.paperlit.com/v8/users/token/get');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders(array(
'content-type' => 'application/json'
));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
Response
{
"error": false,
"method": "https://api-ne.paperlit.com/v8/users/token/get",
"data": {
"startIndex": 0,
"totalItems": 1,
"itemsPerPage": 20,
"itemsCount": 1,
"itemsType": "token",
"items": [
{
"accessToken": "pp-token-572c8e0ac4ff00.72164668",
"tokenType": "Bearer",
"expiresInSeconds": 86400,
"email": "user@email.com"
}
]
}
}
List projects
Request
<?php
$client = new http\Client;
$request = new http\Client\Request;
$request->setRequestUrl('https://api-ne.paperlit.com/v8/projects');
$request->setRequestMethod('GET');
$request->setHeaders(array(
'authorization' => 'Bearer pp-token-572c8e0ac4ff00.72164668'
));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
Response
{
"error": false,
"method": "https://api-ne.paperlit.com/v8/projects",
"data": {
"startIndex": 0,
"totalItems": 1,
"itemsPerPage": 20,
"itemsCount": 1,
"itemsType": "project",
"items": [
{
"projectId": "prj_aaabbbcccddd",
"projectName": "paperlit Playground",
"languages": [
"en_US"
],
"storageLocation": "EU",
"logoUrl": "https://example.com/appicon.png"
}
]
}
}
List publications of a project
Request
<?php
$client = new http\Client;
$request = new http\Client\Request;
$request->setRequestUrl('https://api-ne.paperlit.com/v8/projects/prj_aaabbbcccddd/publications');
$request->setRequestMethod('GET');
$request->setHeaders(array(
'authorization' => 'Bearer pp-token-572c8e0ac4ff00.72164668'
));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
Response
{
"error": false,
"method": "https://api-ne.paperlit.com/v8/projects/prj_aaabbbcccddd/publications",
"data": {
"startIndex": 0,
"totalItems": 1,
"itemsPerPage": 20,
"itemsCount": 1,
"itemsType": "publication",
"items": [
{
"publicationId": "572a61a27c6b9",
"description": null,
"projectId": "prj_aaabbbcccddd",
"readersEmail": null,
"supportEmail": null,
"autoPublish": false,
"maxNumberOfIssues": 3000,
"createdOn": "2016-05-04 20:54:58",
"updatedOn": "2016-05-04 20:55:18",
"deletedOn": null,
"sortingPosition": null,
"publicationName": "paperlit Playground",
"storageLocation": "EU"
}
]
}
}
List issues of a publication
Request
<?php
$client = new http\Client;
$request = new http\Client\Request;
$request->setRequestUrl('https://api-ne.paperlit.com/v8/projects/prj_aaabbbcccddd/issues/572a61a27c6b9');
$request->setRequestMethod('GET');
$request->setHeaders(array(
'authorization' => 'Bearer pp-token-572c8e0ac4ff00.72164668'
));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
Response
{
"error": false,
"method": "https://api-ne.paperlit.com/v8/projects/prj_aaabbbcccddd/issues/572a61a27c6b9",
"data": {
"startIndex": 0,
"totalItems": 1,
"itemsPerPage": 20,
"itemsCount": 1,
"itemsType": "issue",
"items": [
{
"publicationId": "572a61a27c6b9",
"issueId": "5000-01-02",
"issueName": "Flow",
"caption": null,
"uploadedOn": "2016-05-05 15:20:01",
"publishedOn": "2016-05-05 15:00:00",
"status": "published",
"pdfUrl": null,
"pdfSize": 0,
"metadataUrl": null,
"metadataModifiedOn": "2016-05-05 14:36:54",
"uniqueId": 31154,
"aspectRatio": 0.75,
"numberOfPages": 0,
"isForSale": false,
"thumbnailsUrl": "/pages/small.zip",
"tableOfContents": null,
"variants": [
{
"variantId": 196,
"issueUniqueId": 31154,
"platform": "universal",
"type": "hpub",
"narrowDimension": 0,
"wideDimension": 0,
"uploadFilename": "flow.hpub",
"status": "ready",
"metadataUrl": "http://paperlitne.blob.core.windows.net/issues/572a61a27c6b9/5000-01-02/4b099681/book.json",
"metadataModifiedOn": "2016-05-05 15:20:02",
"uploadedOn": "2016-05-05 15:20:02",
"deletedOn": null
}
]
}
]
}
}
Create new issue
Request
<?php
$client = new http\Client;
$request = new http\Client\Request;
$body = new http\Message\Body;
$body->append('{
"issueName": "New Issue",
"isForSale": true,
"publishedOn": "2020-01-01 01:00:00",
}');
$request->setRequestUrl('https://api-ne.paperlit.com/v8/projects/prj_aaabbbcccddd/issues/572a61a27c6b9');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders(array(
'content-type' => 'application/json',
'authorization' => 'Bearer pp-token-572c8e0ac4ff00.72164668'
));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
Response
{
"error": false,
"method": "https://api-ne.paperlit.com/v8/projects/prj_aaabbbcccddd/issues/572a61a27c6b9",
"data": {
"startIndex": 0,
"totalItems": 1,
"itemsPerPage": 20,
"itemsCount": 1,
"itemsType": "issue",
"items": [
{
"publicationId": "572a61a27c6b9",
"issueId": "5000-01-03",
"issueName": "New Issue",
"caption": null,
"uploadedOn": "2016-05-06 12:44:19",
"publishedOn": null,
"status": "processing",
"pdfUrl": null,
"pdfSize": 0,
"metadataUrl": null,
"metadataModifiedOn": "2016-05-06 12:44:18",
"uniqueId": 31165,
"type": "pdf",
"aspectRatio": 0,
"numberOfPages": 0,
"isForSale": true,
"thumbnailsUrl": "/pages/small.zip",
"tableOfContents": null,
"variants": []
}
]
}
}
Add issue variant
Request
<?php
$client = new http\Client;
$request = new http\Client\Request;
$body = new http\Message\Body;
$body->append('{
"fileUrl": "https://dl.dropboxusercontent.com/u/35358846/dsb.zip",
"uploadFilename": "dsb.zip",
"platform": "universal",
"type": "hpub"
}');
$request->setRequestUrl('https://api-ne.paperlit.com/v8/projects/prj_aaabbbcccddd/issues/31165/variants');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders(array(
'content-type' => 'application/json',
'authorization' => 'Bearer pp-token-572c8e0ac4ff00.72164668'
));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
Response
{
"error": false,
"method": "https://api-ne.paperlit.com/v8/projects/prj_aaabbbcccddd/issues/31165/variants",
"data": {
"startIndex": 0,
"totalItems": 1,
"itemsPerPage": 20,
"itemsCount": 1,
"itemsType": "variant",
"items": [
{
"issueUniqueId": 31165,
"uploadFilename": "dsb.zip",
"platform": "universal",
"type": "hpub",
"narrowDimension": 0,
"wideDimension": 0,
"uploadedOn": "2016-05-06 12:47:07",
"status": "processing",
"variantId": 206
}
]
}
}
Set issue variant info
Request
<?php
$client = new http\Client;
$request = new http\Client\Request;
$body = new http\Message\Body;
$body->append('{
"hasPreview": true,
"previewPages": [1,7,12,20]
}');
$request->setRequestUrl('https://api-ne.paperlit.com/v8/projects/prj_aaabbbcccddd/issues/31165/variants/206');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders(array(
'content-type' => 'application/json',
'authorization' => 'Bearer pp-token-572c8e0ac4ff00.72164668'
));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
Comments
0 comments
Article is closed for comments.