From 76b397aac77c038e4f53ecb629c4d08acebdbb7c Mon Sep 17 00:00:00 2001 From: Dessalines Date: Mon, 13 Jun 2022 14:55:51 -0400 Subject: [PATCH] Removing version from API calls. (#139) * Removing version from API calls. * Adding a link to the current API version. --- src/en/administration/from_scratch.md | 2 +- src/en/client_development/http_api_extras.md | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/en/administration/from_scratch.md b/src/en/administration/from_scratch.md index 31f87bc..55d2b9d 100644 --- a/src/en/administration/from_scratch.md +++ b/src/en/administration/from_scratch.md @@ -62,7 +62,7 @@ NoNewPrivileges=true WantedBy=multi-user.target ``` -If you did everything right, the Lemmy logs from `journalctl -u lemmy` should show "Starting http server at 127.0.0.1:8536". You can also run `curl localhost:8536/api/v3/site` which should give a successful response, looking like `{"site_view":null,"admins":[],"banned":[],"online":0,"version":"unknown version","my_user":null,"federated_instances":null}`. +If you did everything right, the Lemmy logs from `journalctl -u lemmy` should show "Starting http server at 127.0.0.1:8536". You can also run `curl localhost:8536/api/{version}/site` which should give a successful response, looking like `{"site_view":null,"admins":[],"banned":[],"online":0,"version":"unknown version","my_user":null,"federated_instances":null}`. ### Install lemmy-ui (web frontend) diff --git a/src/en/client_development/http_api_extras.md b/src/en/client_development/http_api_extras.md index 5bac1ce..0112868 100644 --- a/src/en/client_development/http_api_extras.md +++ b/src/en/client_development/http_api_extras.md @@ -18,8 +18,10 @@ This contains extras not in the [API docs](/api). **GET example** +The current api `{version}` is [here](https://github.com/LemmyNet/lemmy-js-client/blob/main/src/interfaces/others.ts#L1). + ``` -curl "http://localhost:8536/api/v2/community/list?sort=Hot"` +curl "http://localhost:8536/api/{version}/community/list?sort=Hot"` ``` **POST example** @@ -33,7 +35,7 @@ curl -i -H \ "score": 1, "auth": eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6MiwiaXNzIjoidGVzdC5sZW1teS5tbCJ9.P77RX_kpz1a_geY5eCp29sl_5mAm-k27Cwnk8JcIZJk }' \ -http://localhost:8536/api/v2/comment/like +http://localhost:8536/api/{version}/comment/like ``` ## HTTP API exclusive features