# Accessign data sent from notecard through notehub API?

**URL:** <https://discuss.blues.com/t/accessign-data-sent-from-notecard-through-notehub-api/527>\
**Category:** Notehub.io\
**Created:** [December 5, 2021, 11:10am UTC](https://discuss.blues.com/t/accessign-data-sent-from-notecard-through-notehub-api/527 "2021-12-05T11:10:38Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![gauteh](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/gauteh/32/269_2.png) [@gauteh](https://discuss.blues.com/u/gauteh)\
**Post date:** [December 5, 2021, 11:10am UTC](https://discuss.blues.com/t/accessign-data-sent-from-notecard-through-notehub-api/527/1 "2021-12-05T11:10:38Z")

</div>

Hi,

how am I supposed to get data from the notecard through the notehub and access it using e.g. curl? If I add a note to e.g. `sensor.qo` from the notecard it shows up in the events on the notehub web UI, and I can see it when I use the events API. But I cannot seem to get it if I try to use curl like this:

```auto
curl -L "https://api.notefile.net/req?product=no.met.gauteh&device=dev:XXXX&project=${PUID}" \
  -d '{"req":"note.get","file":"sensor.qo"}' \
  -H "X-SESSION-TOKEN: ${TOKEN}"

```

this gives the error:

```auto
{"err":"no notes available in queue {note-noexist}"}

```

if I add a note through curl like this:

```auto
 curl -L "https://api.notefile.net/req?product=no.met.gauteh&device=dev:XXX&project=${PUID}" \
   -d '{"req":"note.add","file":"blah.qi", "body": {"temp": 72.22 }}' \
   -H "X-SESSION-TOKEN: ${TOKEN}"

```

- dev is a `dev:UID` string
- PUID is a `app:aaaa-bbbb-uuid-string`

I can get it back using `note.changes`, but not using `note.get`.

I can get the data by using the events API, is this the way to do it? Except using routed web methods.

Does `qo` files work like queues? I can add notes to it repeatedly and access it with `note.get` + delete to get all the items, not just the latest?

Edit: It seems that I can use `.db` files for this. I guess it makes sense to clean them out after a time, but how much can be stored on the notecard? I am thinking about using a `.dbx` to store data that I might not be able to afford to transmit (in terms of power, etc), but could retrieve manually from the notecard when I get physical access to it again.

Regards, Gaute

---

<div class="post-metadata">

**Author:** ![RobLauer](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/roblauer/32/1567_2.png) [@RobLauer](https://discuss.blues.com/u/RobLauer)\
**Post date:** [December 5, 2021, 8:32pm UTC](https://discuss.blues.com/t/accessign-data-sent-from-notecard-through-notehub-api/527/2 "2021-12-05T20:32:48Z")

</div>

Hi @gauteh,

I believe you are on the right path. Using the [Notehub Event API](https://dev.blues.io/reference/notehub-api/event-api/) you can query Notehub for previously synced events and use a variety of parameters to filter out the resulting Notes you want to view.

This scenario applies only if your Notecard has successfully synced with Notehub. If the `sensor.qo` Notefile hasn’t been synced yet, I recommend looking at the [Notecard File API](https://dev.blues.io/reference/notecard-api/file-requests/) to inspect individual Notefiles.

Let me know if you have any other questions!

Rob

---

<div class="post-metadata">

**Author:** ![gauteh](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/gauteh/32/269_2.png) [@gauteh](https://discuss.blues.com/u/gauteh)\
**Post date:** [December 5, 2021, 8:39pm UTC](https://discuss.blues.com/t/accessign-data-sent-from-notecard-through-notehub-api/527/3 "2021-12-05T20:39:57Z")

</div>

If I add a note to `sensor.qo` on the notecard (e.g. using the host MCU), trigger a `hub.sync` I can see the event in the event log. But I cannot find a way to get that note using `note.get` and curl. Is that supposed to work? For `sensor.db` it works.

The web + routing API requires continuous wireless mode, so I think I will have to work with the Note API.

---

<div class="post-metadata">

**Author:** ![RobLauer](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/roblauer/32/1567_2.png) [@RobLauer](https://discuss.blues.com/u/RobLauer)\
**Post date:** [December 5, 2021, 8:45pm UTC](https://discuss.blues.com/t/accessign-data-sent-from-notecard-through-notehub-api/527/4 "2021-12-05T20:45:14Z")

</div>

Hi @gauteh,

If you’re trying to route data from Notecard → Notehub → your cloud app, I recommend looking at the [route tutorials](https://dev.blues.io/start/tutorials/route-tutorial/) we provide which make it considerably easier to transmit your data to your endpoint.

If, however, you want to view/download/whatever events from Notehub, I’d recommend using the Notehub Event API (linked above).

As you discovered, a `note.get` request against Notehub is only useful when using `.db` files.

Rob

---

<div class="post-metadata">

**Author:** ![gauteh](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/gauteh/32/269_2.png) [@gauteh](https://discuss.blues.com/u/gauteh)\
**Post date:** [December 5, 2021, 9:06pm UTC](https://discuss.blues.com/t/accessign-data-sent-from-notecard-through-notehub-api/527/5 "2021-12-05T21:06:10Z")

</div>

Thanks. So `.db` with templates is presumably the most efficient in terms of bandwidth way to transmit sensor data produced at the notecard (rather than Events + `.qo`)? Routing requires a continuous connection, which is probably too power-hungry. This is for a battery-powered application.

What is the local data-capacity of the notecard for `.dbx` and queued notes?

---

<div class="post-metadata">

**Author:** ![RobLauer](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/roblauer/32/1567_2.png) [@RobLauer](https://discuss.blues.com/u/RobLauer)\
**Post date:** [December 5, 2021, 9:14pm UTC](https://discuss.blues.com/t/accessign-data-sent-from-notecard-through-notehub-api/527/6 "2021-12-05T21:14:13Z")

</div>

Routing via Notehub actually doesn’t require a continuous connection. You may be confusing Notehub routing vs the [Notecard Web APIs](https://dev.blues.io/reference/notecard-api/web-requests/) which DO require a continuous connection.

The most efficient way to route data is by using Notehub routes, since the routing of data itself is performed on Notehub, not on your device!

To answer your other question, the Notecard provides about 900KB of non-volatile storage for Notefiles.

---

<div class="post-metadata">

**Author:** ![gauteh](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/gauteh/32/269_2.png) [@gauteh](https://discuss.blues.com/u/gauteh)\
**Post date:** [December 5, 2021, 9:20pm UTC](https://discuss.blues.com/t/accessign-data-sent-from-notecard-through-notehub-api/527/7 "2021-12-05T21:20:12Z")

</div>

Ah, I see! So I can set up a route and filter it on e.g. `sensor.qo` and it will then post the notes to the endpoint whenever the notecard syncs with the hub?

Thanks a lot!

---

<div class="post-metadata">

**Author:** ![RobLauer](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/roblauer/32/1567_2.png) [@RobLauer](https://discuss.blues.com/u/RobLauer)\
**Post date:** [December 5, 2021, 10:05pm UTC](https://discuss.blues.com/t/accessign-data-sent-from-notecard-through-notehub-api/527/8 "2021-12-05T22:05:18Z")

</div>

Exactly! Couldn’t have explained it better myself.
