Ben Tsai

Kinopio JSON text tricks

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"$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 | 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:"
2020-08-11T14:56:21.976Z "[] marketing outreach"


Friday, September 18, 2020