From e50f352643ec205822d9eadf3045a071ba078380 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Sun, 27 Apr 2014 23:03:57 +0200 Subject: Add a version tag to RPC replies This is needed for clients to quickly differentiate between different versions of the RPC API. The version number should be bumped whenever there is a change that breaks backwards compatibility. Signed-off-by: Lukas Fleischer --- web/lib/aurjson.class.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'web/lib/aurjson.class.php') diff --git a/web/lib/aurjson.class.php b/web/lib/aurjson.class.php index ab8ebbc..2e5e06d 100644 --- a/web/lib/aurjson.class.php +++ b/web/lib/aurjson.class.php @@ -115,7 +115,12 @@ class AurJSON { * @return mixed A json formatted result response. **/ private function json_results($type, $count, $data) { - return json_encode( array('type' => $type, 'resultcount' => $count, 'results' => $data) ); + return json_encode(array( + 'version' => 2, + 'type' => $type, + 'resultcount' => $count, + 'results' => $data + )); } private function get_extended_fields($pkgid) { -- cgit v1.2.3-54-g00ecf