cognitedata/cognite-sdk-js

Enhancement: Return timeseries data in v0.5

Closed this issue · 3 comments

Problem

As a user of the SDK it would be nice to use the data after creating it. Imagine a user wanting to create some timeseries and then add some sort of subscription based on that data. Currently, one needs to:

  1. Create the timeseries
  2. List all timeseries data and filter out those irrelevant

That means 2 calls to the SDK, which is not a great experience, for developers using the SDK.

Proposed

Returning the timeseries data from calling the sdk method sdk.TimeSeries.create.

https://github.com/cognitedata/cognitesdk-js/blob/master/src/TimeSeries.ts#L85-L86

#8 is relevant, patch for this is probably okay

Yes, this is a known inconsistency.

The background for this is that the timeseries api (0.5) didn't return created timeseries from the API (https://doc.cognitedata.com/api/0.5/#operation/postTimeSeries). All other APIs did this. We decided quite early that we wanted the SDK to be a 1:1 mapping between SDK-call & API-calls.

I am happy to announce that SDK (for v1) returns the created timeseries (https://cognitedata.github.io/cognitesdk-js/classes/timeseriesapi.html#create)

It will not prioritised to fix this for the SDK for 0.5 since we will deprecate 0.5 very soon. We encourage everyone to migrate to the SDK for v1.

Thanks for the update. Will update to v1 instead!