Tutorials
edgeEngine JSON RPC APIs
mimik provides edgeEngine JSONRPC APIs for developers to create custom solutions for:
- Authentication and authorization.
- Removing authentication and authorization.
- Updating GPS signals to cloud APIs.
- Retrieving device HMAC code.
Returns the edgeEngine attributes currently being used for the instance of edgeEngine.
none
Returns the edgeEngine attributes currently being used for the instance of edgeEngine.
none
– edgeEngine attributesProperty | Type | Description |
---|---|---|
nodeId | string | The node ID given to the device running edgeEngine.
|
accountId | string | The account ID that is currently being associated with this instance of edgeEngine. Empty if no account is associated.
|
name | string | The name of the device that is currently running edgeEngine.
|
version | string | The version of edgeEngine.
|
curl -d '{
"jsonrpc": "2.0",
"method": "getMe",
"params": [""]
}' -H "Content-Type: application/json" -X POST "http://localhost:8083/jsonrpc/v1"
{
"id": "1",
"jsonrpc": "2.0",
"nodeId": "123e4567-e89b-12d3-a456-426655440000",
"accountId": "A123456789",
"name": "IoT Devices"
"version": "2.0"
}
Description
edgeIdToken is used in the process of associating or unassociating an account with the currently running instance of edgeEngine.
Parameters
none
Returns
object
– edgeEngine ID token.
Property | Type | Description |
---|---|---|
id_token | string | The ID token.
|
curl -d '{
"jsonrpc": "2.0",
"method": "getEdgeIdToken",
"params": [""]
}' -H "Content-Type: application/json" -X POST "http://localhost:8083/jsonrpc/v1"
{
"id": null,
"jsonrpc": "2.0",
"result": {
"id_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1NzM1OTgxMDAsImp0aSI6IlJWdlBYdzA4dzNCTzhZUnFNdnRmIiwibm9kZV9pZCI6ImU3MTMzMmM1YjA1ZjY2ODBhYWRmYWZiNGE1NjNkYWFhZGZhc2Y2ZGQ1Yzg5M2U3MGNhYWMwMTU2ZDM1MCIsIm5vZGVfbmFtZSI6ImV4YW1wbGUtbWFjaGluZSIsInN1YiI6IiJ9.aamym5w-vG-qtz_MT60pcXMpqE5NTE5RY7kr8UD0B5o"
}
}
Description
This API is used to associate edgeEngine with the account indicated in edgeToken.
Parameters
Property | Type | Description |
---|---|---|
edgeAccessToken | string | A JWT token to verify edgeEngine ‘s ownership to mimik backend services.
|
Returns
object
– edgeEngine account ID.
Property | Type | Description |
---|---|---|
accountId | string | The account ID.
|
Example Request
curl -d '{
"jsonrpc": "2.0",
"method": "associateAccount",
"params": ["eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIyNDY2Njg4Nzk5MDg4NzQ2NDk2IiwianRpIjoiZDcwVDN0V35mODNYbWpOenhYQlhmbU9RdFBFQ2RvekoxTDB-T0NNd350MSIsImNsaWVudF9pZCI6IjEyMzQ1ZC1jYTBkLTQ1NWMtYmE5Ny1hODAyOWIzMjNkZiIsImF6cCI6IkExMjM0NTY4OSIsImlzcyI6Imh0dHBzOi8vbWlkLm1pbWlrMzYwLmNvbS9tSUQvdjEvb2F1dGgvdG9rZW4iLCJub2RlX2lkIjoiZTcxMzMyYzViMDVmNjY4MGFhZGY0YTU2M2RhYTZkZDVjODkzZTcwY2FhYzAxNTZkMzUwIiwiYXVkIjpbImh0dHBzOi8vbWltaWsiLCJodHRwczovL21zdC5taW1pazM2MC5jb20vbVNUL3YxL2NsaWVudHMvR2VuZXJpYy1lZGdlIl0sInNjb3BlIjoiZWRnZTptY20gZWRnZTpjbHVzdGVycyBlZGdlOmFjY291bnQ6YXNzb2NpYXRlIG9wZW5pZCBlZGdlOnJlYWQ6YWNjb3VudGtleSIsImlhdCI6MTU3MzU5NzgzNCwiZXhwIjoxNTgxMzczODM0fQ.KRIeZT6-p8P3NIde42sHCqRifFPtBhipUTes1UOKoBE"]
}' -H "Content-Type: application/json" -X POST "http://localhost:8083/jsonrpc/v1"
Example Response
{
"id": null,
"jsonrpc": "2.0",
"result": {
"accountId": "12345689101112131"
}
}
Description
This API is used to unassociate edgeEngine from the account indicated in unassociate_edgeToken.
Parameters
Parameter | Type | Description |
---|---|---|
unassociate_edgeAccessToken | string | A JWT token to verify edgeEngine’s ownership to mimik’s backend service with unassociation scope.
|
Returns
object
– edgeEngine account ID.
Property | Type | Description |
---|---|---|
accountId | string | The account ID.
|
Example Request
curl -d '{
"jsonrpc": "2.0",
"method": "unassociateAccount",
"params": ["eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIyNDY2Njg4Nzk5MDg4NzQ2NDk2IiwianRpIjoiZDcwVDN0V35mODNYbWpOenhYQlhmbU9RdFBFQ2RvekoxTDB-T0NNd350MSIsImNsaWVudF9pZCI6IjEyMzQ1ZC1jYTBkLTQ1NWMtYmE5Ny1hODAyOWIzMjNkZiIsImF6cCI6IkExMjM0NTY4OSIsImlzcyI6Imh0dHBzOi8vbWlkLm1pbWlrMzYwLmNvbS9tSUQvdjEvb2F1dGgvdG9rZW4iLCJub2RlX2lkIjoiZTcxMzMyYzViMDVmNjY4MGFhZGY0YTU2M2RhYTZkZDVjODkzZTcwY2FhYzAxNTZkMzUwIiwiYXVkIjpbImh0dHBzOi8vbWltaWsiLCJodHRwczovL21zdC5taW1pazM2MC5jb20vbVNUL3YxL2NsaWVudHMvR2VuZXJpYy1lZGdlIl0sInNjb3BlIjoiZWRnZTptY20gZWRnZTpjbHVzdGVycyBlZGdlOmFjY291bnQ6dW5hc3NvY2lhdGUgb3BlbmlkIGVkZ2U6cmVhZDphY2NvdW50a2V5IiwiaWF0IjoxNTczNTk3ODM0LCJleHAiOjE1ODEzNzM4MzR9.C7_fvjJc8NsE5CZmqCZmI3SNPQRWs-AYLttXf5Unr4Y"]
}' -H "Content-Type: application/json" -X POST "http://localhost:8083/jsonrpc/v1"
Example Response
{
"id": null,
"jsonrpc": "2.0",
"result": {
"accountId": "12345689101112131"
}
}
Description
This API gives edgeEngine and edgeEngine’s discovery service a record of the location of the device.
Parameters
Parameter | Type | Description |
---|---|---|
edgeAccessToken | string | A JWT token to verify edgeEngine’s ownership to mimik’s backend services.
|
longitude | string ( unit: decimal ) | Longitude component of the GPS signal.
|
latitude | string ( unit: decimal ) | Latitude component of the GPS signal.
|
speed | string ( unit: m/s ) | Speed component of the GPS signal.
|
bearing
| string ( unit: degree ) | Bearing component of GPS signal.
|
Returns
object
– status of request.
Parameter | Type | Description |
---|---|---|
id | string | The JSONRPC call ID.
|
jsonrpc | string | The JSONRPC API version.
|
result.status | string | The JSONRPC request status, ‘ok’ means successfully updated.
|
Example Request
curl -d '{
"jsonrpc": "2.0",
"method": "updateGps",
"params": ["eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIyNDY2Njg4Nzk5MDg4NzQ2NDk2IiwianRpIjoiZDcwVDN0V35mODNYbWpOenhYQlhmbU9RdFBFQ2RvekoxTDB-T0NNd350MSIsImNsaWVudF9pZCI6IjEyMzQ1ZC1jYTBkLTQ1NWMtYmE5Ny1hODAyOWIzMjNkZiIsImF6cCI6IkExMjM0NTY4OSIsImlzcyI6Imh0dHBzOi8vbWlkLm1pbWlrMzYwLmNvbS9tSUQvdjEvb2F1dGgvdG9rZW4iLCJub2RlX2lkIjoiZTcxMzMyYzViMDVmNjY4MGFhZGY0YTU2M2RhYTZkZDVjODkzZTcwY2FhYzAxNTZkMzUwIiwiYXVkIjpbImh0dHBzOi8vbWltaWsiLCJodHRwczovL21zdC5taW1pazM2MC5jb20vbVNUL3YxL2NsaWVudHMvR2VuZXJpYy1lZGdlIl0sInNjb3BlIjoiZWRnZTptY20gZWRnZTpjbHVzdGVycyBlZGdlOmFjY291bnQ6dW5hc3NvY2lhdGUgb3BlbmlkIGVkZ2U6cmVhZDphY2NvdW50a2V5IiwiaWF0IjoxNTczNTk3ODM0LCJleHAiOjE1ODEzNzM4MzR9.C7_fvjJc8NsE5CZmqCZmI3SNPQRWs-AYLttXf5Unr4Y", "49.283820", "-123.111591", "3.0", "40"]
}' -H "Content-Type: application/json" -X POST "http://localhost:8083/jsonrpc/v1"
Example Response
{
"id": null,
"jsonrpc": "2.0",
"result": {
"status": "ok"
}
}