Introduction
Weimarnetz Registrator is a RESTful microservice for managing node number in our network. See https://wireless.subsignal.org/index.php?title=IP-System for more details.
Overview
HTTP verbs
Weimarnetz Registrator tries to adhere as closely as possible to standard HTTP and REST conventions in its use of HTTP verbs. To also support simple solutions like wget we wrap some verbs in GET requests.
Verb | Usage |
---|---|
|
Used to retrieve a resource |
|
Used to create a new resource |
|
Used to update an existing resource, full updates only |
|
Used to delete an existing resource |
HTTP status codes
Weimarnetz Registrator tries to adhere as closely as possible to standard HTTP and REST conventions in its use of HTTP status codes.
Status code | Usage |
---|---|
|
Standard response for successful HTTP requests. |
The actual response will depend on the request method used. |
In a GET request, the response will contain an entity corresponding to the requested resource. |
In a POST request, the response will contain an entity describing or containing the result of the action. |
|
The request has been fulfilled and resulted in a new resource being created. |
|
|
|
The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing). |
|
|
Resources
Time
Just returns the current server time.
Curl request
$ curl 'http://localhost:35765/time' -i -X GET \
-H 'accept-encoding: gzip' \
-H 'user-agent: ReactorNetty/1.1.23' \
-H 'Accept: application/json'
HTTP request
GET /time HTTP/1.1
accept-encoding: gzip
user-agent: ReactorNetty/1.1.23
host: localhost:35765
Accept: application/json
HTTP response
HTTP/1.1 200 OK
X-Content-Type-Options: nosniff
X-XSS-Protection: 0
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: SAMEORIGIN
Content-Type: application/json
Transfer-Encoding: chunked
Date: Tue, 19 Nov 2024 03:22:48 GMT
Content-Length: 27
{
"now" : 1731986568048
}
Response body
{
"now" : 1731986568048
}
Response fields
Path | Type | Description |
---|---|---|
|
|
current time |
Node
The Node resource is used to get a Node.
Curl request
$ curl 'http://reg.weimarnetz.de/ffweimar/knoten/2' -i -X GET \
-H 'accept-encoding: gzip' \
-H 'user-agent: ReactorNetty/1.1.23' \
-H 'Accept: application/json'
HTTP request
GET /ffweimar/knoten/2 HTTP/1.1
accept-encoding: gzip
user-agent: ReactorNetty/1.1.23
Accept: application/json
Host: reg.weimarnetz.de
HTTP response
HTTP/1.1 200 OK
X-Content-Type-Options: nosniff
X-XSS-Protection: 0
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: SAMEORIGIN
Content-Type: application/json
Transfer-Encoding: chunked
Date: Tue, 19 Nov 2024 03:22:48 GMT
Content-Length: 235
{
"message" : "ok",
"status" : 200,
"result" : {
"key" : 44,
"number" : 2,
"mac" : "02caffeebabe",
"created_at" : 123,
"last_seen" : 456,
"location" : "/ffweimar/knoten/2",
"network" : "ffweimar"
}
}
Response body
{
"message" : "ok",
"status" : 200,
"result" : {
"key" : 44,
"number" : 2,
"mac" : "02caffeebabe",
"created_at" : 123,
"last_seen" : 456,
"location" : "/ffweimar/knoten/2",
"network" : "ffweimar"
}
}
Response fields
Path | Type | Description |
---|---|---|
|
|
HTTP Status code |
|
|
Response message |
|
|
Internal key |
|
|
Unix timestamp of last occurence |
|
|
Unix timestamp of creation |
|
|
Path of this resource |
|
|
Mac address of this node |
|
|
Network name |
|
|
Node numnber |
Nodes
The Nodes resource is used to get a list of Nodes.
Curl request
$ curl 'http://reg.weimarnetz.de/ffweimar/knoten' -i -X GET \
-H 'accept-encoding: gzip' \
-H 'user-agent: ReactorNetty/1.1.23' \
-H 'Accept: application/json'
HTTP request
GET /ffweimar/knoten HTTP/1.1
accept-encoding: gzip
user-agent: ReactorNetty/1.1.23
Accept: application/json
Host: reg.weimarnetz.de
HTTP response
HTTP/1.1 200 OK
X-Content-Type-Options: nosniff
X-XSS-Protection: 0
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: SAMEORIGIN
Content-Type: application/json
Transfer-Encoding: chunked
Date: Tue, 19 Nov 2024 03:22:48 GMT
Content-Length: 421
{
"message" : "Ok",
"status" : 200,
"result" : [ {
"key" : 40,
"number" : 2,
"mac" : "02caffeebabe",
"created_at" : 123,
"last_seen" : 456,
"location" : "/ffweimar/knoten/2",
"network" : "ffweimar"
}, {
"key" : 41,
"number" : 3,
"mac" : "03caffeebabe",
"created_at" : 123,
"last_seen" : 456,
"location" : "/ffweimar/knoten/3",
"network" : "ffweimar"
} ]
}
Response body
{
"message" : "Ok",
"status" : 200,
"result" : [ {
"key" : 40,
"number" : 2,
"mac" : "02caffeebabe",
"created_at" : 123,
"last_seen" : 456,
"location" : "/ffweimar/knoten/2",
"network" : "ffweimar"
}, {
"key" : 41,
"number" : 3,
"mac" : "03caffeebabe",
"created_at" : 123,
"last_seen" : 456,
"location" : "/ffweimar/knoten/3",
"network" : "ffweimar"
} ]
}
Response fields
Path | Type | Description |
---|---|---|
|
|
HTTP Status code |
|
|
Response message |
|
|
Internal key |
|
|
Unix timestamp of last occurence |
|
|
Unix timestamp of creation |
|
|
Path of this resource |
|
|
Mac address of this node |
|
|
Network name |
|
|
Node numnber |
Node by mac address
This resource is used to get a Node identified by a mac address.
Curl request
$ curl 'http://reg.weimarnetz.de/ffweimar/knotenByMac?mac=02:ca:ff:ee:ba:be' -i -X GET \
-H 'accept-encoding: gzip' \
-H 'user-agent: ReactorNetty/1.1.23' \
-H 'Accept: application/json'
HTTP request
GET /ffweimar/knotenByMac?mac=02:ca:ff:ee:ba:be HTTP/1.1
accept-encoding: gzip
user-agent: ReactorNetty/1.1.23
Accept: application/json
Host: reg.weimarnetz.de
HTTP response
HTTP/1.1 200 OK
X-Content-Type-Options: nosniff
X-XSS-Protection: 0
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: SAMEORIGIN
Content-Type: application/json
Transfer-Encoding: chunked
Date: Tue, 19 Nov 2024 03:22:47 GMT
Content-Length: 235
{
"message" : "ok",
"status" : 200,
"result" : {
"key" : 13,
"number" : 2,
"mac" : "02caffeebabe",
"created_at" : 123,
"last_seen" : 456,
"location" : "/ffweimar/knoten/2",
"network" : "ffweimar"
}
}
Response body
{
"message" : "ok",
"status" : 200,
"result" : {
"key" : 13,
"number" : 2,
"mac" : "02caffeebabe",
"created_at" : 123,
"last_seen" : 456,
"location" : "/ffweimar/knoten/2",
"network" : "ffweimar"
}
}
Response fields
Path | Type | Description |
---|---|---|
|
|
HTTP Status code |
|
|
Response message |
|
|
Internal key |
|
|
Unix timestamp of last occurence |
|
|
Unix timestamp of creation |
|
|
Path of this resource |
|
|
Mac address of this node |
|
|
Network name |
|
|
Node numnber |
Add node
Adding a node returns the full node object
Curl request
$ curl 'http://reg.weimarnetz.de/ffweimar/knoten?mac=04caffeebabe&pass=test' -i -X POST \
-H 'accept-encoding: gzip' \
-H 'user-agent: ReactorNetty/1.1.23' \
-H 'transfer-encoding: chunked' \
-H 'Accept: application/json'
HTTP request
POST /ffweimar/knoten?mac=04caffeebabe&pass=test HTTP/1.1
accept-encoding: gzip
user-agent: ReactorNetty/1.1.23
transfer-encoding: chunked
Accept: application/json
Host: reg.weimarnetz.de
Content-Type: application/x-www-form-urlencoded
HTTP response
HTTP/1.1 201 Created
Location: http://localhost:35765/ffweimar/knoten/4
X-Content-Type-Options: nosniff
X-XSS-Protection: 0
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: SAMEORIGIN
Content-Type: application/json
Transfer-Encoding: chunked
Date: Tue, 19 Nov 2024 03:22:48 GMT
Content-Length: 266
{
"message" : "Node created!",
"status" : 201,
"result" : {
"key" : 54,
"number" : 4,
"mac" : "04caffeebabe",
"created_at" : 1731986568724,
"last_seen" : 1731986568724,
"location" : "/ffweimar/knoten/4",
"network" : "ffweimar"
}
}
Response body
{
"message" : "Node created!",
"status" : 201,
"result" : {
"key" : 54,
"number" : 4,
"mac" : "04caffeebabe",
"created_at" : 1731986568724,
"last_seen" : 1731986568724,
"location" : "/ffweimar/knoten/4",
"network" : "ffweimar"
}
}
Response fields
Path | Type | Description |
---|---|---|
|
|
HTTP Status code |
|
|
Response message |
|
|
Internal key |
|
|
Unix timestamp of last occurence |
|
|
Unix timestamp of creation |
|
|
Path of this resource |
|
|
Mac address of this node |
|
|
Network name |
|
|
Node numnber |
Add node via GET
Adding a node returns the full node object
Curl request
$ curl 'http://reg.weimarnetz.de/POST/ffweimar/knoten?mac=04caffeebabe&pass=test' -i -X GET \
-H 'accept-encoding: gzip' \
-H 'user-agent: ReactorNetty/1.1.23' \
-H 'Accept: application/json'
HTTP request
GET /POST/ffweimar/knoten?mac=04caffeebabe&pass=test HTTP/1.1
accept-encoding: gzip
user-agent: ReactorNetty/1.1.23
Accept: application/json
Host: reg.weimarnetz.de
HTTP response
HTTP/1.1 201 Created
Location: http://localhost:35765/ffweimar/knoten/4
X-Content-Type-Options: nosniff
X-XSS-Protection: 0
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: SAMEORIGIN
Content-Type: application/json
Transfer-Encoding: chunked
Date: Tue, 19 Nov 2024 03:22:49 GMT
Content-Length: 266
{
"message" : "Node created!",
"status" : 201,
"result" : {
"key" : 70,
"number" : 4,
"mac" : "04caffeebabe",
"created_at" : 1731986569083,
"last_seen" : 1731986569083,
"location" : "/ffweimar/knoten/4",
"network" : "ffweimar"
}
}
Response body
{
"message" : "Node created!",
"status" : 201,
"result" : {
"key" : 70,
"number" : 4,
"mac" : "04caffeebabe",
"created_at" : 1731986569083,
"last_seen" : 1731986569083,
"location" : "/ffweimar/knoten/4",
"network" : "ffweimar"
}
}
Response fields
Path | Type | Description |
---|---|---|
|
|
HTTP Status code |
|
|
Response message |
|
|
Internal key |
|
|
Unix timestamp of last occurence |
|
|
Unix timestamp of creation |
|
|
Path of this resource |
|
|
Mac address of this node |
|
|
Network name |
|
|
Node numnber |
Add node with given node number
Adding a node returns the full node object
Curl request
$ curl 'http://reg.weimarnetz.de/ffweimar/knoten/10?mac=05caffeebabe&pass=test' -i -X PUT \
-H 'accept-encoding: gzip' \
-H 'user-agent: ReactorNetty/1.1.23' \
-H 'transfer-encoding: chunked' \
-H 'Accept: application/json'
HTTP request
PUT /ffweimar/knoten/10?mac=05caffeebabe&pass=test HTTP/1.1
accept-encoding: gzip
user-agent: ReactorNetty/1.1.23
transfer-encoding: chunked
Accept: application/json
Host: reg.weimarnetz.de
Content-Type: application/x-www-form-urlencoded
HTTP response
HTTP/1.1 201 Created
Location: http://localhost:35765/ffweimar/knoten/10
X-Content-Type-Options: nosniff
X-XSS-Protection: 0
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: SAMEORIGIN
Content-Type: application/json
Transfer-Encoding: chunked
Date: Tue, 19 Nov 2024 03:22:49 GMT
Content-Length: 268
{
"message" : "Node created!",
"status" : 201,
"result" : {
"key" : 62,
"number" : 10,
"mac" : "05caffeebabe",
"created_at" : 1731986568997,
"last_seen" : 1731986568997,
"location" : "/ffweimar/knoten/10",
"network" : "ffweimar"
}
}
Response body
{
"message" : "Node created!",
"status" : 201,
"result" : {
"key" : 62,
"number" : 10,
"mac" : "05caffeebabe",
"created_at" : 1731986568997,
"last_seen" : 1731986568997,
"location" : "/ffweimar/knoten/10",
"network" : "ffweimar"
}
}
Response fields
Path | Type | Description |
---|---|---|
|
|
HTTP Status code |
|
|
Response message |
|
|
Internal key |
|
|
Unix timestamp of last occurence |
|
|
Unix timestamp of creation |
|
|
Path of this resource |
|
|
Mac address of this node |
|
|
Network name |
|
|
Node numnber |
Update node
Updating a node returns the full node object
Curl request
$ curl 'http://reg.weimarnetz.de/ffweimar/knoten/2?mac=02caffeebabe&pass=test' -i -X PUT \
-H 'accept-encoding: gzip' \
-H 'user-agent: ReactorNetty/1.1.23' \
-H 'transfer-encoding: chunked' \
-H 'Accept: application/json'
HTTP request
PUT /ffweimar/knoten/2?mac=02caffeebabe&pass=test HTTP/1.1
accept-encoding: gzip
user-agent: ReactorNetty/1.1.23
transfer-encoding: chunked
Accept: application/json
Host: reg.weimarnetz.de
Content-Type: application/x-www-form-urlencoded
HTTP response
HTTP/1.1 200 OK
X-Content-Type-Options: nosniff
X-XSS-Protection: 0
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: SAMEORIGIN
Content-Type: application/json
Transfer-Encoding: chunked
Date: Tue, 19 Nov 2024 03:22:48 GMT
Content-Length: 250
{
"message" : "updated",
"status" : 200,
"result" : {
"key" : 17,
"number" : 2,
"mac" : "02caffeebabe",
"created_at" : 123,
"last_seen" : 1731986568013,
"location" : "/ffweimar/knoten/2",
"network" : "ffweimar"
}
}
Response body
{
"message" : "updated",
"status" : 200,
"result" : {
"key" : 17,
"number" : 2,
"mac" : "02caffeebabe",
"created_at" : 123,
"last_seen" : 1731986568013,
"location" : "/ffweimar/knoten/2",
"network" : "ffweimar"
}
}
Response fields
Path | Type | Description |
---|---|---|
|
|
HTTP Status code |
|
|
Response message |
|
|
Internal key |
|
|
Unix timestamp of last occurence |
|
|
Unix timestamp of creation |
|
|
Path of this resource |
|
|
Mac address of this node |
|
|
Network name |
|
|
Node numnber |
Update node via GET
Updating a node returns the full node object
Curl request
$ curl 'http://reg.weimarnetz.de/PUT/ffweimar/knoten/2?mac=02caffeebabe&pass=test' -i -X GET \
-H 'accept-encoding: gzip' \
-H 'user-agent: ReactorNetty/1.1.23' \
-H 'Accept: application/json'
HTTP request
GET /PUT/ffweimar/knoten/2?mac=02caffeebabe&pass=test HTTP/1.1
accept-encoding: gzip
user-agent: ReactorNetty/1.1.23
Accept: application/json
Host: reg.weimarnetz.de
HTTP response
HTTP/1.1 200 OK
X-Content-Type-Options: nosniff
X-XSS-Protection: 0
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: SAMEORIGIN
Content-Type: application/json
Transfer-Encoding: chunked
Date: Tue, 19 Nov 2024 03:22:47 GMT
Content-Length: 250
{
"message" : "updated",
"status" : 200,
"result" : {
"key" : 11,
"number" : 2,
"mac" : "02caffeebabe",
"created_at" : 123,
"last_seen" : 1731986567897,
"location" : "/ffweimar/knoten/2",
"network" : "ffweimar"
}
}
Response body
{
"message" : "updated",
"status" : 200,
"result" : {
"key" : 11,
"number" : 2,
"mac" : "02caffeebabe",
"created_at" : 123,
"last_seen" : 1731986567897,
"location" : "/ffweimar/knoten/2",
"network" : "ffweimar"
}
}
Response fields
Path | Type | Description |
---|---|---|
|
|
HTTP Status code |
|
|
Response message |
|
|
Internal key |
|
|
Unix timestamp of last occurence |
|
|
Unix timestamp of creation |
|
|
Path of this resource |
|
|
Mac address of this node |
|
|
Network name |
|
|
Node numnber |
Delete a node
Delete a node from the database, needs authentication
Curl request
$ curl 'http://reg.weimarnetz.de/ffweimar/knoten/4' -i -u 'adminuser:adminpass' -X DELETE \
-H 'accept-encoding: gzip' \
-H 'user-agent: ReactorNetty/1.1.23' \
-H 'accept: */*'
HTTP request
DELETE /ffweimar/knoten/4 HTTP/1.1
accept-encoding: gzip
user-agent: ReactorNetty/1.1.23
accept: */*
Authorization: Basic YWRtaW51c2VyOmFkbWlucGFzcw==
Host: reg.weimarnetz.de
HTTP response
HTTP/1.1 204 No Content
X-Content-Type-Options: nosniff
X-XSS-Protection: 0
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: SAMEORIGIN
Date: Tue, 19 Nov 2024 03:22:49 GMT
Dump complete database
Dumps the complete database, needs authentication
Curl request
$ curl 'http://reg.weimarnetz.de/dumpDatabase' -i -u 'adminuser:adminpass' -X GET \
-H 'accept-encoding: gzip' \
-H 'user-agent: ReactorNetty/1.1.23' \
-H 'accept: */*'
HTTP request
GET /dumpDatabase HTTP/1.1
accept-encoding: gzip
user-agent: ReactorNetty/1.1.23
accept: */*
Authorization: Basic YWRtaW51c2VyOmFkbWlucGFzcw==
Host: reg.weimarnetz.de
HTTP response
HTTP/1.1 200 OK
X-Content-Type-Options: nosniff
X-XSS-Protection: 0
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: SAMEORIGIN
Content-Type: application/json
Transfer-Encoding: chunked
Date: Tue, 19 Nov 2024 03:22:47 GMT
Content-Length: 518
[ {
"key" : 8,
"number" : 2,
"mac" : "02caffeebabe",
"created_at" : 123,
"last_seen" : 456,
"location" : "/ffweimar/knoten/2",
"network" : "ffweimar"
}, {
"key" : 9,
"number" : 3,
"mac" : "03caffeebabe",
"created_at" : 123,
"last_seen" : 456,
"location" : "/ffweimar/knoten/3",
"network" : "ffweimar"
}, {
"key" : 10,
"number" : 4,
"mac" : "08caffeebabe",
"created_at" : 1731986567551,
"last_seen" : 1731986567551,
"location" : "/ffweimar/knoten/4",
"network" : "ffweimar"
} ]
Response fields
Path | Type | Description |
---|---|---|
|
|
Internal key |
|
|
Unix timestamp of last occurence |
|
|
Unix timestamp of creation |
|
|
Path of this resource |
|
|
Mac address of this node |
|
|
Network name |
|
|
Node numnber |
Import database
Imports the complete database, needs authentication. Existing entries will be updated.
Curl request
$ curl 'http://reg.weimarnetz.de/importDatabase' -i -u 'adminuser:adminpass' -X POST \
-H 'accept-encoding: gzip' \
-H 'user-agent: ReactorNetty/1.1.23' \
-H 'accept: */*' \
-H 'Content-Type: application/json' \
-d '[
{
"key": 12,
"number": 22,
"mac": "0202caffbabe",
"created_at": 1618579261185,
"last_seen": 1649942460672,
"location": "/testnet/knoten/22",
"network": "testnet"
},
{
"key": 23,
"number": 42,
"mac": "02caffeebabe",
"created_at": 1618579261185,
"last_seen": 1649942460672,
"location": "/testnet/knoten/42",
"network": "testnet"
},
{
"key": 42,
"number": 23,
"mac": "02c4ff33b4b3",
"created_at": 1620320194435,
"last_seen": 1620523256929,
"location": "/ffweimar/knoten/23",
"network": "ffweimar"
}
]
'
HTTP request
POST /importDatabase HTTP/1.1
accept-encoding: gzip
user-agent: ReactorNetty/1.1.23
accept: */*
Content-Type: application/json
Authorization: Basic YWRtaW51c2VyOmFkbWlucGFzcw==
Content-Length: 596
Host: reg.weimarnetz.de
[
{
"key": 12,
"number": 22,
"mac": "0202caffbabe",
"created_at": 1618579261185,
"last_seen": 1649942460672,
"location": "/testnet/knoten/22",
"network": "testnet"
},
{
"key": 23,
"number": 42,
"mac": "02caffeebabe",
"created_at": 1618579261185,
"last_seen": 1649942460672,
"location": "/testnet/knoten/42",
"network": "testnet"
},
{
"key": 42,
"number": 23,
"mac": "02c4ff33b4b3",
"created_at": 1620320194435,
"last_seen": 1620523256929,
"location": "/ffweimar/knoten/23",
"network": "ffweimar"
}
]
HTTP response
HTTP/1.1 200 OK
X-Content-Type-Options: nosniff
X-XSS-Protection: 0
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: SAMEORIGIN
Date: Tue, 19 Nov 2024 03:22:48 GMT
Request fields
Path | Type | Description |
---|---|---|
|
|
Internal key |
|
|
Unix timestamp of last occurence |
|
|
Unix timestamp of creation |
|
|
Path of this resource |
|
|
Mac address of this node |
|
|
Network name |
|
|
Node numnber |