developer portal

Documentation

edgeSDK JSON RPC APIs

mimik provides edgeSDK 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.

getMe

Description

Returns the edgeSDK attributes currently being used for the instance of edgeSDK.

Parameters

none

Returns

object - edgeSDK attributes

Property Type Description
nodeId string The node ID given to the device running edgeSDK.
accountId string The account ID that is currently being associated with this instance of edgeSDK. Empty if no account is associated.
name string The name of the device that is currently running edgeSDK.
version string The version of edgeSDK.

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

edgeIdToken is used in the process of associating or unassociating an account with the currently running instance of edgeSDK.

Parameters

none

Returns

object - edgeSDK ID token.

Property Type Description
id_token string The 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

This API is used to associate edgeSDK with the account indicated in edgeToken.

Parameters

Parameter Type Description
edgeAccessToken string A JWT token to verify edgeSDK's ownership to mimik backend services.

Returns

object - edgeSDK 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"
    }
}

 

unassociateAccount

Description

This API is used to unassociate edgeSDK from the account indicated in unassociate_edgeToken.

Parameters

Parameter Type Description
unassociate_edgeAccessToken string A JWT token to verify edgeSDK's ownership to mimik's backend service with unassociation scope.

Returns

object - edgeSDK 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"
    }
}

 

updateGps

Description

This API gives edgeSDK and edgeSDK's discovery service a record of the location of the device.

Parameters

Parameter Type Description
edgeAccessToken string A JWT token to verify edgeSDK'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.

Property 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"
    }
}

 

Need more help?

Feel free to contact us on stack overflow or send us a question via our support page if you have any questions.

Was this page helpful?