this post was submitted on 25 Aug 2023
21 points (100.0% liked)

Programming

13368 readers
2 users here now

All things programming and coding related. Subcommunity of Technology.


This community's icon was made by Aaron Schneider, under the CC-BY-NC-SA 4.0 license.

founded 1 year ago
MODERATORS
 

A post with id 1 in lemmy.world has a different id in lemmy.ml (or any instance). How do I get the post id in lemmy.ml?

you are viewing a single comment's thread
view the rest of the comments
[โ€“] rikudou@lemmings.world 12 points 1 year ago* (last edited 1 year ago) (1 children)

Every post has an "activity pub id" (ap_id in the api) which is a URL to the post on its home instance. Every Lemmy instance can get a link to a post by its activity pub id.

The flow is:

  • parse the URL and get the numerical ID
  • call an api endpoint with post details (on the instance the link points to), which includes its activity pub id
  • call an api endpoint on your target instance to resolve the activity pub id to a local post (which includes its local ID)
  • construct a new URL in the form of https://[targetInstance]/post/[localID]
[โ€“] _thisdot@infosec.pub 2 points 1 year ago

Thanks! This was very helpful!