From 95110bf5dc4905b812906650c3efbae6574093d2 Mon Sep 17 00:00:00 2001 From: Aaron Parecki Date: Sun, 10 Jan 2016 19:30:10 -0800 Subject: [PATCH] include "geocode" property in response if it timed out --- README.md | 2 +- compass/app/Http/Controllers/Api.php | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6a58ea3..83df041 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ To read a database, make a GET request as follows: `GET /api/last` * token - (required) the read token for the database * tz - (optional, default UTC) timezone string (e.g. America/Los_Angeles) which will be used to determine the absolute start/end times for the day -* date - (optional, default to now) specify a full timestamp to return a single record before this date (the point returned will be no more than 24 hours before the given date) +* before - (optional, default to now) specify a full timestamp to return a single record before this date (the point returned will be no more than 24 hours before the given date) * geocode - (optional) if "true", then the location found will be reverse geocoded using [Atlas](https://atlas.p3k.io) to find the city and timezone at the location diff --git a/compass/app/Http/Controllers/Api.php b/compass/app/Http/Controllers/Api.php index fd0e623..27e846f 100644 --- a/compass/app/Http/Controllers/Api.php +++ b/compass/app/Http/Controllers/Api.php @@ -189,6 +189,8 @@ class Api extends BaseController $geocode = json_decode(curl_exec($ch)); if($geocode) { $response['geocode'] = $geocode; + } else { + $response['geocode'] = null; } }