Communication with MemoNodes can be done via regular HTTP POST requests, using the JSON-RPC protocol. This is a simple and readable protocol, using JSON to format requests and responses. JSON (JavaScript Object Notation) is a lightweight, flexible data-interchange format, easy to read for humans to read and write, and for machines to parse and generate.
JSON-RPC is implemented in two ways:
Note that only JSON-RPC 2.0 is supported. In JSON-RPC 2.0, method parameters are defined as an object with named parameters, unlike JSON-RPC 1.0 where method parameters are defined as an array with unnamed parameters, which is much more ambiguous.
Requester (which can be an agent or a human) performs a request to MemoNodes.
| Url | http://myserver.com/memo/Y |
|---|---|
| Request | {
"id": 1,
"method": "add_domain",
"params": {
"domain": "Questionnaire",
"namespace": "http://questionnaire.com/domain/ns:questionnaire"
},
"callback": {
"url": "http://myserver.com/agentX",
"method": "addCallback"
}
} |
| Response | {
"id": 1,
"result": null,
"error": null
} |
As soon as MemoNodes has executed the task from the queue, it returns the result via a new request, adressing the callback url and method of agent X:
| Url | http://myserver.com/agent/X |
|---|---|
| Request | {
"id": 1,
"method": "addCallback",
"params": {
"result: "domain(Questionnaire, http://questionnaire.com/domain/ns:questionnaire)",
"error": null
}
} |
| Response | {
"id": 1,
"result": null,
"error": null
} |
Documentation on the JSON-RPC protocol can be found via the following links: