public Waypoint[] getWaypoints( Integer feedid, String start, String end, String duration, Integer interval, Boolean find_previous, Interval_type interval_type, String timezone) throws CosmException { try { String url = API_BASE_URL_V2 + API_RESOURCE_FEEDS + "/" + feedid + JSON_FILE_EXTENSION + "?"; boolean bAdd = false; if (start != null) { if (bAdd) url += '&'; url += "start=" + start; bAdd = true; } if (end != null) { if (bAdd) url += '&'; url += "end=" + end; bAdd = true; } if (duration != null) { if (bAdd) url += '&'; url += "duration=" + duration; bAdd = true; } if (interval != null) { if (bAdd) url += '&'; url += "interval=" + interval; bAdd = true; } if (find_previous != null) { if (bAdd) url += '&'; url += "find_previous=" + find_previous.toString(); bAdd = true; } if (interval_type != null) { if (bAdd) url += '&'; url += "interval_type=" + interval_type.toString(); bAdd = true; } if (timezone != null) { if (bAdd) url += '&'; url += "timezone=" + timezone; } HttpGet request = new HttpGet(url); HttpResponse response = this.client.execute(request); StatusLine statusLine = response.getStatusLine(); String body = this.client.getBody(response); if (statusLine.getStatusCode() == 200) { Feed feed = CosmFactory.toFeed(body); Location location = feed.getLocation(); Waypoint[] waypoints = location.getWaypoints(); return waypoints; } throw new CosmException(statusLine, body); } catch (CosmException e) { throw e; } catch (NullPointerException e) { throw new CosmException(NULL_POINTER_EXCEPTION_MESSAGE); } catch (IOException e) { throw new CosmException(IO_EXCEPTION_MESSAGE); } }