mimik Developer Documentation

JSON RPC API Reference

The objective of this document is to be a reference for the JSON RPC API. The JSON RPC API allows developer to work with Accounts and Access Tokens. Also, the JSON RPC API provides the capabilities to do the following:

  • deploy edge Images and edge Containers
  • implement authentication and authorization
  • remove authentication and authorization state
  • update GPS signal the the mimik cloud
  • retrieve device HMAC codes

In most case developers interact with the edgeEgine Runtime using the mimik-edge-cli tool when executing tasks at the command line. However, there are situations in which developers cannot work with the mimik-edge-cli tool, for example when working with proprietary hardware. In such cases developers will use the JSON RPC API to interact with the edgeEngine Runtime.

Intended Readers

The intended readers of this document are software developers that will be programming using the JSON RPC API.

What You Need To Know To Use This Reference

This document assumes that you have a basic knowledge of:

Also take the tutorial Using the mimik-edge-cli tool to Get An Access Token will help you get a sense of the JSON RPC API does. The mimik-edge-cli tool uses the JSON RPC API to execute its tasks.

API Methods


getMe

Description

The JSON ROC API method getMe returns the attributes for the current running instance of the edgeEngine Runtime.

Parameters

none

Returns

A JSON object that describes the current running instance of edgeEngine Runtime.

PropertyTypeDescription
nodeIdstringThe node ID assigned to the device running the edgeEngine Runtime.
accountIdstringThe account ID that is associated with the current running instance of edgeEngine Runtime. Empty if no account is associated.
namestringThe name of the device that is running the edgeEngine Runtime.
versionstringThe version of the edgeEngine Runtime.

Example Request

curl -d '{
"jsonrpc": "2.0",
"method": "getMe",
"params": [""]
}' -H "Content-Type: application/json" -X POST "http://localhost:8083/jsonrpc/v1"

Example Response

{
"id": "1",
"jsonrpc": "2.0",
"nodeId": "123e4567-e89b-12d3-a456-426655440000",
"accountId": "A123456789",
"name": "IoT Devices"
"version": "2.0"
}

getEdgeIdToken

Description

The JSON ROC API method getEdgeIdToken is used to get the edgeIdToken from mimk Global Services. The developer uses the edgeIdToken in conjunction with the Developer ID Token retrieved from the mimik Developer Console to get an Access Token using the /token endpoint which is implicit in the mimik Identity Server API. The usage of the /token is described in the OpenID Connect specification here.

To learn more about using the Developer ID Token and Access Token, read the Key Concept: Understanding edgeEngine Tokens.

Parameters

none

Returns

A JSON object that describes the edgeEngine Developer ID Token.

PropertyTypeDescription
id_tokenstringThe ID token.

Example Request

curl -d '{
"jsonrpc": "2.0",
"method": "getEdgeIdToken",
"params": [""]
}' -H "Content-Type: application/json" -X POST "http://localhost:8083/jsonrpc/v1"

Example Response

{
"id": null,
"jsonrpc": "2.0",
"result": {
"id_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1NzM1OTgxMDAsImp0aSI6IlJWdlBYdzA4dzNCTzhZUnFNdnRmIiwibm9kZV9pZCI6ImU3MTMzMmM1YjA1ZjY2ODBhYWRmYWZiNGE1NjNkYWFhZGZhc2Y2ZGQ1Yzg5M2U3MGNhYWMwMTU2ZDM1MCIsIm5vZGVfbmFtZSI6ImV4YW1wbGUtbWFjaGluZSIsInN1YiI6IiJ9.aamym5w-vG-qtz_MT60pcXMpqE5NTE5RY7kr8UD0B5o"
}
}

associateAccount

Description

The JSON ROC API method associateAccount is used to associate the instance of the edgeEngine Runtime with the developer's account.

Parameters

ParameterTypeDescription
edgeAccessTokenstringA JWT token to verify edgeEngine ‘s ownership to mimik backend services.

Returns

A JSON object that describes the edgeEngine account ID.

PropertyTypeDescription
accountIdstringThe 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"
}
}

updateGps

The JSON ROC API method updateGps method updates the edgeEngine Runtime and edgeEngine’s discovery service with a record of the location of the device on which the edgeEngine Runtime is running.

Description

Parameters

ParameterTypeDescription
edgeAccessTokenstringA JWT token to verify edgeEngine’s ownership to mimik’s backend services.
longitudestring
(unit: decimal)
The longitude of the GPS signal.
latitudestring
(unit: decimal
The latitude of the GPS signal.
speedstring
(unit: m/s)
The movement speed of the GPS signal.
bearingstring
(unit: degree)
The bearing of GPS signal.

Returns

A JSON object that describes the result of the method.

PropertyTypeDescription
idstringThe JSONRPC call ID.
jsonrpcstringThe JSONRPC API version.
result.statusstringThe 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"
}
}

© 2022 mimik Technology Inc. All Rights Reserved