Reputation: 47
Is there a method to get measurement series from Cumulocity API using the Java SDK? When using the measurement-API, I only seem to be able to get measurement collections. To prevent unnecessary overhead in the communication I would like to only get the measurement series. Basically, the same result as if I am querying {{url}}/measurement/measurements/series
via Postman.
Upvotes: -1
Views: 256
Reputation: 51
No, currently {{url}}/measurement/measurements/series
is most performant API and Java SDK has no method and response object, like measurement api. you still can use platform to get and deserialise response.
@JsonIgnoreProperties(ignoreUnknown = true)
public class Series {
private Map<String, List<MinMax>> values;
private boolean truncated;
...
}
@JsonIgnoreProperties(ignoreUnknown = true)
public class MinMax {
private float min;
private float max;
...
}
String url = "{{url}}/measurement/measurements/series?source={{source}}&series={{series}}&....";
CumulocityCredentials credentials = new CumulocityCredentials("{{user}}", "{{password}}");
Platform platform = PlatformImpl("{{url}}", credentials, 5000);
platform.rest().get(url, MediaType.APPLICATION_JSON_TYPE, Series.class);
Upvotes: 0
Reputation: 19
I'm afraid currently it is not possible get supported series by InventoryApi. You have to call REST method GET /inventory/managedObjects/<id>/supportedSeries
Update 15.01.2019: It's now available since 9.20.0.
Disclaimer: I'm cumulocity developer.
Upvotes: 1