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
Progress spinner
sod
sod

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

|
Embed
Progress spinner
matti
matti

@sod Awesome! Thanks! cc: @manton

|
Embed
Progress spinner
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
Progress spinner
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
Progress spinner
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
Progress spinner
sod
sod

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

|
Embed
Progress spinner
pratik
pratik

@sod go on…

|
Embed
Progress spinner
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
Progress spinner
matti
matti

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

|
Embed
Progress spinner
maique
maique

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

|
Embed
Progress spinner
toddgrotenhuis
toddgrotenhuis

@sod love it!

|
Embed
Progress spinner
pratik
pratik

@sod That’s awesome!

|
Embed
Progress spinner
pratik
pratik

@maique OMG! Yes.

|
Embed
Progress spinner
manton
manton

@sod Ooo. I like this. 🙂

|
Embed
Progress spinner
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
Progress spinner
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
Progress spinner