Get text list of cards in chronological order

I realize this is super-niche information, but I’ve been lightly playing around with the Kinopio API and the JSON it returns. You’ll need curl, jq, and rg.

Here’s the shell incantation for getting a list of cards in a list sorted in created order:

export KINOPIO_API_KEY=<enter `JSON.parse(localStorage.user).apiKey` in console>
export KINOPIO_SPACE_KEY=<grab from URL>

curl -H "Authorization: $KINOPIO_API_KEY" https://api.kinopio.club/space/$KINOPIO_SPACE_KEY | jq -r  '.cards | .[] | .createdAt + "\t" + (.name | tojson)' | sort

The jq part is the more interesting stuff:

cat space.json | jq -r  '.cards | .[] | .createdAt + "\t" + (.name | tojson)'

It grabs all the cards, then prints out the created time, a tab, and the escaped card name.

This is just text now, so you can do Unix-style filtering and manipulations. For example, list all the incomplete tasks by piping through rg:

cat space.json | jq -r  '.cards | .[] | .createdAt + "\t" + (.name | tojson)' | rg "\"\[\]"

I’ve formatted it to kinda look like a twtxt feed. So for example, here are the incomplete tasks on the Kinopio roadmap. Since it’s public, I don’t need the API key:

% curl -s https://api.kinopio.club/space/6TRE21gchHI7alHLuwzd5 | jq -r  '.cards | .[] | .createdAt + "\t" + (.name | tojson)' | sort | rg "\"\[\]"
2019-12-31T16:19:09.398Z	"[] for power users - may need to prioritize features that get new people in before these"
2019-12-31T16:19:09.412Z	"[] Dark mode 🌙"
2020-01-02T02:19:46.881Z	"[] two new frames"
2020-05-25T14:59:23.876Z	"[] Better undo (Cmd z to undo Any operation, not just card delete)"
2020-06-15T15:12:20.886Z	"[] bi-directional tabs/labels that allow bottom up organization \n\nSpec: https://www.are.na/block/7674650"
2020-08-11T14:56:21.976Z	"[] marketing outreach"

:stuck_out_tongue_winking_eye:

(this turned into a blog post)

2 Likes

Super cool! What kinds of stuff are you Then using the ordered list for?

The list is an easier way to see what the latest cards are on a space, which is useful for, “hey what’s changed since the last time I visited?”

Where I’d like to go is to build a site that can take a space and render it in a chronological list view. Imagine something like OG twitter where you have a reverse-chronological list of tweets. Same thing here, but it’s a Kinopio card. Then I could build in other functions for interacting with cards and filtering. A filter could only show unchecked cards, so it would be a way to see tasks in a space. Things like that.

If I were more fluent with web, I would have done the list thing already as a glitch site or something. I’ve got that project started, but it’s just enough friction/learning that it’s not there yet :slight_smile:

2 Likes

makes sense :smiley: