-1

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.

Jan Hommes
  • 5,122
  • 4
  • 33
  • 45
Lee Kebum
  • 37
  • 3
  • Please turn to the [help] to learn how/what to ask here. I have honestly know clue what you are looking for (and note: requests for tools/libraries are off topic here). – GhostCat Oct 23 '18 at 07:05
  • I was told to ask those kind of questions here with the "cumulocity" tag (which this question is about), because cumulocity developers are looking into the questions here. I got good answers before so I thought this was the way to go. I'm sorry if this question confuses you because you may not have any knowledge about cumulocity. I will ask my question clearer next time. – Lee Kebum Oct 23 '18 at 07:12
  • So this question is about a specific api and not so much about java programming? This is not very clear from your question given the title. – Joakim Danielson Oct 23 '18 at 07:32
  • Exactly. I hopefully fixed it by removing the java tag. – Lee Kebum Oct 23 '18 at 07:43
  • You can raise a support ticket with a feature request for this. Maybe this finds the way into the SDK one day. – socona Oct 25 '18 at 13:22

2 Answers2

1

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.

Kamil S
  • 19
  • 3
  • That is true, but not exactly what was asked in the question. However getting only the measurement series is not possible as well. You'd have to make a REST API Call. – socona Oct 25 '18 at 13:21
0

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);
Caconde
  • 4,177
  • 7
  • 35
  • 32