Add HTTP API design principles

Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com>
This commit is contained in:
pancho horrillo
2019-05-21 13:07:26 +02:00
parent c2bda51193
commit f14429701b
+20
View File
@@ -105,6 +105,26 @@ Kapow! server interacts with the outside world only through its HTTP API. Any
program making the correct HTTP request to a Kapow! server, can change its program making the correct HTTP request to a Kapow! server, can change its
behavior. behavior.
## Design Principles
* All requests and responses will leverage JSON as the data encoding method.
* The API calls responses will have two distinct parts:
* The HTTP status code (e.g., 400, Bad Request). The target audience of this
information is the client code. The client can thus use this information to
control the program flow.
* The JSON-encoded message. The target audience in this case is the human
operating the client. The human can use this information to make a decision
on how to proceed.
Let's illustrate these ideas with an example: TODO
* All successful API calls will return a representation the *final* state
attained by the objects which have been addressed (requested, set or
deleted).
FIXME: consider what to do when deleting objects. Isn't it too much to
return the list of all deleted objects in such a request?
### Servers ### Servers
TODO: Define servers' API TODO: Define servers' API