matti
matti

@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?

|
Embed
sod
sod

@matti You can get it via Conversation.js (example).

|
Embed
matti
matti

@sod Awesome! Thanks! cc: @manton

|
Embed
matti
matti

@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": [

] }

|
Embed
sod
sod

@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

|
Embed
manton
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).

|
Embed
sod
sod

Wow, that's excellent news. Thanks, @manton! 🥰 This makes a couple of plug-in ideas I have more feasible.

|
Embed
pratik
pratik

@sod go on…

|
Embed
sod
sod

@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:

Screenshot of a blog post in inline editing mode. The author has selected a part of the text and made it bold.

This has always been possible, but thanks to the API endpoint @manton shared, it gets much more straightforward to implement.

|
Embed
matti
matti

@manton Thanks! I will try it out a little later.

|
Embed
maique
maique

@sod Editing a post when visiting would prevent SO many trips to the Posts page on M.b!

|
Embed
toddgrotenhuis
toddgrotenhuis

@sod love it!

|
Embed
pratik
pratik

@sod That’s awesome!

|
Embed
pratik
pratik

@maique OMG! Yes.

|
Embed
manton
manton

@sod Ooo. I like this. 🙂

|
Embed
sod
sod

@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. 😢

|
Embed
manton
manton

@sod My approach has basically been to enable CORS as-needed for specific endpoints, just to make sure I don't open up any risks. You need GET to /micropub? Let's follow up in email.

|
Embed