Skip to main content

Please add better documentation around the behavior of status code 422 for Create Time Series.  Specifically, I’d like these questions answered:

  • When multiple external ids are given and some are duplicate and some are not, will the time series that are not duplicates be inserted and will these created ids be returned in the response?
  • Does this function similar to datapoints where create is actually create or update and the duplicates are updated with the data provided?  If not, what is the recommended pattern for create or update of time series entities through the API?

I am aware of advice here around “EAFP vs LBYL”, but I am in a case where 98% of the time the time series will not exist and I’d like to optimize for this case.  Thanks!

Agree that the documentation should be better.
As for the 422 status code (and the other 4xx codes for that matter), we abort the request before we create the time series in the database. The response will tell you which externalIds are duplicated, so that you can remove them from the request and retry the rest.

You could request time series by id, which will tell you which time series exist, either through the error message, or, with ignoreUnknownIds=true through the ids in the response. However, it is faster to just try to insert.

To update, you will have to use update time series, with a special syntax. There are no endpoints to upsert a time series.


Hi @Ben Brandt,

I just want to let you know that we will request an update of the documentation.

Hopefully @matiasholte’s answer was helpful. 

Have a nice day!

Carin


Reply