REST API Documentation - Shanfang/SmartNote GitHub Wiki

Table of Contents

  1. Get Notes
  2. Generate URL Notes
  3. Add Markdown Notes
  4. Delete Notes
  5. Modify Notes
  6. View Notes
  7. Add tag
  8. Check Archived Notes (Classification)
  9. Search Notes

Get Notes

Target URL

serverURL:serverPort/api/allNotes

Request

Method: GET

Fields

Global Element Description Type
user_name User who owns the note String
title Title of the note String
content Content of the note String
tag Tag of the note Array
date Date when note is saved Date
sourceLink URL where the note is generated from String
id ID of the note ObjectId

Response

Status Code: 500, 401, 200
If an error occurs in the database process, return error code 500.
If an unauthorized user is detected, return code 401.
If getting info successfully, return code 200.

Response Example

Code: 500 Bad Request
Content:
{
    "message": "Note tag is empty."
}
Code: 401 User Not Found
Content:
{
    "message": "Unauthorized user."
}
Code: 200 OK
Content:
{
"title": ""How To Start a Blog in 2017",
"content":"This is content!!!",
"date":"2017-11-07T00:43:21.919Z",
"sourceLink":"https://www.bloggingbasics101.com/how-do-i-start-a-blog/",
"user_name":"software",
"tag": [
			{
			"user_name":"software",
			"name":"angular"
			}
		 ],
"id": "ObjectId"
}

Generate URL Notes

Target URL

serverURL:serverPort/api/generateNote

Request

Method: POST

Fields

Global Element Description Type
user_name User who owns the note String
title Title of the note String
content Content of the note String
tag Tag of the note Array
date Date when note is saved Date
sourceLink URL where the note is generated from String
id ID of the note ObjectId

Response

Status Code: 500, 401, 200
If an error occurs in the database process, return error code 500.
If an unauthorized user is detected, return code 401.
If getting info successfully, return code 200.

Response Example

Code: 500 Bad Request
Content:
{
    "message": "Note tag is empty."
}
Code: 401 User Not Found
Content:
{
    "message": "Unauthorized user."
}
Code: 200 OK
Content:
{
"title": ""How To Start a Blog in 2017",
"content":"This is content!!!",
"date":"2017-11-07T00:43:21.919Z",
"sourceLink":"https://www.bloggingbasics101.com/how-do-i-start-a-blog/",
"user_name":"software",
"tag": [
			{
			"user_name":"software",
			"name":"angular"
			}
		 ],
"id": "ObjectId"
}

Add Markdown Notes

Target URL

serverURL:serverPort/api/addNote

Request

Method: POST

Fields

Global Element Description Type
user_name User who owns the note String
title Title of the note String
content Content of the note String
tag Tag of the note Array
date Date when note saved Date
id ID of the note ObjectId

Response

Status Code: 500, 401, 200
If an error occurs in the database process, return error code 500.
If an unauthorized user is detected, return code 401.
If getting info successfully, return code 200.

Response Example

Code: 500 Bad Request
Content:
{
    "message": "Note tag is empty."
}
Code: 401 User Not Found
Content:
{
    "message": "Unauthorized user."
}
Code: 200 OK
Content:
{
"title": ""How To Start a Blog in 2017",
"content":"This is content!!!",
"date":"2017-11-07T00:43:21.919Z",
"sourceLink":"https://www.bloggingbasics101.com/how-do-i-start-a-blog/",
"user_name":"software",
"tag": [
			{
			"user_name":"software",
			"name":"angular"
			}
		 ],
"id": "ObjectId"
}

Delete Notes

Target URL

serverURL:serverPort/api/deleteNote

Request

Method: POST

Fields
Global Element Description Type
user_name User who owns the note String
id ID of the note ObjectId

Response

Status Code: 500, 401, 200
If an error occurs in the database process, return error code 500.
If an unauthorized user is detected, return code 401.
If getting info successfully, return code 200.

Response Example

Code: 500 Bad Request
Content:
{
    "message": "Note ID is empty."
}
Code: 401 User Not Found
Content:
{
    "message": "Unauthorized user."
}
Code: 200 OK
Content:
{
	"username": "software",
	"id": "ObjectId("5a010228a61a9116f300fa08")"
}

Modify Notes

Target URL

serverURL:serverPort/api/modify

Request

Method: POST

Fields

Global Element Description Type
user_name User who owns the note String
title Title of the note String
content Content of the note String
tag Tag of the note Array
date Date when note is saved Date
sourceLink URL where the note is generated from String
id ID of the note ObjectId

Response

Status Code: 500, 401, 200
If an error occurs in the database process, return error code 500.
If an unauthorized user is detected, return code 401.
If getting info successfully, return code 200.

Response Example

Code: 500 Bad Request
Content:
{
    "message": "Note tag is empty."
}
Code: 401 User Not Found
Content:
{
    "message": "Unauthorized user."
}
Code: 200 OK
Content:
{
"title": ""How To Start a Blog in 2017",
"content":"This is content!!!",
"date":"2017-11-07T00:43:21.919Z",
"sourceLink":"https://www.bloggingbasics101.com/how-do-i-start-a-blog/",
"user_name":"software",
"tag": [
			{
			"user_name":"software",
			"name":"angular"
			}
		 ],
"id": "ObjectId"
}

View Notes

Target URL

serverURL:serverPort/api/viewnote

Request

Method: GET

Fields

Global Element Description Type
user_name User who owns the note String
title Title of the note String
content Content of the note String
tag Tag of the note Array
date Date when note is saved Date
sourceLink URL where the note is generated from String
id ID of the note ObjectId

Response

Status Code: 500, 401, 200
If an error occurs in the database process, return error code 500.
If an unauthorized user is detected, return code 401.
If getting info successfully, return code 200.

Response Example

Code: 500 Bad Request
Content:
{
    "message": "Note ID is empty."
}
Code: 401 User Not Found
Content:
{
    "message": "Unauthorized user."
}
Code: 200 OK
Content:
{
"title": ""How To Start a Blog in 2017",
"content":"This is content!!!",
"date":"2017-11-07T00:43:21.919Z",
"sourceLink":"https://www.bloggingbasics101.com/how-do-i-start-a-blog/",
"user_name":"software",
"tag": [
			{
			"user_name":"software",
			"name":"angular"
			}
		 ],
"id": "ObjectId"
}

Add Tag

Target URL

serverURL:serverPort/api/addtag

Request

Method: POST

Fields

Global Element Description Type
user_name User who owns the note String
tag Tag of the note Array

Response

Status Code: 500, 401, 200
If an error occurs in the database process, return error code 500.
If an unauthorized user is detected, return code 401.
If getting info successfully, return code 200.

Response Example

Code: 500 Bad Request
Content:
{
    "message": "Note tag is empty."
}
Code: 401 User Not Found
Content:
{
    "message": "Unauthorized user."
}
Code: 200 OK
Content:
{
"user_name":"software",
"tag": [
			{
			"user_name":"software",
			"name":"angular"
			}
		 ],
}

Check Archived Notes (Classification)

Target URL

serverURL:serverPort/api/archive

Request

Method: POST

Fields

Global Element Description Type
user_name User who owns the note String
title Title of the note String
content Content of the note String
tag Tag of the note Array
date Date when note is saved Date
sourceLink URL where the note is generated from String
id ID of the note ObjectId

Response

Status Code: 500, 401, 200
If an error occurs in the database process, return error code 500.
If an unauthorized user is detected, return code 401.
If getting info successfully, return code 200.

Response Example

Code: 500 Bad Request
Content:
{
    "message": "Note tag is empty."
}
Code: 401 User Not Found
Content:
{
    "message": "Unauthorized user."
}
Code: 200 OK
Content:
{
"title": ""How To Start a Blog in 2017",
"content":"This is content!!!",
"date":"2017-11-07T00:43:21.919Z",
"sourceLink":"https://www.bloggingbasics101.com/how-do-i-start-a-blog/",
"user_name":"software",
"tag": [
			{
			"user_name":"software",
			"name":"angular"
			}
		 ],
"id": "ObjectId"
}

Search Notes

Target URL

serverURL:serverPort/api/search

Request

Method: POST

Fields

Global Element Description Type
user_name User who owns the note String
title Title of the note String
content Content of the note String
tag Tag of the note Array
date Date when note is saved Date
sourceLink URL where the note is generated from String
id ID of the note ObjectId

Response

Status Code: 500, 401, 200
If an error occurs in the database process, return error code 500.
If an unauthorized user is detected, return code 401.
If getting info successfully, return code 200.

Response Example

Code: 500 Bad Request
Content:
{
    "message": "Note tag is empty."
}
Code: 401 User Not Found
Content:
{
    "message": "Unauthorized user."
}
Code: 200 OK
Content:
{
"title": ""How To Start a Blog in 2017",
"content":"This is content!!!",
"date":"2017-11-07T00:43:21.919Z",
"sourceLink":"https://www.bloggingbasics101.com/how-do-i-start-a-blog/",
"user_name":"software",
"tag": [
			{
			"user_name":"software",
			"name":"angular"
			}
		 ],
"id": "ObjectId"
}
⚠️ **GitHub.com Fallback** ⚠️