Unverified Commit 9c5c461a authored by Éloïs's avatar Éloïs
Browse files

add requests part

parent a9e2abd8
......@@ -19,6 +19,13 @@ This document details the current specifications of WS2P v1 as they are already
* [Rebound policy](#rebound-policy)
* [HEAD Rebound policy](#head-rebound-policy)
* [Documents rebound policy](#documents-rebound-policy)
* [WS2P requests](#ws2p-requests)
* [getCurrent](#getcurrent)
* [getBlock](#getblock)
* [getBlocks](#getBlocks)
* [getRequirementsPending](#getrequirementspending)
* [List of error messages](#list-of-error-messages)
## What is WS2P ?
......@@ -392,3 +399,183 @@ Each time Duniter receives a new document, either via the client api or via ws2p
3. Verification of compliance with all local index rules
If all conditions are satisfied, then the document is saved in the local bdd of the node and is transmitted to all active ws2p connections.
## WS2P requests
Specific queries can be sent via ws2p to obtain specific blocks or sandbox data.
Each type of query has a unique identifier called "name" (Realy it's an integer).
### getCurrent
name = 3
JSON Message :
{
reqId: REQUESTS_UNIQUE_ID,
body: {
name: 3,
params: {}
}
}
REQUESTS_UNIQUE_ID := Random sequence of 8 hexadecimal characters. (This unique identifier will be returned to the header of the response,
it allows the requester node to identify to which query the answers it receives correspond, because the answers are asynchronous).
JSON response to success :
{
resId: REQUESTS_UNIQUE_ID,
body: BLOCK_IN_JSON_FORMAT
}
JSON error response :
{
resId: REQUESTS_UNIQUE_ID,
err: error_message_in_string_format
}
### getBlock
name = 2
JSON Message :
{
reqId: REQUESTS_UNIQUE_ID,
body: {
name: 2,
params: {
number: BLOCK_NUMBER
}
}
}
REQUESTS_UNIQUE_ID := Random sequence of 8 hexadecimal characters. (This unique identifier will be returned to the header of the response,
it allows the requester node to identify to which query the answers it receives correspond, because the answers are asynchronous).
JSON response to success :
{
resId: REQUESTS_UNIQUE_ID,
body: BLOCK_IN_JSON_FORMAT
}
JSON error response :
{
resId: REQUESTS_UNIQUE_ID,
err: error_message_in_string_format
}
### getBlocks
name = 1
JSON Message :
{
reqId: REQUESTS_UNIQUE_ID,
body: {
name: 1,
params: {
count: *number of blocks requested*,
fromNumber: *number of the 1st block of the requested interval*
}
}
}
REQUESTS_UNIQUE_ID := Random sequence of 8 hexadecimal characters. (This unique identifier will be returned to the header of the response,
it allows the requester node to identify to which query the answers it receives correspond, because the answers are asynchronous).
JSON response to success :
{
resId: REQUESTS_UNIQUE_ID,
body: [
BLOCK_1_IN_JSON_FORMAT,
BLOCK_2_IN_JSON_FORMAT,
...
]
}
JSON error response :
{
resId: REQUESTS_UNIQUE_ID,
err: *error message in string format*
}
### getRequirementsPending
Requests the "requirements" of all identities that have received at least `minCert` certifications.
name = 0
JSON Message :
{
reqId: REQUESTS_UNIQUE_ID,
body: {
name: 0,
params: {
minCert: *integer*
}
}
}
REQUESTS_UNIQUE_ID := Random sequence of 8 hexadecimal characters. (This unique identifier will be returned to the header of the response,
it allows the requester node to identify to which query the answers it receives correspond, because the answers are asynchronous).
JSON response to success :
{
resId: REQUESTS_UNIQUE_ID,
body: {
identities: [
{
hash: IDTY1_HASH,
member: *boolean*,
wasMember: *boolean*,
pubkey: IDTY1_PUBKEY,
uid: IDTY1_UID,
buid: IDTY1_BUID,
sig: IDTY1_SIG,
revocation_sig: IDTY1_REVOCATION_SIG,
revoked: *boolean*,
revoked_on: *integer*
},
IDTY2,
...
]
}
}
Fields details:
hash := sha256 of the identity document.
member := `true` if the identity is a member, `false` otherwise.
wasMember := `true` if the identity has already been a member at least once in the past, `false` otherwise.
pubkey := public key ed25519 of the identity
uid := Human name of identity
buid := identity document creation blockstamp
sig := signature of the identity document
revocation_sig := signature of revocation document (empty string if the revocation document has not been published)
revoked := `true` if the member has been revoked, `false` otherwise.
revoked_on := Blockstamp when identity was revoked, or `0` if identity has not yet been revoked.
JSON error response :
{
resId: REQUESTS_UNIQUE_ID,
err: *error message in string format*
}
### List of error messages
* "Wrong param `number`"
* "Wrong param `count`"
* "Wrong param `fromNumber`"
* "Wrong param `minCert`"
* "Unknow request"
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment