Steps to get your timeline on Mastodon as JSON feed
Senior “netizen” get all teary when they hear RSS.
RSS is the thing that Google killed back then, and that always comes up when big social media pooped its pants again and tech people talk about the good old internet times. I'm not going to describe RSS is in detail because you already know, else you wouldn't read this.
Mastodon is the shiny, “newish” thing right now, so I thought it would be a good time to try it out. And I, too, get tears in my eyes when I hear RSS.
TL;DR - Your Timeline as JSON
In order to get your timeline as RSS feed, just add .rss
to your account URL: https://indieweb.social/@marcusobst.rss
One would think this also works with JSON: https://indieweb.social/@marcusobst.json
and it does return JSON, but only account information.
JSON-based representations will be available as part of #1557, but we have no interest in "json feeds". I am not aware of any software which would make use of them. Our feeds serve protocol-related purposes and rely on Atom extensions. -- Eugen Rochko
Solution
Use their API to access public feeds
- Once you know an account’s id, you can use GET /api/v1/accounts/:id to view the Account entity.
- To view public statuses posted by that account, you can use GET /api/v1/accounts/:id/statuses and parse the resulting array of Status entities.
- https://docs.joinmastodon.org/client/public/#posts>
- Obtain the account ID:
GET https://mastodon.social/api/v1/accounts/lookup?acct=@marcusobst@indieweb.social
1 or use the online service Mastodon User ID Lookup - Call the
/statuses
Endpoint: `GET 'https://indieweb.social/api/v1/accounts/109305202842254468/statuses'
I used this to include my Mastodon feed here on my website https://marcus-obst.de/mastodon. I've chosen the JSON feed because I was too lazy to deal with an additional feed reader library or fiddle around with xml myself.
That's all.