Notes API
Accounts ¶
Create an account ¶
Register a new userPOST/register
Example URI
POST http://localhost:5000/register
Request
Headers
Content-Type: application/jsonBody
{
"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
200Headers
Content-Type: application/jsonBody
{
"message": "Created"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"message": {
"type": "string"
}
}
}Response
409Headers
Content-Type: application/jsonBody
{
"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 userPOST/login
Example URI
POST http://localhost:5000/login
Request
Headers
Content-Type: application/jsonBody
{
"username": "babar",
"password": "tortue"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"username": {
"type": "string"
},
"password": {
"type": "string"
}
}
}Response
200Headers
Content-Type: application/jsonBody
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"token": {
"type": "string"
}
}
}Response
401Headers
Content-Type: application/jsonBody
{
"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 NotePOST/notes
Example URI
POST http://localhost:5000/notes
Request
Headers
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5cBody
{
"title": "Kotlin",
"tags": [
"Dev",
"Server"
]
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"title": {
"type": "string"
},
"tags": {
"type": "array"
}
}
}Response
200Get NotesGET/notes
Example URI
GET http://localhost:5000/notes
Request
Headers
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5cResponse
200Headers
Content-Type: application/jsonBody
[
{
"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 NoteGET/notes/{noteTitle}
Example URI
GET http://localhost:5000/notes/Kotlin
URI Parameters
- noteTitle
string(required) Example: KotlinThe title of the Note.
Request
Headers
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5cResponse
200Headers
Content-Type: application/jsonBody
{
"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
404Delete NoteDELETE/notes/{noteTitle}
Example URI
DELETE http://localhost:5000/notes/Kotlin
URI Parameters
- noteTitle
string(required) Example: KotlinThe title of the Note.
Request
Headers
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5cResponse
204Response
404Update a NotePATCH/notes/{noteTitle}
Example URI
PATCH http://localhost:5000/notes/Kotlin
URI Parameters
- noteTitle
string(required) Example: KotlinThe title of the Note.
Request
Headers
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5cBody
{
"title": "NewTitle"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"title": {
"type": "string"
}
}
}Request
Headers
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5cBody
{
"tags": [
"new",
"tags"
]
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"tags": {
"type": "array"
}
}
}Request
Headers
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5cBody
{
"chapters": [
{
"title": "Introduction",
"content": "..."
},
{
"title": "Objects",
"content": "..."
}
]
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"chapters": {
"type": "array"
}
}
}Response
200Response
404