API questions about photo collections

Just learned of the new Photo Collections feature and looked over the help page about it. I had some questions about the API:

  • Is there an API for the list of photos in a collection?
  • Is there a way to re-order a collection, whether a UI or an API, or both?
  • If a photo is added twice, does it show up as a duplicate?
  • Does the photo need to be hosted on the same domain as the collection?

I could test some of these but thought best to ask to understand intended uses.

Thanks!

This post details the API as it exists.

Yes, I read that document and that’s what raised these questions.

Hi @samgrover! Looks I missed a couple things in the documentation. Yes, to get all the photos in a collection, pass a new microblog-collection to the /micropub/media?q=source endpoint. The collection is the URL returned from the list of collections:

GET /micropub/media?q=source&mp-destination=...&microblog-collection=https://example.org/collections/1

You can’t add a photo twice to a collection. The photo URL has to exactly match the primary photo URL returned from /micropub/media?q=source. It can’t be a CDN or an external URL. It has to be the photo URL as Micro.blog knows about it.

Let me know if you have any other questions!

@manton Thanks!