Lee Kebum
Lee Kebum

Reputation: 47

Getting a Measurement Series via Java SDK for Cumulocity

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

Answers (2)

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

Kamil S
Kamil S

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

Related Questions