Retrieve cards with open to-do items

I am thinking about to use supernotes as my to-do list application.
Is it possible to retrieve items with a checkbox which is not checked via API to e.g. send this via ios shortcuts to get an alert?

Hi @isaiur,

You can run the following curl command, that uses the /cards/get/select endpoint:

curl -X 'POST' 
  'https://api.supernotes.app/v1/cards/get/select' 
  -H 'accept: application/json' 
  -H 'Api-Key: YOUR_API_KEY_DO_NOT_SHARE' 
  -H 'Content-Type: application/json' 
  -d '{
  "filter_group": {
    "operator": "and",
    "filters": [
      {
        "type": "content",
        "operator": "contains",
        "arg": "- [ ]"
      }
    ]
  },
  "sort": {
    "type": 0,
    "ascending": true
  },
  "limit": 0,
  "as_list": true
}'

Probably would be best to run this at an interval every few hours or a certain times of the day (when you wake up for example). I hope that helps!

1 Like

Thanks - that helps a lot! I will try to use it and maybe come back with a question when I run into a problem :sweat_smile:.

1 Like

I managed it so far! Thank you so much @tobias !

But I have a tiny question - I tried to add a function with due dates. So I extend the filter:

What I want to achieve is that I want a notification when a task is not done and has the due date of today.

But I can’t connect the due date to the checkbox.

1 Like

Ah I see what you’re trying to do. Unfortunately I don’t think there’s an easy way to do this as filters are scoped on a card basis, so you can’t differentiate between difference lines / blocks within a card.

This has been done intentionally since “cards” as the smallest units of knowledge on Supernotes, rather than “blocks” and “pages” like other apps.

Might be best to try and think of tasks differently within Supernotes instead, and not use tasks but cards themselves. i.e. What I do is leave cards untitled and the body of the card is the task I need to do. Those cards are automatically filtered into my “Thoughts” collection and once I’ve completed that card, I either junk it if it was ephemeral (such as a shopping list) or add a title and add a parent to keep it as part of my knowledge base (such as a film review).

1 Like

I see!
Could I use the targeted date? It is automatically targeted with adding a due date to the card …

So I tried this:

{
  "filter_group": {
    "operator": "and",
    "filters": [
      {
        "type": "content",
        "operator": "contains",
        "arg": "- [ ]"
      }
    ]
  },
  "targeted_or_created_when": {
"from_when": "2023-05-31T00:00:00Z",
"to_when": "2023-05-31T23:59:59Z"
}
}

But it returns an internal server error

1 Like

For date range filtering, the API is looking for offset-naive dates (i.e. dates without timezones). Adding the “Z” on the end indicates you’re specifying a specific timezone (UTC) and breaks it.

So if you just remove the "Z"s it’ll work. We’ll improve the error message to be more helpful in a future version.

1 Like

That works! Thank you so much :slight_smile: