mimik edgeSDK JSONRPC

Use the JSONRPC API to enable account association and account clustering to your applications.


Making API Calls

There are two ways of making JSONRPC API calls to edgeSDK and mimik's edge-cloud back-end services:

  1. Making Requests Through WebSocket.
    • The JavaScript codes of making JSONRPC calls through WebSocket are provided in our GitHub.
      Please visit our GitHub page at HERE to check that out.

  2. Making Requests Through HTTP.
    • You can also send JSONRPC calls to edgeSDK and mimik's back-end services via HTTP.
      Check below for API references to see how it is done.


API References


APIs

getMe

Type: <function>

Return Object: <Me>

Description: This function returns the attributes that is currently being used for the instance of the edgeSDK.

HTTP Request:


                          Method: POST
                          URL: http://localhost:8083/jsonrpc/v1
                          Header: application/json
                          Body: {
                                    "jsonrpc": '2.0',
                                    "method": 'getMe',
                                    "params": ['']
                                }
                        

getEdgeIdToken

Type: <function>

Return Object: <Token>

Description: EdgeIdToken is used in the process of associating or unassociating an account to the instance of running the edgeSDK.

HTTP Request:


                        Method: POST
                        URL: http://localhost:8083/jsonrpc/v1
                        Header: application/json
                        Body: {
                                  "jsonrpc": '2.0',
                                  "method": 'getEdgeIdToken',
                                  "params": ['']
                              }
                      

associateAccount(edgeToken)

Type: <function>

Argument:

  • edgeToken

    Type: <string>

Return Object: <Account>

Description: This function is used to associate edgeSDK to the account indicated in edgeToken.

HTTP Request:


                          Method: POST
                          URL: http://localhost:8083/jsonrpc/v1
                          Header: application/json
                          Body: {
                                    "jsonrpc": '2.0',
                                    "method": 'associateAccount',
                                    "params": [edgeToken]
                                }
                        

Attention: You can obtain the edgeToken via OAuth Tool at Here.

unassociateAccount(unassociate_edgeToken)

Type: <function>

  • unassociate_edgeToken

    Type: <string>

Return Object: <Account>

Description: This function is used to unassociate the edgeSDK to the account indicated in the unassociate_edgeToken.

HTTP Request:


                          Method: POST
                          URL: http://localhost:8083/jsonrpc/v1
                          Header: application/json
                          Body: {
                                    "jsonrpc": '2.0',
                                    "method": 'unassociateAccount',
                                    "params": [unassociate_edgeToken]
                                }
                        

Attention: You can obtain the unassociate_edgeToken via OAuth Tool at Here.

updateGps(edgeToken, longitude, latitude, altitude, speed, bearing)

Type: <function>

  • edgeToken

    Type: <string>

  • longitude

    Type: <string>(unit: decimal)

  • latitude

    Type: <string>(unit: decimal)

  • speed

    Type: <string>(unit: m/s)

  • bearing

    Type: <string>(unit: degree)

Return Object: <Status>

Description: This function gives edgeSDK and mimik edgeSDK discovery service record the location of device.

HTTP Request:


                      Method: POST
                      URL: http://localhost:8083/jsonrpc/v1
                      Header: application/json
                      Body: {
                                "jsonrpc": '2.0',
                                "method": 'updateGps',
                                "params": [edgeToken, longitude, latitude, altitude, speed, bearing]
                            }
                    


Return Objects


Me

me.nodeId

Type: <string>

Description: The node ID given to device running the edgeSDK.

me.accountId

Type: <string>

Description: The account ID that is currently being associated to this instance of edgeSDK. Empty if no account is associated.

me.name

Type: <string>

Description: The name of the device that is currently used to identify the device running edgeSDK.

me.version

Type: <string>

Description: The version of the edgeSDK.


Token

token.id_token

Type: <string>

Description: The ID token.


Account

account.accountId

Type: <string>

Description: The account ID.


Status

status.id

Type: <integer>

Description: The JSONRPC call ID.

status.jsonrpc

Type: <string>

Description: The JSONRPC API version.

status.result.status

Type: <string>

Description: The JSONRPC request status, 'ok' means successfully updated.