Create Query Definition

Create Query Definition

Creates a query definition

Request
URI
POST
https://{api_host}//vrlic/api/v1/query-definitions
COPY
Request Body
QueryDefinitionsDto of type(s) application/json
Required
{
    "name": "test_query_definition",
    "id": "789kl5b3c6-2434-457e-8fcb-b75abcceefa7",
    "queryId": "com.vmware.test_id",
    "source": "USER_DEFINED",
    "sourceName": "testing_source",
    "contentPackId": "et4671072-94a6-4106-8d20-c153896e91c5",
    "description": "Note: details about this query definition",
    "url": "http://kb.vmware.com/kb/778652729092us8",
    "constraints": {
        "operator": "AND",
        "fieldName": null,
        "value": null,
        "constraints": [
            {
                "operator": "EXISTS",
                "fieldName": "text",
                "value": "error",
                "constraints": [],
                "tags": []
            },
            {
                "operator": "EXISTS",
                "fieldName": "text",
                "value": "exception",
                "constraints": [],
                "tags": []
            },
            {
                "operator": "LESS_THAN",
                "fieldName": "build_number",
                "value": "7408",
                "constraints": [],
                "tags": []
            }
        ],
        "tags": []
    },
    "aggregationFunctions": [
        {
            "fieldName": "text",
            "functionName": "AVG"
        },
        {
            "fieldName": "text",
            "functionName": "MIN"
        },
        {
            "fieldName": "build_number",
            "functionName": "MAX"
        }
    ],
    "groupByTerms": [
        {
            "fieldName": "timestamp",
            "groupByType": "FIXED_BUCKET"
        }
    ],
    "fieldListItems": [
        {
            "name": "test_query_definition_name",
            "link": "com.vmware.test_link"
        }
    ],
    "relationFunctions": [
        {
            "relationName": "9876ed31-fe70-4c61-8db7-917a1a2636f1",
            "relationType": "LOGS"
        }
    ],
    "isSearchable": false,
    "isAnnotation": false,
    "createdBy": "test@gmail.com",
    "createdAt": "2023-05-09T21:25:15.934Z",
    "lastUpdatedBy": "test@gamil.com",
    "lastUpdatedAt": "2023-05-09T21:25:15.934Z",
    "widget": {
        "name": "test_widget",
        "widgetType": "CHART",
        "analysisFunctions": null,
        "visualization": {
            "type": "AREA",
            "options": {
                "logaxis": "false",
                "piestyle": "normal",
                "pielabelstyle": "legend",
                "piepercentage": "false"
            }
        },
        "filter": null
    },
    "alertSolrQuery": "SELECT AVG(text) as \"avg test_field\", MIN(text) as \"min test_field\", MAX(build_number) as \"max test_build\" FROM logs WHERE (text=exist() AND text=exist() AND text<7408)",
    "isFavorite": false,
    "entityTagAssociation": [
        {
            "tagId": "4c454315-e469-432b-a302-3e8eb0e10690",
            "tagName": "test_tag_1"
        },
        {
            "tagId": "7795d0ee-4d0b-496b-b48b-fc5b7c6f4e89",
            "tagName": "test_tag_2"
        }
    ],
    "documentSelfLink": "/vrlic/api/v1/query-definitions/789kl5b3c6-2434-457e-8fcb-b75abcceefa7"
}
string
name
Required

Query name. It should be unique

string
id
Optional

id

string
queryId
Optional

Query identifier. It should be unique

string
source
Optional

All allowed source of query: CONTENT_PACK, USER_DEFINED

Possible values are : CONTENT_PACK, USER_DEFINED,
string
sourceName
Optional

Name of the content pack that provided this query definition

string
contentPackId
Optional

Content pack id if this query belongs to any

string
description
Optional

Detailed description of Query definition

string
url
Optional

An URL that links to additional information. (Vmware KB article / other recommended approach for fixing issue)

constraints
Required

constraints

aggregationFunctions
Required

List of aggregate field and function name

groupByTerms
Optional

List of group by field name and type

fieldListItems
Optional

Field List Items

relationFunctions
Required

List of relation name and type. Allowed relation type includes: LOGS

boolean
isSearchable
Optional

Indicates whether the query should be displayed in search results

boolean
isAnnotation
Optional

Indicates whether the query should be used to annotate log messages

array of string
tenantLinks
Optional

List of tenant links

widget
Optional

widget

boolean
isFavorite
Optional

Is Query Favourite - used to identify if the query is favourite for a user.

entityTagAssociation
Optional

List of entity tag associated with this query

string
documentSelfLink
Optional

Indicates document self link

Authentication
This operation uses the following authentication methods.
Responses
200

OK

Returns QueryDefinitionsDto of type(s) */*
{
    "name": "test_query_definition",
    "id": "789kl5b3c6-2434-457e-8fcb-b75abcceefa7",
    "queryId": "com.vmware.test_id",
    "source": "USER_DEFINED",
    "sourceName": "testing_source",
    "contentPackId": "et4671072-94a6-4106-8d20-c153896e91c5",
    "description": "Note: details about this query definition",
    "url": "http://kb.vmware.com/kb/778652729092us8",
    "constraints": {
        "operator": "AND",
        "fieldName": null,
        "value": null,
        "constraints": [
            {
                "operator": "EXISTS",
                "fieldName": "text",
                "value": "error",
                "constraints": [],
                "tags": []
            },
            {
                "operator": "EXISTS",
                "fieldName": "text",
                "value": "exception",
                "constraints": [],
                "tags": []
            },
            {
                "operator": "LESS_THAN",
                "fieldName": "build_number",
                "value": "7408",
                "constraints": [],
                "tags": []
            }
        ],
        "tags": []
    },
    "aggregationFunctions": [
        {
            "fieldName": "text",
            "functionName": "AVG"
        },
        {
            "fieldName": "text",
            "functionName": "MIN"
        },
        {
            "fieldName": "build_number",
            "functionName": "MAX"
        }
    ],
    "groupByTerms": [
        {
            "fieldName": "timestamp",
            "groupByType": "FIXED_BUCKET"
        }
    ],
    "fieldListItems": [
        {
            "name": "test_query_definition_name",
            "link": "com.vmware.test_link"
        }
    ],
    "relationFunctions": [
        {
            "relationName": "9876ed31-fe70-4c61-8db7-917a1a2636f1",
            "relationType": "LOGS"
        }
    ],
    "isSearchable": false,
    "isAnnotation": false,
    "createdBy": "test@gmail.com",
    "createdAt": "2023-05-09T21:25:15.934Z",
    "lastUpdatedBy": "test@gamil.com",
    "lastUpdatedAt": "2023-05-09T21:25:15.934Z",
    "widget": {
        "name": "test_widget",
        "widgetType": "CHART",
        "analysisFunctions": null,
        "visualization": {
            "type": "AREA",
            "options": {
                "logaxis": "false",
                "piestyle": "normal",
                "pielabelstyle": "legend",
                "piepercentage": "false"
            }
        },
        "filter": null
    },
    "alertSolrQuery": "SELECT AVG(text) as \"avg test_field\", MIN(text) as \"min test_field\", MAX(build_number) as \"max test_build\" FROM logs WHERE (text=exist() AND text=exist() AND text<7408)",
    "isFavorite": false,
    "entityTagAssociation": [
        {
            "tagId": "4c454315-e469-432b-a302-3e8eb0e10690",
            "tagName": "test_tag_1"
        },
        {
            "tagId": "7795d0ee-4d0b-496b-b48b-fc5b7c6f4e89",
            "tagName": "test_tag_2"
        }
    ],
    "documentSelfLink": "/vrlic/api/v1/query-definitions/789kl5b3c6-2434-457e-8fcb-b75abcceefa7"
}
string
name
Required

Query name. It should be unique

string
id
Optional

id

string
queryId
Optional

Query identifier. It should be unique

string
source
Optional

All allowed source of query: CONTENT_PACK, USER_DEFINED

Possible values are : CONTENT_PACK, USER_DEFINED,
string
sourceName
Optional

Name of the content pack that provided this query definition

string
contentPackId
Optional

Content pack id if this query belongs to any

string
description
Optional

Detailed description of Query definition

string
url
Optional

An URL that links to additional information. (Vmware KB article / other recommended approach for fixing issue)

constraints
Required

constraints

aggregationFunctions
Required

List of aggregate field and function name

groupByTerms
Optional

List of group by field name and type

fieldListItems
Optional

Field List Items

relationFunctions
Required

List of relation name and type. Allowed relation type includes: LOGS

boolean
isSearchable
Optional

Indicates whether the query should be displayed in search results

boolean
isAnnotation
Optional

Indicates whether the query should be used to annotate log messages

array of string
tenantLinks
Optional

List of tenant links

widget
Optional

widget

boolean
isFavorite
Optional

Is Query Favourite - used to identify if the query is favourite for a user.

entityTagAssociation
Optional

List of entity tag associated with this query

string
documentSelfLink
Optional

Indicates document self link