From 42993f9404ee29933324895107b285f08c139a38 Mon Sep 17 00:00:00 2001 From: Hubert Van De Walle Date: Sun, 19 Apr 2020 20:12:26 +0200 Subject: [PATCH] Update docs --- api-doc/notes/index.apib | 55 +++++++++++++++++++++++++++++---------- api-doc/users/index.apib | 2 +- docs/index.html | 56 +++++++++++++++++++++++++++------------- 3 files changed, 81 insertions(+), 32 deletions(-) diff --git a/api-doc/notes/index.apib b/api-doc/notes/index.apib index 4e39663..2eac700 100644 --- a/api-doc/notes/index.apib +++ b/api-doc/notes/index.apib @@ -92,19 +92,48 @@ + Attributes (object) + tags: new, tags (array[string]) -+ Request (application/json) - + Headers - Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c - - + Attributes (object) - + chapters (array) - + (Chapter) - + title: Introduction - + content: ... - + (Chapter) - + title: Objects - + content: ... + Response 200 -+ Response 404 \ No newline at end of file ++ Response 404 + +## Chapters [/notes/{noteTitle}/chapters/{chapterNumber}] + ++ Parameters + + noteTitle: `Kotlin` (string) - The title of the Note. + + chapterNumber: `Kotlin` (number) - The chapter number. + +### Post a chapter [POST] + ++ Request (application/json) + + Headers + Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c + + Attributes (Chapter) + + title: Chapter 1 (string) + + content: ... (string) + +### Delete a chapter [DELETE] + ++ Request (application/json) + + Headers + Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c + ++ Response 200 + ++ Response 404 + +### Patch a chapter [PATCH] + ++ Request (application/json) + + Headers + Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c + + + Attributes (object) + + title: new title (string) + ++ Request (application/json) + + Headers + Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c + + + Attributes (object) + + content: ... (string) diff --git a/api-doc/users/index.apib b/api-doc/users/index.apib index 0a2237c..126ce93 100644 --- a/api-doc/users/index.apib +++ b/api-doc/users/index.apib @@ -21,7 +21,7 @@ + Request (application/json) + Attributes (object) + username: babar (string) - + email: michel@seed-it.eu (string) + + email: `michel@seed-it.eu` (string) + password: tortue (string) + Response 200 (application/json) diff --git a/docs/index.html b/docs/index.html index a981db6..a0b1849 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,6 +1,6 @@ -Notes API Back to top

Notes API

Accounts

Create an account

Register a new user
POST/register

Example URI

POST http://localhost:5000/register
Request
HideShow
Headers
Content-Type: application/json
Body
{
+Notes API Back to top

Notes API

Accounts

Create an account

Register a new user
POST/register

Example URI

POST http://localhost:5000/register
Request
HideShow
Headers
Content-Type: application/json
Body
{
   "username": "babar",
-  "email": "michel@seed",
+  "email": "michel@seed-it.eu",
   "password": "tortue"
 }
Schema
{
   "$schema": "http://json-schema.org/draft-04/schema#",
@@ -10,8 +10,7 @@
       "type": "string"
     },
     "email": {
-      "type": "string",
-      "description": "it.eu (string)"
+      "type": "string"
     },
     "password": {
       "type": "string"
@@ -172,26 +171,47 @@
       "type": "array"
     }
   }
-}
Request
HideShow
Headers
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
Body
{
-  "chapters": [
-    {
-      "title": "Introduction",
-      "content": "..."
-    },
-    {
-      "title": "Objects",
-      "content": "..."
-    }
-  ]
+}
Response  200
Response  404

Chapters

Post a chapter
POST/notes/{noteTitle}/chapters/{chapterNumber}

Example URI

POST http://localhost:5000/notes/Kotlin/chapters/Kotlin
URI Parameters
HideShow
noteTitle
string (required) Example: Kotlin

The title of the Note.

+
chapterNumber
number (required) Example: Kotlin

The chapter number.

+
Request
HideShow
Headers
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
Body
{
+  "title": "Chapter 1",
+  "content": "..."
 }
Schema
{
   "$schema": "http://json-schema.org/draft-04/schema#",
   "type": "object",
   "properties": {
-    "chapters": {
-      "type": "array"
+    "title": {
+      "type": "string"
+    },
+    "content": {
+      "type": "string"
     }
   }
-}
Response  200
Response  404

Tags

Tags

Get all tags
GET/tags

Example URI

GET http://localhost:5000/tags
Request
HideShow
Headers
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
+}

Delete a chapter
DELETE/notes/{noteTitle}/chapters/{chapterNumber}

Example URI

DELETE http://localhost:5000/notes/Kotlin/chapters/Kotlin
URI Parameters
HideShow
noteTitle
string (required) Example: Kotlin

The title of the Note.

+
chapterNumber
number (required) Example: Kotlin

The chapter number.

+
Request
HideShow
Headers
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
Response  200
Response  404

Patch a chapter
PATCH/notes/{noteTitle}/chapters/{chapterNumber}

Example URI

PATCH http://localhost:5000/notes/Kotlin/chapters/Kotlin
URI Parameters
HideShow
noteTitle
string (required) Example: Kotlin

The title of the Note.

+
chapterNumber
number (required) Example: Kotlin

The chapter number.

+
Request
HideShow
Headers
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
Body
{
+  "title": "new title"
+}
Schema
{
+  "$schema": "http://json-schema.org/draft-04/schema#",
+  "type": "object",
+  "properties": {
+    "title": {
+      "type": "string"
+    }
+  }
+}
Request
HideShow
Headers
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
Body
{
+  "content": "..."
+}
Schema
{
+  "$schema": "http://json-schema.org/draft-04/schema#",
+  "type": "object",
+  "properties": {
+    "content": {
+      "type": "string"
+    }
+  }
+}

Tags

Tags

Get all tags
GET/tags

Example URI

GET http://localhost:5000/tags
Request
HideShow
Headers
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
   "tags": [
     "Dev",
     "Server"