Determine number of records availble in a ThingSpeak channel

4 ビュー (過去 30 日間)
DL KA
DL KA 2020 年 11 月 26 日
コメント済み: Christopher Stapels 2020 年 12 月 11 日
Using the REST API, I would like to be able to query for the number of records of data stored in a ThingSpeak channel before reading that data.
Is there a way to do this?
  2 件のコメント
Vinod
Vinod 2020 年 11 月 30 日
Can you tell me more about your application? Say you have the number of records stored, what do you intend to do with this data?
DL KA
DL KA 2020 年 11 月 30 日
I need to make decisions based on the number of records available before I read the quantity of records I need to operate on.

サインインしてコメントする。

回答 (1 件)

Vinod
Vinod 2020 年 12 月 3 日
編集済み: Vinod 2020 年 12 月 3 日
I'd recommend the best solution is to retrieve data based on date range. Again, keep in mind the response will contain at most 8000 points. So, you will want to pick your date range based on how frequently your channel is updated. See more details here.
  3 件のコメント
Vinod
Vinod 2020 年 12 月 3 日
Actually, the REST API doc I linked to does take you to this page - reading the last entry in a channel. If you look at the JSON example there, you will see "entry_id" is a returned paramter. While I do mention it here as a direct response to your question, I strongly suggest not relying on the last entry_id. I was trying to point you to a better solution based on your decription.
Christopher Stapels
Christopher Stapels 2020 年 12 月 11 日
You could also update the channel and look at the response. ThingSpeak returns the number of records in the channel However, after you update the channel to see if there is anything in it, you would have to clear it again or it would look like there are records in the channel. :)

サインインしてコメントする。

コミュニティ

その他の回答  ThingSpeak コミュニティ

カテゴリ

Help Center および File ExchangeConfigure Accounts and Channels についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by