For every Client-Server interaction the client shall send a message with only "object" and "type" as keys, "object" must point to a dict and "type" must point to a string. For Example:
{"object": {"some": "object"},
"type": "some type"}
The server will always reply with with a message that "object", "type" and "status" as keys, "object" must point to a dict, "type" must point to a string and "status" must point to a string that will be either "OK" or "ERROR".
{"object": {"some": "object"},
"type": "some type"
"status": "some status"}
{"object": {"id": 1},
"type": "Get"}
Reply - OK
{"status": "OK",
"object": {"note": "some note",
"ID": 1,
"tags": ["tag1"],
"timestamps": [1417326762.795402]},
"type": "Get"}
Reply - ERROR
{"status": "ERROR",
"type": "Get",
"object": {"msg": "Item does not exist",
"ID": 1}}
Message to add a new note
{
"type": "Note"
"object": {"note": "some note",
"tags": ["tag1", "tag2"],
"ID": 1
}
}
NOTE The ID is optional
Reply - OK
{"status": "OK",
"type": "Note",
"object": {
"received note": "some note text",
"received tags": ["tag1", "tag2"],
"ID": 1}
}
Reply - Error
Message to delete a note
{
"type": "Delete"
"object": {"ID": 1},
}
Reply - OK
{
"status": "OK",
"type": "Delete",
"object": 1
}
Reply - Error
{
"status": "ERROR",
"type": "Delete",
"object": {"msg": "Note Does not exist"}
}
{
"object": {"searchTerm": "some search query"},
"type": "Search"
}
Reply - OK
{"status": "OK",
"object": {"received search": "query",
"results": [{"score": 1.5,
"obj": {"note": "some note",
"tags": ["tag1"],
"ID": 1,
"timestamps": [1417326762.795402]},
"itemType": "notes"}]}
"type": "Search"}
Reply - Error
{
"status": "ERROR",
"type": "search",
"object": {"received search": "original search query",
"results": results}
}