P2P Dictionary Documentation

P2P Dictionary is a Java and C# library that enables P2P real-time data transfer between nodes on a Bonjour (local area) network. This P2P Dictionary can be used as a key-value NoSQL data store. This page provides documentation on the REST API used in P2P Dictionary.

HTTP Requests

The following resources are provided by the server. All resource identifiers may have a trailing slash (e.g., /data/) without effect.

1. Return metadata of the entire key-value store.

GET /data HTTP/1.1

2. Return a list of subscribed data at a given server. Unsubscribed data is not replicated, therefore, inaccessible in the REST requests.

GET /subscriptions HTTP/1.1

3. Return a list of connected P2P peers to a given server.

GET /connections HTTP/1.1

4. Return a list of available P2P peers for a given server.

GET /network HTTP/1.1

REST requests

This section documents the REST requests supported by the P2P dictionary.

Query Content

Query the server for the content length of a resource. Returns a response from this request but no payload.

HEAD /data/<namespace>/<resource> HTTP/1.1
P2P-Dictionary: <uid>
P2P-Sender-List: <uid-list>
ETag: <uid>.<version>

Query the server for a resource. Returns a response with payload from this request.

GET /data/<namespace>/<resource> HTTP/1.1
P2P-Dictionary: <uid>
P2P-Sender-List: <uid-list>
ETag: <uid>.<version>

Endpoints do not need to provide P2P-Dictionary or P2P-Sender-List headers for querying content.

Modify Content

Removes a resource from the server. No response.

DELETE /data/<namespace>/<resource> HTTP/1.1
P2P-Dictionary: <uid>
P2P-Sender-List: <uid-list>
ETag: <uid>.<version>

Places a resource on the server. No response.

PUT /data/<namespace>/<resource> HTTP/1.1
P2P-Dictionary: <uid>
P2P-Sender-List: <uid-list>
ETag: <uid>.<version>
Content-Length: <bytes>

<payload>

P2P Protocol (Internal)

Notifies of an updated resource but carries no payload. No response. This method should not be called by endpoints, only servers.

PUSH /data/<namespace>/<resource> HTTP/1.1
P2P-Dictionary: <uid>
P2P-Sender-List: <uid-list>
ETag: <uid>.<version>
Content-Length: <length in bytes>

Responses

Response headers from the server. The returned headers are dependent on the request. The following example shows the headers in response to GET.

HTTP/1.1 200 OK
P2P-Dictionary: <uid>
ETag: <uid>.<version>
P2P-Sender-List: <uid-list>
P2P-Response-Path: <uid-list>
Content-Location: <resource-path>
Content-Type: <specific-type>
Content-Length: <length in bytes>
Response-To: <GET/HEAD>

<content-payload>

Other response codes provided by the server are 305, 307, and 404.