src/main/java/com/w3asel/cubesensors/api/v1/CubeSensorsApiV1.java
public List<State> getSpan(final String uid, final ZonedDateTime start, final ZonedDateTime end, final Integer resolution) {
		final String queryUrl = RESOURCES_ROOT + DEVICES_PATH + uid + "/span";
		LOGGER.trace("Querying: {}", queryUrl);

		final OAuthRequest request = new OAuthRequest(Verb.GET, queryUrl);
		request.getHeaders().put(HTTP_HEADER_ACCEPT, MEDIA_TYPE_APPLICATION_JSON);

		if (start != null) {
			final ZonedDateTime startUtc = start.withZoneSameInstant(ZoneId.of("Z")).truncatedTo(ChronoUnit.SECONDS);
			request.addQuerystringParameter("start", startUtc.toString());
			LOGGER.trace("Adding querystring parameter {}={}", "start", startUtc);
		}
		if (end != null) {
			final ZonedDateTime endUtc = end.withZoneSameInstant(ZoneId.of("Z")).truncatedTo(ChronoUnit.SECONDS);
			request.addQuerystringParameter("end", endUtc.toString());
			LOGGER.trace("Adding querystring parameter {}={}", "end", endUtc);
		}
		if (resolution != null) {
			request.addQuerystringParameter("resolution", resolution.toString());
			LOGGER.trace("Adding querystring parameter {}={}", "resolution", resolution);
		}

		service.signRequest(accessToken, request);
		final Response response = request.send();
		LOGGER.trace("Response: {}", response.getBody());

		if (!response.isSuccessful()) {
			throw new CubeSensorsException(response.getBody());
		}

		final JsonSpanResponse queryResponse = parseQuery(response.getBody(), JsonSpanResponse.class);
		if (queryResponse == null) {
			return new ArrayList<>();
		}

		final List<State> states = StateParser.parseState(queryResponse.fieldList, queryResponse.results);

		LOGGER.debug("Retrieved {} states.", states.size());

		return states;
	}
public List<State> getSpan(final String uid, final ZonedDateTime start, final ZonedDateTime end, final Integer resolution) {
		final String queryUrl = RESOURCES_ROOT + DEVICES_PATH + uid + "/span";
		LOGGER.trace("Querying: {}", queryUrl);

		final OAuthRequest request = new OAuthRequest(Verb.GET, queryUrl);
		request.getHeaders().put(HTTP_HEADER_ACCEPT, MEDIA_TYPE_APPLICATION_JSON);

		if (start != null) {
			final ZonedDateTime startUtc = start.withZoneSameInstant(ZoneId.of("Z")).truncatedTo(ChronoUnit.SECONDS);
			request.addQuerystringParameter("start", startUtc.toString());
			LOGGER.trace("Adding querystring parameter {}={}", "start", startUtc);
		}
		if (end != null) {
			final ZonedDateTime endUtc = end.withZoneSameInstant(ZoneId.of("Z")).truncatedTo(ChronoUnit.SECONDS);
			request.addQuerystringParameter("end", endUtc.toString());
			LOGGER.trace("Adding querystring parameter {}={}", "end", endUtc);
		}
		if (resolution != null) {
			request.addQuerystringParameter("resolution", resolution.toString());
			LOGGER.trace("Adding querystring parameter {}={}", "resolution", resolution);
		}

		service.signRequest(accessToken, request);
		final Response response = request.send();
		LOGGER.trace("Response: {}", response.getBody());

		if (!response.isSuccessful()) {
			throw new CubeSensorsException(response.getBody());
		}

		final JsonSpanResponse queryResponse = parseQuery(response.getBody(), JsonSpanResponse.class);
		if (queryResponse == null) {
			return new ArrayList<>();
		}

		final List<State> states = StateParser.parseState(queryResponse.fieldList, queryResponse.results);

		LOGGER.debug("Retrieved {} states.", states.size());

		return states;
	}
public List < State > getSpan ( final String uid , final ZonedDateTime start , final ZonedDateTime end , final Integer resolution ) { final String queryUrl = RESOURCES_ROOT + DEVICES_PATH + uid + "/span" ; LOGGER . trace ( "Querying: {}" , queryUrl ) ; final OAuthRequest request = new OAuthRequest ( Verb . GET , queryUrl ) ; request . getHeaders ( ) . put ( HTTP_HEADER_ACCEPT , MEDIA_TYPE_APPLICATION_JSON ) ; if ( start != null ) { final ZonedDateTime startUtc = start . withZoneSameInstant ( ZoneId . of ( "Z" ) ) . truncatedTo ( ChronoUnit . SECONDS ) ; request . addQuerystringParameter ( "start" , startUtc . toString ( ) ) ; LOGGER . trace ( "Adding querystring parameter {}={}" , "start" , startUtc ) ; } if ( end != null ) { final ZonedDateTime endUtc = end . withZoneSameInstant ( ZoneId . of ( "Z" ) ) . truncatedTo ( ChronoUnit . SECONDS ) ; request . addQuerystringParameter ( "end" , endUtc . toString ( ) ) ; LOGGER . trace ( "Adding querystring parameter {}={}" , "end" , endUtc ) ; } if ( resolution != null ) { request . addQuerystringParameter ( "resolution" , resolution . toString ( ) ) ; LOGGER . trace ( "Adding querystring parameter {}={}" , "resolution" , resolution ) ; } service . signRequest ( accessToken , request ) ; final Response response = request . send ( ) ; LOGGER . trace ( "Response: {}" , response . getBody ( ) ) ; if ( ! response . isSuccessful ( ) ) { throw new CubeSensorsException ( response . getBody ( ) ) ; } final JsonSpanResponse queryResponse = parseQuery ( response . getBody ( ) , JsonSpanResponse . class ) ; if ( queryResponse == null ) { return new ArrayList <> ( ) ; } final List < State > states = StateParser . parseState ( queryResponse . fieldList , queryResponse . results ) ; LOGGER . debug ( "Retrieved {} states." , states . size ( ) ) ; return states ; }
Queries for a list of states over the time span specified. Leaving a field {@code null} will default to the API defaults.

@param uid
the UID of the device to request data for
@param start
the query start time
@param end
the query end time
@param resolution
the resolution in minutes
@return a list of all states returned by the API
@throws CubeSensorsException
when a request fails
Queries for a list of states over the time span specified . Leaving a field { @code null } will default to the API defaults .