Documentation
Access Keys

‍path: /api/v1/apikeys

To work with the data via the API the access keys are needed. There are two kinds of keys, read and write keys. The keys are stored as pairs in this endpoint. One pair of these keys give access to one endpoint of the API. The pairs are labelled with the name of the corresponding endpoint. The following listing shows the whole default apikeys endpoint:

{
"keys": [
{
"name": "properties",
"rd": "rdKey1",
"wr": "wrKey1",
"Json+typeName": "MkcJsonLib.jApiKey",
"Json+typeRevision": 0
},
{
"name": "apikeys",
"rd": "rdKey2",
"wr": "wrKey2",
"Json+typeName": "MkcJsonLib.jApiKey",
"Json+typeRevision": 0
},
{
"name": "httpro",
"rd": "rdKey3",
"wr": "wrKey3",
"Json+typeName": "MkcJsonLib.jApiKey",
"Json+typeRevision": 0
},
{
"name": "httprw",
"rd": "rdKey4",
"wr": "wrKey4",
"Json+typeName": "MkcJsonLib.jApiKey",
"Json+typeRevision": 0
},
{
"name": "httpsu",
"rd": "rdKey5",
"wr": "wrKey5",
"Json+typeName": "MkcJsonLib.jApiKey",
"Json+typeRevision": 0
},
{
"name": "process",
"rd": "rdKey6",
"wr": "wrKey6",
"Json+typeName": "MkcJsonLib.jApiKey",
"Json+typeRevision": 0
},
{
"name": "data",
"rd": "rdKey7",
"wr": "wrKey7",
"Json+typeName": "MkcJsonLib.jApiKey",
"Json+typeRevision": 0
}
],
"Json+typeName": "MkcJsonLib.jApiKeys",
"Json+typeRevision": 0
}

Structure of a key pair

This structure contains one key pair for one REST endpoint.

{
"name": "data",
"rd": "rdKey7",
"wr": "wrKey7",
"Json+typeName": "MkcJsonLib.jApiKey",
"Json+typeRevision": 0
}
Variable Description datatype writable
name name of the corresponding REST API endpoint string no
rd the key for read access string yes
wr the key for write access string yes

Usage

These keys need to be added into the header section of the HTTP request as parameter. The read key gets the parameter name "ApiRdKey", the write key gets "ApiWrKey".

example of a request, that changes the read key for data endpoint "mykey":
PUT /api/v1/apikeys/keys/6 HTTP/1.1\r\n
Host: 192.168.15.22\r\n
ApiRdKey: rdKey2\r\n
ApiWrKey: wrKey2\r\n
Content-Length: 8\r\n
Content-Type: application/x-www-form-urlencoded\r\n
\r\n
rd=mykey

the example as a curl command
curl -H "ApiRdKey: rdKey2" -H "ApiWrKey: wrKey2" -X PUT -d "rd=mykey" 192.168.15.100/api/v1/apikeys/keys/6
Remarks
The keys can be set to empty strings, in order for accessing and changing the data without any keys.
Note
  • A device could have more or less endpoints and in such more keys, depending on the capabilities.
  • The "device" endpoint is not secured by any API keys, so there are no keys for it.
  • The write key alone is not enough for a write access. Both keys must be provided with a write request.
Warning
  • This endpoint is itself secured by a pair of keys, which are also saved here. This means, the read key for this endpoint is enough to get access to all endpoints and to change all the keys (since the write key can be read out).