this post was submitted on 28 Nov 2021
14 points (100.0% liked)

Lemmy

12524 readers
1 users here now

Everything about Lemmy; bugs, gripes, praises, and advocacy.

For discussion about the lemmy.ml instance, go to !meta@lemmy.ml.

founded 5 years ago
MODERATORS
 

The API docs on join-lemmy.org are actually JavaScript SDK docs, not API docs. I want to build an API client in a different language, not write a JavaScript thing using the SDK, and would prefer not to plumb the JS SDK code to understand the API.

Is there somewhere that has a language-agnostic description of Lemmy's APIs?

top 3 comments
sorted by: hot top controversial new old
[โ€“] freamon@feddit.nl 8 points 2 years ago (1 children)

This post is very old, but it's what came up when I googled it, so for anyone else, here's some basic scripts for logging in and then using the authentication to get something that may help you get started in exploring the API.

[โ€“] LolaCat@sh.itjust.works 4 points 2 years ago

This is just what I was looking for! Thank you ๐Ÿ‹

[โ€“] dessalines@lemmy.ml -1 points 3 years ago

The HTTP docs are what you want: https://join-lemmy.org/api/classes/LemmyHttp.html#getPost

It tells you the full input and output types, and if you click the defined in link, it shows you the endpoint you can use for curl.

Example from above:

return this.wrapper(HttpType.Get, '/post', form);

We do it this way because the lemmy-js-client exactly matches what you need to build a client, and is completely auto-generated. Before we used to manually maintain other API docs, and it was a huge hassle to keep them updated.