@manton Is it possible to get the post id of a post if I know the permalink? Or do I need to page through all posts to find it?
@manton Is it possible to get the post id of a post if I know the permalink? Or do I need to page through all posts to find it?
@matti You can get it via Conversation.js (example).
@sod Ah damn. That can't be right: Mars edit claims the post id of this post blog.martin-haehnel.de/2022/11/0... is 1709950. And the answer of conversation.js doesn't have this id:
{ "version": "jsonfeed.org/version/1", "title": "Conversation", "homepageurl": "micro.blog/matti/138...", "feed_url": "https://micro.blog/conversation.js?url=https%3A%2F%2Fblog.martin-haehnel.de%2F2022%2F11%2F09%2Fdailydogo.html&format=jsonfeed", "items": [
] }
@matti Ah, sorry, I misread the question. That's the identifier for the post's entry on the Micro.blog timeline. It's currently not possible to get the post identifier from a URL. So you will have to do it the hard way, iterating through the posts looking for a matching permalink. For example, it should be achievable via the XML-RPC API. @manton
@matti Thanks @sod. Yep, the problem is that the post has a different ID on your blog (via MarsEdit) and on the timeline. However! It looks like the Micropub interface (with q=source&url=) does have the ID. Example URL format here (unlike Conv.js, will need API auth).
Wow, that's excellent news. Thanks, @manton! 🥰 This makes a couple of plug-in ideas I have more feasible.
@pratik The discovery enables plug-ins that could be helpful for blog authors when visiting their own blogs. Like Edit this Post-buttons or even inline editing of blog posts:
This has always been possible, but thanks to the API endpoint @manton shared, it gets much more straightforward to implement.
@manton What are your thoughts on enabling cross-origin requests for API endpoints? I'm prototyping a plug-in that makes use of this endpoint, but as the fetching is happening on the client side I hit a wall. 😢