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",
  "password": "tortue"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "username": {
      "type": "string"
    },
    "email": {
      "type": "string",
      "description": "it.eu (string)"
    },
    "password": {
      "type": "string"
    }
  }
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "message": "Created"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "message": {
      "type": "string"
    }
  }
}
Response  409
HideShow
Headers
Content-Type: application/json
Body
{
  "message": "User already exists"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "message": {
      "type": "string"
    }
  }
}

Authenticate user

Authenticate one user to access protected routes.

Authenticate a user
POST/login

Example URI

POST http://localhost:5000/login
Request
HideShow
Headers
Content-Type: application/json
Body
{
  "username": "babar",
  "password": "tortue"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "username": {
      "type": "string"
    },
    "password": {
      "type": "string"
    }
  }
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "token": {
      "type": "string"
    }
  }
}
Response  401
HideShow
Headers
Content-Type: application/json
Body
{
  "description": "Invalid credentials",
  "error": "Bad Request",
  "status_code": 401
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "description": {
      "type": "string"
    },
    "error": {
      "type": "string"
    },
    "status_code": {
      "type": "number"
    }
  }
}

Notes

Notes

Create a Note
POST/notes

Example URI

POST http://localhost:5000/notes
Request
HideShow
Headers
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
Body
{
  "title": "Kotlin",
  "tags": [
    "Dev",
    "Server"
  ]
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "title": {
      "type": "string"
    },
    "tags": {
      "type": "array"
    }
  }
}
Response  200

Get Notes
GET/notes

Example URI

GET http://localhost:5000/notes
Request
HideShow
Headers
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
Response  200
HideShow
Headers
Content-Type: application/json
Body
[
  {
    "title": "Kotlin",
    "tags": [
      "Dev",
      "Server"
    ],
    "updatedAt": "2020-01-20T00:00:00"
  },
  {
    "title": "Java",
    "tags": [
      "Dev"
    ],
    "updatedAt": "2018-01-20T00:00:00"
  }
]
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "array"
}

Note

Get Note
GET/notes/{noteTitle}

Example URI

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

The title of the Note.

Request
HideShow
Headers
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "title": "Kotlin",
  "tags": [
    "Dev",
    "Server"
  ],
  "chapters": [
    {
      "title": "Introduction",
      "content": "..."
    },
    {
      "title": "Objects",
      "content": "..."
    }
  ]
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "title": {
      "type": "string"
    },
    "tags": {
      "type": "array"
    },
    "chapters": {
      "type": "array"
    }
  }
}
Response  404

Delete Note
DELETE/notes/{noteTitle}

Example URI

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

The title of the Note.

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

Update a Note
PATCH/notes/{noteTitle}

Example URI

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

The title of the Note.

Request
HideShow
Headers
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
Body
{
  "title": "NewTitle"
}
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
{
  "tags": [
    "new",
    "tags"
  ]
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "tags": {
      "type": "array"
    }
  }
}
Request
HideShow
Headers
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
Body
{
  "chapters": [
    {
      "title": "Introduction",
      "content": "..."
    },
    {
      "title": "Objects",
      "content": "..."
    }
  ]
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "chapters": {
      "type": "array"
    }
  }
}
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
{
  "tags": [
    "Dev",
    "Server"
  ]
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "tags": {
      "type": "array"
    }
  }
}

Generated by aglio on 19 Apr 2020