Namestore

Definition

Variables in single quotes '...' can or must be changed according to your specific case.

name is the name of a zone. A zone is the name of an identity in this case.

GNS Record

Namestore entries are GNS records. GNS records have a record_name and a set of record data''. The data consists of a ``value, an expiration_time, flags and a record_name. Adding a GNS records with the same record_name incrementally adds record to it.

A GNS Record is sent in the JSON format

{
  "record_name": string,
  "data": RecordData[]
}

A RecordData has the following format

{
  "value": string,
  "record_type": string,
  "expiration_time": string,
  "private": boolean,
  "relative_expiration": boolean,
  "supplemental": boolean,
  "shadow": boolean
}

name is the name of the record.

type is the type of the record, e.g. “PKEY” for private key. It can be ANY, PKEY, NICK, LEHO, VPN, GNS2DNS, BOX, PLACE, PHONE, ID_ATTR, ID_TOKEN, ID_TOKEN_METADATA, CREDENTIAL, POLICY, ATTRIBUTE, ABE_KEY, ABE_MASTER. You can find more information in header src/gnunet_gnsrecord_lib.h

value is the value of the specific type of the record, e.g. the private key of an identity.

time is the expiration time of the record either “never”, fancy time (see GNUNET_STRINGS_fancy_time_to_absolute) or a realtive expiration time.

private is a flag of the record. True if private.

relative_expiration is a flag of the record. True if expiration is in relative fancy time.

supplemental is a flag of the record. True if record is supplemental.

shadow is a flag of the record. True if this is a shadow record.

Error Response

An error response is sent in the JSON format: {"error":"*error_description*"}

Following numbers are added for references inside the documentation only.

Error descriptions are:

Nr. Error Description           - Explanation
1)  Unknown Error               - Error is not specified
2)  No identity found           - Identity was not found with given name, this is combined with the HTTP Error Code 404 Not Found
3)  No default zone specified   - Identity name was not given and no identiy was added to the subsystem namestore
4)  Namestore action failed     - The task of the namestore API (not REST API) failed
5)  No data                     - Missing data
6)  Data invalid                - Wrong data given
7)  Error storing records       - POST request failed
8)  Deleting record failed      - DELETE request failed
9)  No record found             - Delete failed due to missing record, this is combined with the HTTP Error Code 404 Not Found

Error 1) is always possible and is not listed in following requests.

ATTENTION: Any error message from the Namestore API (not REST API) can occur and can be returned in the error response. These responses are not listed here.

Requests

GET Request

Title

Returns all namestore entries for one zone.

URL

/namestore/'zone'

Method

GET

URL Params

?record_type='type' optional

Data Params

none

Success Response

Record[]

Error Response

{“error”:”error_desc”} 2; 4

Title

Returns namestore entry for zone and name optionally filtering by type.

URL

/namestore/'zone'/'name'

Method

GET

URL Params

record_type='type' optional

Data Params

none

Success Response

Record

Error Response

{“error”:”error_desc”} 2; 4


POST Request

Title

Creates a namestore entry in a zone.

URL

/namestore/'zone'

Method

POST

URL Params

none

Data Params

Record

Success Response

Response Code: 204 (No Content)

Error Response

{“error”:”error_desc”} 3; 4; 5; 6; 7


PUT Request

Title

Replaces a namestore entriy in a zone

URL

/namestore/'zone'

Method

PUT

URL Params

none

Data Params

Record

Success Response

Response Code: 204 (No Content)

Error Response

{“error”:”error_desc”} 3; 4; 5; 6; 7


DELETE Request

Title

Deletes specific namestore entry in specific zone

URL

/namestore/'zone'/'name'

Method

DELETE

URL Params

none

Data Params

none

Success Response

Response Code: 204 (No Content)

Error Response

{“error”:”error_desc”} 2; 4; 6; 8; 9

OPTIONS Request

Title

Gets request options

URL

/namestore

Method

OPTIONS

URL Params

none

Data Params

none

Success Response

Error Response

none