forked from mikespub-org/seblucas-cops
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrestapi.php
More file actions
31 lines (25 loc) · 805 Bytes
/
restapi.php
File metadata and controls
31 lines (25 loc) · 805 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
/**
* COPS (Calibre OPDS PHP Server) REST API endpoint
*
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
* @author Sébastien Lucas <sebastien@slucas.fr>
* @author mikespub
*
*/
use SebLucas\Cops\Input\Config;
use SebLucas\Cops\Input\Request;
use SebLucas\Cops\Output\RestApi;
require_once __DIR__ . '/config.php';
// override splitting authors and books by first letter here?
Config::set('author_split_first_letter', '0');
Config::set('titles_split_first_letter', '0');
//Config::set('titles_split_publication_year', '0');
$request = new Request();
$apiHandler = new RestApi($request);
header('Content-Type:application/json;charset=utf-8');
try {
echo $apiHandler->getOutput();
} catch (Exception $e) {
echo json_encode(["Exception" => $e->getMessage()]);
}