From f7680efa187f26e277a7274bdc3e5bc70c58f753 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 18 Apr 2015 11:42:10 -0400 Subject: [PATCH] Add software version to the api --- docs/json-rpc-api.markdown | 28 ++++++++++++++++++++++++++++ jsonrpc.php | 6 ++++++ 2 files changed, 34 insertions(+) diff --git a/docs/json-rpc-api.markdown b/docs/json-rpc-api.markdown index 04a5412..afd906c 100644 --- a/docs/json-rpc-api.markdown +++ b/docs/json-rpc-api.markdown @@ -109,6 +109,34 @@ Array Procedures ---------- +### app.version + +Get the application version. + +- **Arguments:** None +- **Return:** Software version + +Request: + +```bash +curl \ +-u "demo:swB3/nSo1CB1X2F" \ +-d '{"jsonrpc": "2.0", "method": "app.version", "id": 1}' \ +https://miniflux.net/demo/jsonrpc.php +``` + +Response: + +```json +{ + "jsonrpc":"2.0", + "id":1, + "result": { + "version":"master" + } +} +``` + ### feed.list Get the list of subscriptions. diff --git a/jsonrpc.php b/jsonrpc.php index a25af1b..3fa3fa9 100644 --- a/jsonrpc.php +++ b/jsonrpc.php @@ -10,6 +10,12 @@ $server->authentication(array( \Model\Config\get('username') => \Model\Config\get('api_token') )); +// Get version +$server->register('app.version', function () { + + return array('version' => APP_VERSION); +}); + // Get all feeds $server->register('feed.list', function () {