From 5f019e3bf593c1f132fd0e42d1f96dc1e60b1d32 Mon Sep 17 00:00:00 2001 From: Alexander Goussas Date: Sun, 31 May 2026 15:42:32 -0500 Subject: [PATCH] feat: add API documentation section --- collections/larousse API/Define a word.yml | 2 +- collections/larousse API/Translate a word.yml | 2 +- src/main/resources/templates/pub/api.html | 92 +++++++++++++++++++ 3 files changed, 94 insertions(+), 2 deletions(-) create mode 100644 src/main/resources/templates/pub/api.html diff --git a/collections/larousse API/Define a word.yml b/collections/larousse API/Define a word.yml index bf0eea8..96fcef1 100644 --- a/collections/larousse API/Define a word.yml +++ b/collections/larousse API/Define a word.yml @@ -8,7 +8,7 @@ http: url: "{{api.base_url}}/words/:word/definition" params: - name: word - value: chien + value: voiture type: path auth: inherit diff --git a/collections/larousse API/Translate a word.yml b/collections/larousse API/Translate a word.yml index dc7cbf1..9f08930 100644 --- a/collections/larousse API/Translate a word.yml +++ b/collections/larousse API/Translate a word.yml @@ -8,7 +8,7 @@ http: url: "{{api.base_url}}/words/:word/translation" params: - name: word - value: grenouille + value: voiture type: path auth: inherit diff --git a/src/main/resources/templates/pub/api.html b/src/main/resources/templates/pub/api.html new file mode 100644 index 0000000..01b99a5 --- /dev/null +++ b/src/main/resources/templates/pub/api.html @@ -0,0 +1,92 @@ +{@net.frustratedfunctor.ui.WordTranslationsDefinitions translationsDefinitions} + + + + +Frustrated Langs | Contributing + + + + + + + + + + +
+ +
+ +
+

API Docs

+

+ I write this documentation by hand, since the API is rather petit. Nonetheless, that means it could drift from + the actual implementation. So if anything is not working according to this documentation, please report it at + goussasalexander@gmail.com with the subject + [larousseapi] DOCS: description. +

+

/GET word translations

+

Example cURL

+
+curl --request GET \
+    --url $API_BASE/words/:word/translation
+

Example response

+
+{
+  "word": "voiture",
+  "translations": [
+    "car,",
+    "coach,",
+    "carriage,"
+  ]
+}
+

/GET word definitions

+

Example cURL

+
+curl --request GET \
+    --url $API_BASE/words/:word/definition
+

Example response

+
+{
+  "word": "voiture",
+  "definitions": [
+    "Véhicule susceptible de conduire, porter ou transporter des personnes ou des marchandises :",
+    "Automobile :",
+    "Véhicule ferroviaire destiné au transport des voyageurs (par opposition au , utilisé pour le transport des marchandises).",
+    "Chargement d'un véhicule, d'un camion, etc. :"
+  ]
+}
+
+ + + + + \ No newline at end of file -- 2.43.0