-
Notifications
You must be signed in to change notification settings - Fork 116
Dnote HTTP API
Sung edited this page Mar 3, 2023
·
6 revisions
The API request and response payloads use JSON. Set HTTP header Content-Type: application/json
to use JSON.
- Obtain the session key using the "sign in" API.
- Set HTTP header "Authorization" to
Bearer [your session key]
to authenticate.
Example
$ curl http://localhost:3000/api/v3/notes -H "Authorization: Bearer MyLpsk2o/qidblP0yiGdgPNgZZp2q3WJdp5GFGaaoMs="
/api/v3/signin
Key | Type | Description | Required |
---|---|---|---|
string | Email address for the account | Yes | |
password | string | Password for the account | Yes |
Key | Type | Description |
---|---|---|
key | string | The secret session key |
expires_at | number | Unix timestamp of when the session key expires |
$ curl -X POST http://localhost:3000/api/v3/signin -d '{"email": "alice@example.com", "password": "randompassword"}' -H "Content-Type: application/json"
{"key":"MyLpsk2o/qidblP0yiGdgPNgZZp2q3WJdp5GFGaaoMs=","expires_at":1686526664
/api/v3/signout
Expires the given session key.
None.
HTTP 204 if successful.
/v3/notes/
Key | Type | Description | Required |
---|---|---|---|
year | string | The year in which notes are created | |
month | string | The month in which notes are created | |
books | []string | The list of books to which notes belong | |
page | number | The page of the search result | |
q | string | a string to match for full text search |
Key | Type | Description |
---|---|---|
notes | []Note | Notes |
total | number | The total number of results |
Note is
Key | Type | Description |
---|---|---|
uuid | string | Notes |
created_at | timestamp | a timestmap |
updated_at | timestamp | a timestmap |
body | string | The content of note |
added_on | number | Unix timestamp for when note is added |
public | bool | Currently always true |
usn | number | an internal mechanism used for sync |
book | Book | The book that the note belong to |
user | User | User that created the note |
/v3/notes/{noteUUID}
None.
Note. Please see previous sections for its shape.
POST - /v3/notes/
Key | Type | Description | Required |
---|---|---|---|
book_uuid | string | UID for the book the note will belong to | Yes |
content | string | The content of the note | Yes |
added_on | number | Unix timestamp of creation | |
edited_on | number | Unix timestamp of last edit |
Key | Type | Description |
---|---|---|
result | Note | Note |
$ curl -X POST http://localhost:3000/api/v3/notes -H "Authorization: Bearer MyLpsk2o/qidblP0yiGdgPNgZZp2q3WJdp5GFGaaoMs=" -H "Content-Type: application/json" -d '{"book_uuid": "bdf6cadb-38da-49d1-bbc8-98f8bcdd3ff7", "content": "my note content"}
DELETE - /v3/notes/{noteUUID}
None.
Key | Type | Description |
---|---|---|
status | number | HTTP status |
result | Note | Note |
PATCH - /v3/notes/{noteUUID}
Key | Type | Description | Required |
---|---|---|---|
book_uuid | string | UID for the book the note will belong to | |
content | string | The content of the note | |
public | number | Not used |
Key | Type | Description |
---|---|---|
status | number | HTTP status |
result | Note | Note |
PATCH - /v3/books
Key | Type | Description | Required |
---|---|---|---|
name | string | name to match for the books |
A list of books.
A book is:
Key | Type | Description |
---|---|---|
uuid | string | UUID for the book |
usn | string | an internal mechanism |
created_at | string | a timestamp for creation |
updated_at | string | a timestamp for the last update |
label | string | The name of the book |
PATCH - /v3/books/{bookUUID}
None.
A book. Please see previous session for the shape of a book.
POST - /v3/books/
Key | Type | Description | Required |
---|---|---|---|
name | string | The name of the book | Yes |
Key | Type | Description |
---|---|---|
book | Book | book |
PATCH - /v3/books/{bookUUID}
Key | Type | Description | Required |
---|---|---|---|
name | string | The name of the book |
Key | Type | Description |
---|---|---|
book | Book | book |
Delete - /v3/books/{bookUUID}
None
Key | Type | Description |
---|---|---|
status | number | an HTTP status |
book | Book | book |