tumblr / docs

Tumblr's public platform documentation.
Apache License 2.0
109 stars 27 forks source link

Document blog UUID format #138

Open marcustyphoon opened 1 month ago

marcustyphoon commented 1 month ago

I doubt this would be at all necessary for third party uses of the API, but for web extensions, it would be nice to have a confirmation of the blog UUID format. It appears to be t: and then 22 base64url-valid characters (t:[a-zA-Z0-9-_]{22})?

This does, I suppose, also sort of apply to the blog name format (presumably [a-z0-9-]{1,32} with no leading/trailing hyphens, per https://help.tumblr.com/changing-your-username-url/ — although my understanding is that some people have had nonconforming blog names with leading/trailing hyphens?) and to post ids (used to be some lower integer, now snowflake?)

cyle commented 1 month ago

It appears to be t: and then 22 base64url-valid characters (t:[a-zA-Z0-9-_]{22})?

yep, that's correct. we can make that more explicit in the docs!

blog name format ... [a-z0-9-]{1,32}

there are a lot of other factors that go into validating if a blog name is valid or not, but roughly, this is the start, yes. we also don't allow "tumblr" in the name, for example.

although my understanding is that some people have had nonconforming blog names with leading/trailing hyphens?)

yep, because the requirements and validation code itself has changed over time, and we haven't updated any that were previously against the current validation scheme.

and to post ids (used to be some lower integer, now snowflake?)

yeah, for post IDs, it's always been true to say that they're unsigned 64bit integers. it just so happens we hadn't breached the 32bit limit by using our previously more-or-less incrementally-updating ID number, and we changed to a proper snowflake ID in March 2020.

marcustyphoon commented 1 month ago

Thanks! Yeah, I couldn't remember if the pre-snowflake ids were sequential or not, i.e. if they could be arbitrarily small. (And I guess in a sense I wasn't sure if the snowflake ones could be arbitrarily big, as Twitter's are limited to the signed integer range per Wikipedia, but the docs are clear on this, and anyway if I'm doing the math correctly that won't matter for the next 279 years or so. We can only hope Tumblr still exists at that time.)