Journal Space ID Predictability

Would be cool to see the Space ID for journals be predictable somehow.

I use the Shortcut @ethan (I think) made to send stuff to an Inbox space, but if the journal space IDs were predictable, I could build that logic into the shortcut and be able to send stuff to the current day’s space with the Shortcut.

I’m thinking it could still start with a random, but consistent, string for every user, but end with a consistent “20211024”.

So sjdfksdfksdfss20211024 and sjdfksdfksdfss20211025, etc.

2 Likes

all ids (spaces, cards, connections etc.) are generated by the nanoid lib (https://www.npmjs.com/package/nanoid) , for technical reasons the whole point of it is unpredictable/unique.

how much of your daily journal uses premade cards/prompts? If you’re not using those, you can create a seperate script to POST create a new space that’s marked as being a journal by setting moonPhase (see https://help.kinopio.club/api/#spaces for list of possible string values).

Then using the returned space id for adding cards to

2 Likes

what do you think about allowing certain magic names of the body of a /card POST? So setting spaceId to today would create a journal space if it doesn’t exist or add to the existing one if it does.

1 Like
  1. One problem is that only the client can fully create a journal space with all your prompts in the right location and the moonphase because that’s currently the only place that logic lives. But I can at least just do the moonphase, day card in there
  2. The second issue is I’m not sure I’m a fan of magic/non-conventional anything in an API because it’s not something that other people will easily discover. Also I think the whole REST-y ness of the API works best when a route does a single job.

It might be clearer/more maintainable to have distinct routes to

  • GET the journal space for today if it exists,
  • and another route to POST create a journal space for today
2 Likes

Oh yeah, that’s way better. It might make it harder for little shortcut scripts that are simple single calls to the API, but this is much cleaner and easy to understand.

1 Like

Understood.

I’m not sure that would really work for Shortcuts on iOS because I’d still have to manually update the space id in the shortcut myself everyday, but it’s not a big deal.

1 Like

can the shortcuts app fetch from the api and then update a subsequent url string based on the result?

1 Like

It can.

So this is how the Shortcut works today, a POST with an auth and spaceid:

I can add a GET with my auth and then use whatever I receive as a variable to replace the spaceid in the POST above, but I’m not sure how to get the spaceid for the current days space…

2 Likes

When I get to this, I’ll add a route to GET the journal space for today if it exists

3 Likes