This documentation supports an earlier version of BMC Helix Operations Management. Use the Product version picker to select and view the latest version of documentation.

Managing data tables in dynamic enrichment policies with REST APIs

The following section provides a list of supported endpoints and an overview about running these endpoints. Before you run an endpoint, you must authenticate yourself. For more information, see  Access and authentication for the REST API Open link
 


Managing data tables from the external source file

You can create, update, delete, and retrieve details of data tables by running APIs.

POST /data_tables
Request URL
https://<tenant-url>/events-service/api/v1.0/data_tables
Example request URL
 https://HostA.bmc.com/events-service/api/v1.0/data_tables
Request Header
Content-Type: application/json
Authorization: Bearer <JWT_token>

For instructions on obtaining the JWT token, see Access and authentication for the REST API. Open link .

Parameter details


Parameter NameValue TypeLocated InMandatoryDescription
tagStringBodyYesReference for the data table.
contentStringBodyYesRows in the data table from the external source file.

Request body

{
  "tag": "String",
  "content": "String"
}

Example request body

{
  "tag": "Import label",
  "content": "OPEN,CRITICAL,printer1,PRINTER_1_STATUS_REQUIRES_ACTION,HIGH\nASSIGNED,MAJOR,printer1,PRINTER_4_STATUS_REQUIRES_ACTION,LOWEST\nOPEN,MINOR,printer2,PRINTER_3_STATUS_REQUIRES_ACTION,LOW"
}


Successful response

{
  "message": "[Successfully created data table.]",
  "object": {
    "id": "[68f1c644-3594-11ec-9a65-3515b2f79aad]"
  }
}

id is the ID of the data table that you can use to associate a data table to an event policy.

To learn how to create a dynamic enrichment policy and associate it with a data table, see the POST /event_policies endpoint on the Managing event policies with REST APIs page.

Unsuccessful responses

Scenario 1: You specify an incorrect name for the request parameter.

[
  {
    "key": "validation.schema.additionalProperties",
    "level": "ERROR",
    "message": "Object instance has properties which are not allowed by the schema: [\"test\"]",
    "additionalInfo": []
  },
  {
    "key": "validation.schema.required",
    "level": "ERROR",
    "message": "Object has missing required properties ([\"content\"])",
    "additionalInfo": []
  }
]

Scenario 2: You specify an empty data table in the content parameter.

{
  "message": "Data table content cannot be empty.",
  "errorCode": "CONTENT_NOT_VALID"
}

Scenario 3: You do not specify comma-separated content for the data table.

{
  "message": "Content values should be comma separated.",
  "errorCode": "CONTENT_NOT_VALID"
}

Scenario 4: You specify different number of fields in each row of the data table.

{
  "message": "Number of fields at row number 2 are not equal to number of fields at row number 1.",
  "errorCode": "CONTENT_NOT_VALID"
}

Back to top

PUT /data_tables

Important

This API endpoint replaces the entire data table content. To append or remove rows from the data table, make the required changes on the entire data table content locally, and then use the updated content in the API request.

After you run this endpoint, make sure that you update the policy associated with the data table to bind the updated data table content. For example, to update the policy, you might consider updating the policy description. 



Request URL
https://<tenant-url>/events-service/api/v1.0/data_tables
Example request URL
 https://HostA.bmc.com/events-service/api/v1.0/data_tables
Request Header
Content-Type: application/json
Authorization: Bearer <JWT_token>

For instructions on obtaining the JWT token, see Access and authentication for the REST API. Open link .

Parameter details


Parameter NameValue TypeLocated InMandatoryDescription
tag
StringBodyYesReference for the data table.
content
StringBodyYesRows in the data table from the external source file.
id
StringBodyYesID of the data table.

Request body

{
  "tag": "String",
  "content": "String",
  "id": "String"
}

Example request body

{
  "tag": "Import label",
  "content": "CLOSED,CRITICAL,printer1,PRINTER_1_STATUS_REQUIRES_ACTION,HIGH\nASSIGNED,MAJOR,printer1,PRINTER_4_STATUS_REQUIRES_ACTION,LOWEST\nOPEN,MINOR,printer2,PRINTER_3_STATUS_REQUIRES_ACTION,LOW",
  "id": "c8f7af05-3594-11ec-9a65-f335c7198f8c"
}

Successful response

{
  "message": "[Successfully updated data table.]",
  "object": {
    "id": "[c8f7af05-3594-11ec-9a65-f335c7198f8c]"
  }
}

Unsuccessful responses

Scenario 1: You attempt to update a data table entry that does not exist.

{
  "message": "[Failed to update data table entry for tenant 1220296999, entry with same id does not exist.]",
  "errorCode": "DATA_TABLE_ENTRY_DOES_NOT_EXIST"
}

Scenario 2: You specify a short and invalid data table ID.

{
  "message": "[Failed to update data table entry db64.]",
  "errorCode": "INVALID_ID"
}

Scenario 3: You specify a long and invalid data table ID.

{
  "message": "[Failed to update data table entry c8f7af05-3594-11ec-9a65-f335c7198f8cftabcdfe.]",
  "errorCode": "INVALID_ID"
}

Scenario 4: You do not specify the content for the data table.

{
  "message": "Data table content cannot be empty.",
  "errorCode": "CONTENT_NOT_VALID"
}

Scenario 5: You do not specify comma-separated content for the data table.

{
  "message": "Content values should be comma separated.",
  "errorCode": "CONTENT_NOT_VALID"
}

Scenario 6: You specify different number of fields in each row of the data table.

{
  "message": "Number of fields at row number 2 are not equal to number of fields at row number 1.",
  "errorCode": "CONTENT_NOT_VALID"
}

Back to top

GET  /data_tables/id
Request URL
https://<tenant-url>/events-service/api/v1.0/data_tables/id
Example URL
https://HostA.bmc.com/events-service/api/v1.0/data_tables/c8f7af05-3594-11ec-9a65-f335c7198f8c
Request Header
Content-Type: application/json
Authorization: Bearer <JWT_token>

For instructions on obtaining the JWT token, see Access and authentication for the REST API. Open link .

Parameter details


Parameter NameValue TypeLocated InMandatoryDescription
id
StringPathYesID of the data table.

Successful response

{
  "message": "Data Table entry found.",
  "object": {
    "id": "c8f7af05-3594-11ec-9a65-f335c7198f8c",
    "tag": "Import Lable",
    "tenantId": "1360806657",
    "content": "OPEN,CRITICAL,printer1,PRINTER_1_STATUS_REQUIRES_ACTION,HIGH\nASSIGNED,MAJOR,printer1,PRINTER_4_STATUS_REQUIRES_ACTION,LOWEST\nOPEN,MINOR,printer2,PRINTER_3_STATUS_REQUIRES_ACTION,LOW"
  }
}

Unsuccessful response

Scenario 1: You specify a short and invalid data table ID.

{
  "message": "[Failed to get data table entry abcd3.]",
  "errorCode": "INVALID_ID"
}

Scenario 2: You specify a long and invalid data table ID.

{
  "message": "[Failed to get data table entry c8f7af05-3594-11ec-9a65-f335c7198f8cftabcdfe.]",
  "errorCode": "INVALID_ID"
}

Scenario 3: You specify a data table ID that does not exist.

{
  "message": "[Failed to get data table entry for tenant 1220296999, entry with same id does not exist.]",
  "errorCode": "DATA_TABLE_ENTRY_DOES_NOT_EXIST"
}

Back to top

DELETE  /data_tables/<id>
Request URL
 https://<tenant-url>/events-service/api/v1.0/data_tables/<id>
Example request URL
 https://HostA.bmc.com/events-service/api/v1.0/data_tables/c8f7af05-3594-11ec-9a65-f335c7198f8c
Request Header
Content-Type: application/json
Authorization: Bearer <JWT_token>

For instructions on obtaining the JWT token, see Access and authentication for the REST API. Open link .

Parameter details


NameValue TypeLocated InMandatoryDescription

id

StringPathYes

ID of the data table.

Successful responses

{
  "message": "Deleted data table entry 68f1c644-3594-11ec-9a65-3515b2f79aad."
}

Unsuccessful response

Scenario 1: You specify a data table ID that does not exist.

{
  "message": "[Failed to delete data table entry for tenant 1220296999, entry with same id does not exist.]",
  "errorCode": "DATA_TABLE_ENTRY_DOES_NOT_EXIST"
}

Scenario 2: You specify a long and invalid data table ID.

{
  "message": "[Failed to get data table entry c8f7af05-3594-11ec-9a65-f335c7198f8cftabcdfe.]",
  "errorCode": "INVALID_ID"
}

Scenario 3: You specify a short and invalid data table ID.

{
  "message": "[Failed to get data table entry abcd.]",
  "errorCode": "INVALID_ID"
}

Back to top

POST /data_tables/search
Request URL
https://<tenant-url>/events-service/api/v1.0/data_tables/search
Example request URL
 https://HostA.bmc.com/events-service/api/v1.0/data_tables/search
Request Header
Content-Type: application/json
Authorization: Bearer <JWT_token>

For instructions on obtaining the JWT token, see Access and authentication for the REST API. Open link .

Parameter details


Parameter NameValue TypeLocated InMandatoryDescription
queryStringBodyNo

The conditions for searching data tables. You can specify the query conditions by using the following operators:

  • =
  • like (This operator can be used only on the tag column)
  • >
  • <
  • >=
  • <=

You can use a single column or a combination of the following columns to search data tables:

  • tag
  • modificationTime
  • creationTime
pageIndexIntegerBodyNo

The page index. The value for the index starts with 1. This parameter supports pagination.

For example, 

There are a total of 50 records and the records listed on the first page are 25. To view records on the next page, specify the pageIndex as 2.

recordsPerPageIntegerBodyNoThe number of search results on every page.
sortCriteriaStringBodyNo

The criteria to sort data tables. You can use a single column or a combination of the following columns to sort data tables:

  • tag
  • modificationTime
  • creationTime

Request body

{
  "query": "string",
  "pageIndex": "integer",
  "recordsPerPage": "integer",
  "sortCriteria": "string"
}

Example request body

{
  "query": "tag = 'test' and modificationTime >= 1628736628709 ",
  "pageIndex": 1,
  "recordsPerPage": 10,
  "sortCriteria": "tag desc"
}
{
  "pageIndex": 1,
  "recordsPerPage": 10
}
{
  "query": "tag like 'abcd%'",
  "pageIndex": 1,
  "recordsPerPage":10
}

Successful response

{
  "dataTables": [
    {
      "id": "bb093bd4-6182-11ec-959b-759bf10b5454",
      "tag": "abcd"
    },
    {
      "id": "be7153c5-6187-11ec-959b-55e7fe592d72",
      "tag": "abcd"
    }
  ],
  "totalRecords": 2
}

Unsuccessful responses

Scenario 1: You specify an invalid column name in the query search criteria.

[
  {
    "key": "400",
    "level": "ERROR",
    "message": "Invalid columnName id in search criteria.",
    "additionalInfo": []
  }
]

Scenario 2: You specify an invalid column name in the sort criteria.

[
  {
    "key": "400",
    "level": "ERROR",
    "message": "Invalid columnName id in sort criteria.",
    "additionalInfo": []
  }
]

Back to top

Was this page helpful? Yes No Submitting... Thank you

Comments