EII Msgbus/gRPC Request-Response Endpoints

Path

Description

read

Return Data from database based on query/blob request.

write

Write Data to database based on the request. Returns statuscode and err(if any).

update

Update Data in database based on the time field(Applicable only for Metadata). Returns statuscode and err(if any)

list

List api returns the list of measurement/table/bucket names in the respective database based on request

delete

Delete api Deletes all the data and measurement/table/bucket in the respective database based on request

read

Return Data from database based on query/blob request or err if any.

Request

{
  "command": "read",
  "payload": {
    "topic": "edge_video_analytics_results",
    "query": "select * from edge_video_analytics_results",
    "blob": {
      "key": "img_handle"
    }
  }
}

Request Fields

  • command: (Required/String) provide type of command for Zmq/gRPC Req-Resp server. Supported commands: read, write, update, list, delete.

  • payload: (Required/JSON Object)

    • topic: (Required/String) Should contain name of measurement/table/bucket on which operation to be performed

    • query: (Optional/String) Should contain query for requesting data from Metadata Database (Can be empty if blob only request)

    • blob: (Optional/JSON Object) (Can be empty if meta only request)

      • key: (Required/String) Should contain Blob identifier(if single read request), Key from Metadata whose values will be used as blob identifier(if bulk read based on metadata response)

Note

: Either of one query/blob should be filled in case of Single read.

Response

{
  "statuscode": 0,
  "response": {
    "metadata": "[{\"img_handle\":\"test_handle\",\"encoding_type\":\"jpeg\",\"encoding_level\":251,\"annotation\":\"test_data\",\"time\":\"1685090211099234630\"}]",
    "blobdata": ["ssadgfsbdsbasbdsadbgsadfds==/Qa"]
  },
  "err": ""
}

Responses Fields

  • statuscode: (Integer) Status Code of Request. Refer Status Codes & Descriptions for details

  • response: (JSON Object)

    • metadata: (Array of JSON Object as String) Based on the request, if meta data is requested this will be filled. Will be Empty string if not requested for metadata/no data for given query

    • blobdata: (Array of bytearray) Based on the request, if meta data is requested this will be filled. Will be Bulk data only if requested for both. Will be Empty array if not requested for blob.

  • err: (String) Error Message in Detail. Will be Empty string if no error

Example Request: Read - Meta only (Bulk Response based on query)

{
  "command": "read",
  "payload": {
    "topic": "edge_video_analytics_results",
    "query": "select * from edge_video_analytics_results"
  }
}

Example Request: Read - Blob only (Single Read Request)

{
  "command": "read",
  "payload": {
    "topic": "edge_video_analytics_results",
     "blob": {
      "key": "blob_identifier"
    }
  }
}

Example Request: Read - Both (Bulk Response based on query, and blob for each row)

{
  "command": "read",
  "payload": {
    "topic": "edge_video_analytics_results",
    "query": "select * from edge_video_analytics_results",
    "blob": {
      "key": "img_handle"
    }
  }
}

write

Write Data to database based on the request. Returns statuscode and err(if any)

Request

{
  "command": "write",
  "payload": {
    "topic": "sample_topic",
    "metadata": {
      "img_handle": "c229634589",
      "encoding_type": "jpeg",
      "encoding_level": 25
    },
    "blob": {
      "key": "sample_image",
      "data": [<bytearray of blob>]
    }
  }
}

Request Fields

  • command: (Required/String) provide type of command for Zmq/gRPC Req-Resp server. Supported commands: read, write, update, list, delete.

  • payload: (Required/JSON Object)

    • topic: (Required/String) Should contain name of measurement/table/bucket on which operation to be performed

    • metadata: (Optional/JSON Object) Filled if meta data to be inserted. Should Contains the Key value pair of JSON meta data with Key as column name and values as column value. (Can be NULL if blob only request)

    • blob: (Optional/JSON Object) (Can be empty if meta only request)

      • key: (Required/String) Blob identifier to be stored in blob DB

      • data: (Required/Array of bytearray) Blob data of the corresponding blob identifier(key). Only 0th position will be considered.

Note

: Either of one metadata/blob should be filled in case of Single write. Data type of Columns should be maintained in case of meta data else, it will be created as new columns

Response

{
  "statuscode": 0,
  "response": {
    "metadata": "",
    "blobdata": []
  },
  "err": ""
}

Responses Fields

  • statuscode: (Integer) Status Code of Request. Refer Status Codes & Descriptions for details

  • response: (JSON Object)

    • metadata: (Array of JSON Object as String) Will be empty string.

    • blobdata: (Array of bytearray) Will be empty array

  • err: (String) Error Message in Detail. Will be Empty string if no error

Example Request: write - Meta only (Single Row write Request)

{
  "command": "write",
  "payload": {
    "topic": "sample_topic",
    "metadata": {
      "img_handle": "c229634589",
      "encoding_type": "jpeg",
      "encoding_level": 25
    }
  }
}

Example Request: write - Blob only (Single Blob write Request)

{
  "command": "write",
  "payload": {
    "topic": "sample_topic",
    "blob": {
      "key": "sample_image",
      "data": [<bytearray of blob>]
    }
  }
}

Example Request: write - Both (Single Meta & Blob write Request)

{
  "command": "write",
  "payload": {
    "topic": "sample_topic",
    "metadata": {
      "img_handle": "c229634589",
      "encoding_type": "jpeg",
      "encoding_level": 25
    },
    "blob": {
      "key": "sample_image",
      "data": [<bytearray of blob>]
    }
  }
}

update

Update Data in database based on the time field(Applicable only for Metadata). Returns statuscode and err(if any)

Request:

{
  "command": "update",
  "payload": {
    "topic": "sample_topic",
    "metadata": {
      "img_handle": "c229634589",
      "encoding_type": "jpeg",
      "encoding_level": 25,
      "time": "1685090211099234630"
    }
  }
}

Request Fields

  • command: (Required/String) provide type of command for Zmq/gRPC Req-Resp server. Supported commands: read, write, update, list, delete.

  • payload: (Required/JSON Object)

    • topic: (Required/String) Should contain name of measurement/table/bucket on which operation to be performed

    • metadata: (Required/JSON Object) Filled if meta data to be inserted. Should Contains the Key value pair of JSON meta data with Key as column name and values as column value.

Note

: Data type of Columns should be maintained in case of meta data else, it will be created as new columns. Time should in string format.

Response

{
  "statuscode": 0,
  "response": {
    "metadata": "",
    "blobdata": []
  },
  "err": ""
}

Responses Fields

  • statuscode: (Integer) Status Code of Request. Refer Status Codes & Descriptions for details

  • response: (JSON Object)

    • metadata: (Array of JSON Object as String) Will be empty string.

    • blobdata: (Array of bytearray) Will be empty array

  • err: (String) Error Message in Detail. Will be Empty string if no error

Example Request: update - Meta only (Single Meta Update Request)

{
  "command": "update",
  "payload": {
    "topic": "sample_topic",
    "metadata": {
      "img_handle": "c229634589",
      "encoding_type": "jpeg",
      "encoding_level": 25,
      "time": "1685090211099234630"
    }
  }
}

list

List api returns the list of measurement/table/bucket names in the respective database based on request

Request

{
  "command": "list",
  "payload": "both"
}

Request Fields

  • command: (Required/String) provide type of command for Zmq/gRPC Req-Resp server. Supported commands: read, write, update, list, delete.

  • payload: (Required/String) Option to select which database to list the topic. Options are meta, blob and both

Response

{
  "statuscode": 0,
  "response": {
    "metadata": "[\"sample_topic1\",\"sample_topic2\"]",
    "blobdata": ["sample_topic1","sample_topic2"]
  },
  "err": ""
}

Responses Fields

  • statuscode: (Integer) Status Code of Request. Refer Status Codes & Descriptions for details

  • response: (JSON Object)

    • metadata: (Array of string as String) List of measurement/table name of meta database

    • blobdata: (Array of string) List of bucket name of blob database

  • err: (String) Error Message in Detail. Will be Empty string if no error

Example Request: list - Meta only

{
  "command": "list",
  "payload": "meta"
}

Example Request: list - Blob only

{
  "command": "list",
  "payload": "blob"
}

Example Request: list - Both

{
  "command": "list",
  "payload": "both"
}

delete

Delete api Deletes all the data and measurement/table/bucket in the respective database based on request

Request

{
  "command": "delete",
  "payload": {
    "dbType": "both",
    "topic": "edge_video_analytics_results"
  }
}

Request Fields

  • command: (Required/String) provide type of command for Zmq/gRPC Req-Resp server. Supported commands: read, write, update, list, delete.

  • payload: (Required/JSON Object)

    • topic: (Required/String) Should contain name of measurement/table/bucket on which operation to be performed

    • dbType: (Required/String) Option to select which database to perform delete operation. Options are meta, blob and both

Response

{
  "statuscode": 0,
  "response": {
    "metadata": "",
    "blobdata": []
  },
  "err": ""
}

Responses Fields

  • statuscode: (Integer) Status Code of Request. Refer Status Codes & Descriptions for details

  • response: (JSON Object)

    • metadata: (Array of JSON Object as String) Based on the request, if meta data is requested this will be filled. Will be Empty string if not requested for metadata/no data for given query

    • blobdata: (Array of bytearray) Based on the request, if meta data is requested this will be filled. Will be Bulk data only if requested for both. Will be Empty array if not requested for blob.

  • err: (String) Error Message in Detail. Will be Empty string if no error

Note

: Deleting the blob data might send an error when EVAM ingestion is active.

Example Request: delete - Meta only

{
  "command": "delete",
  "payload": {
    "dbType": "meta",
    "topic": "edge_video_analytics_results"
  }
}

Example Request: delete - Blob only

{
  "command": "delete",
  "payload": {
    "dbType": "blob",
    "topic": "edge_video_analytics_results"
  }
}

Example Request: delete - Both

{
  "command": "delete",
  "payload": {
    "dbType": "both",
    "topic": "edge_video_analytics_results"
  }
}

Status Codes

Description

StatusCode

Success

0

Fail

1

API Generic Failure

2

DB Handler Api Failure

3

Factory Interface API Failure

4

JSON Packing/Unpacking Failure

5