YUKI Hiroshi
null+****@clear*****
Wed Dec 25 16:26:31 JST 2013
YUKI Hiroshi 2013-12-25 16:26:31 +0900 (Wed, 25 Dec 2013) New Revision: d001ac4071b87ff37f5384e44dd5a6ea5f9c89e3 https://github.com/droonga/droonga.org/commit/d001ac4071b87ff37f5384e44dd5a6ea5f9c89e3 Message: Add documents to describe common format of messages (work in progress) Added files: reference/message/index.md Modified files: reference/index.md Modified: reference/index.md (+1 -0) =================================================================== --- reference/index.md 2013-12-25 16:23:56 +0900 (ee109d4) +++ reference/index.md 2013-12-25 16:26:31 +0900 (9f7870b) @@ -4,4 +4,5 @@ layout: documents --- * [catalog.json](catalog/) + * [Message format](message/) * [Commands](commands/) Added: reference/message/index.md (+82 -0) 100644 =================================================================== --- /dev/null +++ reference/message/index.md 2013-12-25 16:26:31 +0900 (6b0e424) @@ -0,0 +1,82 @@ +--- +title: Message format +layout: documents +--- + +* TOC +{:toc} + + +## Request {#request} + +The basic format of a request message is like following: + + { + "id" : "<ID of the message>", + "type" : "<Type of the message>", + "replyTo" : "<Route to the receiver>", + "dataset" : "<Name of the target dataset>", + "body" : <Body of the message> + } + +### `id` {#request-id} + +### `type` {#request-type} + +### `replyTo` {#request-replyTo} + +### `dataset` {#request-dataset} + +### `body` {#request-body} + + +## Response {#response} + +The basic format of a response message is like following: + + { + "type" : "<Type of the message>", + "inReplyTo" : "<Route to the receiver>", + "statusCode" : <Status code>, + "body" : <Body of the message> + } + +### `type` {#response-type} + +### `inReplyTo` {#response-inReplyTo} + +### `statusCode` {#response-statusCode} + +Status codes of responses are similar to HTTP's one. + +`200` and other `2xx` statuses +: The command is successfully processed. + +### `body` {#response-body} + + +## Error response {#error} + +Some commands can return an error response. + +An error response has the `type` same to a regular response, but it has different `statusCode` and `body`. General type of the error is indicated by the `statusCode`, and details are reported as the `body`. + +### Status codes of error responses {#error-status} + +Status codes of error responses are similar to HTTP's one. + +`400` and other `4xx` statuses +: An error of the request message. + +`500` and other `5xx` statuses +: An internal error of the Droonga Engine. + +### Body of error responses {#error-body} + +The basic format of the body of an error response is like following: + + { + "name" : "<Name of the error>", + "message" : "<Human readable details of the error>", + "detail" : <Other extra information for the error, in various formats> + } -------------- next part -------------- HTML����������������������������...Download