From 9055d0910c5db17b0ecbf6c8d8cc6b8fef6b77a9 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 14 Nov 2016 17:47:44 -0800 Subject: API: add GET api/z/1.0/abook --- include/api_zot.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'include') diff --git a/include/api_zot.php b/include/api_zot.php index 2390bb4c2..b4b4a1742 100644 --- a/include/api_zot.php +++ b/include/api_zot.php @@ -33,6 +33,8 @@ api_register_func('api/red/item/full','red_item', true); api_register_func('api/z/1.0/item/full','red_item', true); + api_register_func('api/z/1.0/abook','api_zot_abook_xchan',true); + return; } @@ -268,6 +270,23 @@ json_return_and_die($r); }; + function api_zot_abook_xchan($type) { + logger('api_abook_xchan'); + + if(api_user() === false) + return false; + + $sql_extra = ((array_key_exists('abook_id',$_REQUEST) && intval($_REQUEST['abook_id'])) ? ' and abook_id = ' . intval($_REQUEST['abook_id']) . ' ' : ''); + if($_SERVER['REQUEST_METHOD'] === 'POST') { + // update + } + $r = q("select * from abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d $sql_extra ", + intval(api_user()) + ); + + json_return_and_die($r); + }; + function red_item_new($type) { -- cgit v1.2.3