From fa0663d7df0cfcf0818e182f3d2d19fc6be2a5d1 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Tue, 8 Dec 2009 09:19:48 -0800 Subject: Rename the backing table from rest_keys to user_access_tokens Implement an api to format the errors and success messages Removed the custom routing... urls are now /rest// --- modules/rest/helpers/rest.php | 69 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 modules/rest/helpers/rest.php (limited to 'modules/rest/helpers/rest.php') diff --git a/modules/rest/helpers/rest.php b/modules/rest/helpers/rest.php new file mode 100644 index 00000000..34852a9e --- /dev/null +++ b/modules/rest/helpers/rest.php @@ -0,0 +1,69 @@ + "OK"); + if (!empty($message)) { + $response["message"] = (string)$message; + } + // We don't need to save the session for this request + Session::abort_save(); + return json_encode(array_merge($response, $response_data)); + } + + private static function _format_response($message, $log_message) { + if (!empty($log_message)) { + Kohana::log("info", $log_message); + } + // We don't need to save the session for this request + Session::abort_save(); + return json_encode(array("status" => "ERROR", "message" => (string)$message)); + } +} -- cgit v1.2.3