-
Notifications
You must be signed in to change notification settings - Fork 39
Rest API Docs
Johannes Zellner edited this page Oct 14, 2017
·
2 revisions
The API can be found under meemourl/api/<api-name>
Request Data (POST/PUT) must be send as type application/json
in a raw body
The following message structure will be returned on Error
{
"status": "<Error Status e.g. Internal Server Error>",
"message": "<mesage>"
}
Tokens are not automatically invalidated, it is recommended to invalidate (logout) every token after using it.
Type: POST api/login
Post Body:
{"username":"<username>","password":"<password>"}
Response:
{
"token": "1c828f67-c123-4417-9153-d3847b8919c7",
"user": {
"id": "<id>",
"username": "<username>",
"displayName": "<displayname>"
}
}
Type GET api/logout?token=<token>
Invalidates token
Response:
Error or {}
on success
Type GET api/things?token=<token>
Response:
{
"things": [
{
"_id": "5947d9d580b52041830d1b1b",
"content": "Note 2",
"createdAt": 1497881045925,
"modifiedAt": 1497881045925,
"tags": [],
"externalContent": [],
"attachments": [],
"public": false,
"shared": false,
"archived": false,
"sticky": true,
"richContent": "Note 2"
},
{
"_id": "5947c82280b52041830d1b15",
"content": "Note 1",
"createdAt": 1497876514858,
"modifiedAt": 1497881041669,
"tags": [],
"externalContent": [],
"attachments": [],
"public": true,
"shared": false,
"archived": false,
"sticky": false,
"richContent": "Note 1"
}
]
}
Type POST api/things?token=<token>
Post Body:
{
"content": "Note 5",
"attachments": []
}
Response:
{
"thing": {
"_id": "5947e24d80b52041830d1b1d",
"content": "Note 5",
"createdAt": 1497883213258,
"modifiedAt": 1497883213258,
"tags": [],
"externalContent": [],
"attachments": [],
"public": false,
"shared": false,
"archived": false,
"sticky": true,
"richContent": "Note 5"
}
}
Type GET api/things/<note id>?token=<token>
note id = _id from /api/things
Response:
{
"thing": {
"_id": "5947d9d580b52041830d1b1b",
"content": "Note 2",
"createdAt": 1497881045925,
"modifiedAt": 1497881045925,
"tags": [],
"externalContent": [],
"attachments": [],
"public": false,
"shared": false,
"archived": false,
"sticky": true,
"richContent": "Note 2"
}
}
Type DELETE api/<note id>?<token>
Response:
{}
Deletes Note by ID
Type PUT api/<note id>?<token>
PUT Body:
{
"content": "Note 1",
"attachments": [],
"public": true,
"shared": false,
"archived": false,
"sticky": true
}
Response:
{
"thing": {
"_id": "5947c82280b52041830d1b15",
"content": "Note 1",
"createdAt": 1497876514858,
"modifiedAt": 1497882953648,
"tags": [],
"externalContent": [],
"attachments": [],
"public": true,
"shared": false,
"archived": false,
"sticky": true,
"richContent": "Note 1"
}
}
Updates Note by ID, returns Updated Note or Error