JSON feed for all photos?

Hi there! I’m trying to pull a JSON feed of all my site’s photos, just like https://www.manton.org/photos/index.json. I thought that was a built-in endpoint but the closest I can get is something like https://blog.zmh.org/photos/index.json which shows all my photo posts, but doesn’t return all photos. How can I achieve a feed similar to manton’s? Thanks in advance!

Hi! Your feed already is similar to Manton’s, they are both JSON feeds of photo posts located at the path /photos/index.json. Those feeds won’t contain images that aren’t considered photos by Micro.blog, for example, .png images.

There’s an alternative feed available at https://micro.blog/posts/zmh/photos (in your case) that contains non-photo images like screenshots as well.

Ah understood, thanks! So is there a way to add a feed (JSON or XML) that returns all photos from all posts, not just the first photo? Or would the better way be to parse the content_html field in that photo post feed and get all photos in each photo post?

Yeah, maybe the JSON feeds should expose all images via a images property. What do you think, @manton?

But until that potentially gets implemented (or not), you could parse content_html as a workaround. Or maybe use the Micropub endpoint https://micro.blog/micropub/media?q=source for a list of all your uploads (photos, videos, and so on).

Awesome appreciate it! And yeah would love to put my vote in for a JSON feed of all photos - found this thread that discussed similar use case as well: JSON Feed for Photos · Issue #112 · microdotblog/issues · GitHub

I think it should be made more explicit as photo posting is a big part of the MB use case.

We have so many feeds that sometimes it’s not clear where to put things. :slightly_smiling_face: We could add a new feed to /feeds/ or something like yoursite.com/photos/all.json, but maybe the best solution is to update the plug-in “All photos” so that it applies to both the photos page and the JSON Feed.

That seems like a good change for consistency. So if you install the plug-in, your /photos/ page includes all photos, and the JSON Feed matches that. Does that solve your original request @zmh?

Oh interesting - so my photos page was showing all photos but I didn’t know about that plugin, and it turns out I’m using the Photos page plugin by @kottkrig that seems to do the same thing (i.e. shows all photos from multi-photo posts).

I’m happy to switch over to the all photos plugin and/or use both! Not knowing anything about other users’ requests, I would think an endpoint that returns all photos would be useful in the future for people just to avoid undocumented behavior where a plugin affects a feed, but either way works and understood wanting to keep the feeds list short. Thanks in advance for looking into this!

One clarification: unfortunately you can’t use both plug-ins at the same time. They both override the default photos page so they will conflict with each other (only one of them will actually be active).

Yep that works! As long as one of them affects the feed :smile: