API

REST API

API endpoints require basic authentication with user that has “rest” role.

Test suites

API endpoint: /api/v1/testsuites
Type: POST
Description: Returns test suite info with results
Parameters: names
Example body:

{"names": ["crm", "rfam"]}

Result:

[
    {
        "id": 4,
        "name": "CRM",
        "owner": "John",
        "lastExecBy": "System",
        "execTime": "2022-01-21 09:00:28",
        "execEndTime": "2022-01-21 09:01:39",
        "duration": "71",
        "nextExecutionTime": "2022-01-22 09:00:00",
        "schedule": "Daily / 09:00",
        "passed": 217,
        "failed": 24,
        "error": 29,
        "notExecuted": 0,
        "testCount": 270
    },
    {
        "id": 5,
        "name": "Rfam",
        "owner": "John",
        "lastExecBy": "System",
        "execTime": "2022-01-21 09:40:30",
        "execEndTime": "2022-01-21 09:43:33",
        "duration": "183",
        "nextExecutionTime": "2022-01-22 04:00:00",
        "schedule": "Daily / 04:00",
        "passed": 101,
        "failed": 16,
        "error": 1,
        "notExecuted": 0,
        "testCount": 118
    }
]

Execute

API endpoint: /api/v1/testsuites/execute
Type: POST
Description: Executes test suite and returns results
Parameters: name
Example body:

{"name": "bike_store"}

Result:

{
    "id": 10,
    "name": "Bike_store",
    "owner": "admin",
    "lastExecBy": "REST",
    "execTime": "2022-01-21 10:42:26",
    "execEndTime": "2022-01-21 10:42:26",
    "duration": "0",
    "nextExecutionTime": "2022-01-21 16:21:00",
    "schedule": "Daily / 16:21",
    "passed": 37,
    "failed": 0,
    "error": 0,
    "notExecuted": 0,
    "testCount": 37
}

All

API endpoint: /api/v1/testsuites/all
Type: GET
Description: Returns test suite info with results for all test suites
Parameters: none
Result:

[
    {
        "id": 27,
        "name": " Robot_tests",
        "owner": "admin",
        "lastExecBy": "admin",
        "execTime": "2021-12-13 19:04:35",
        "execEndTime": "2021-12-13 19:04:36",
        "duration": "1",
        "nextExecutionTime": "2022-01-21 12:00:00",
        "schedule": "Workdays / 12:00",
        "passed": 16,
        "failed": 0,
        "error": 1,
        "notExecuted": 0,
        "testCount": 17
    },
    {
        "id": 18,
        "name": " Ticket_sales",
        "owner": "admin",
        "lastExecBy": "admin",
        "execTime": "2022-01-21 09:55:05",
        "execEndTime": "2022-01-21 09:55:07",
        "duration": "2",
        "nextExecutionTime": "",
        "schedule": "",
        "passed": 16,
        "failed": 1,
        "error": 0,
        "notExecuted": 0,
        "testCount": 17
    },
  ...
]

Public

API endpoint: /api/v1/testsuites/public
Type: GET
Description: Returns test suite info with results for public test suites
Parameters: none
Result:

[
    {
        "id": 27,
        "name": " Robot_tests",
        "owner": "admin",
        "lastExecBy": "admin",
        "execTime": "2021-12-13 19:04:35",
        "execEndTime": "2021-12-13 19:04:36",
        "duration": "1",
        "nextExecutionTime": "2022-01-21 12:00:00",
        "schedule": "Workdays / 12:00",
        "passed": 16,
        "failed": 0,
        "error": 1,
        "notExecuted": 0,
        "testCount": 17
    },
    {
        "id": 9,
        "name": "Classic_models",
        "owner": "admin",
        "lastExecBy": "System",
        "execTime": "2022-01-21 09:39:30",
        "execEndTime": "2022-01-21 09:40:14",
        "duration": "44",
        "nextExecutionTime": "2022-01-22 00:40:14",
        "schedule": "Every 900 minutes",
        "passed": 29,
        "failed": 4,
        "error": 0,
        "notExecuted": 0,
        "testCount": 33
    },
  ...
]

User

API endpoint: /api/v1/testsuites/user
Type: POST
Description: Returns test suite info with results for users test suites
Parameters: names
Example body:

{"names": ["admin", "John"]}

Result:

[
    {
        "id": 27,
        "name": " Robot_tests",
        "owner": "admin",
        "lastExecBy": "admin",
        "execTime": "2021-12-13 19:04:35",
        "execEndTime": "2021-12-13 19:04:36",
        "duration": "1",
        "nextExecutionTime": "2022-01-21 12:00:00",
        "schedule": "Workdays / 12:00",
        "passed": 16,
        "failed": 0,
        "error": 1,
        "notExecuted": 0,
        "testCount": 17
    },
    {
        "id": 18,
        "name": " Ticket_sales",
        "owner": "admin",
        "lastExecBy": "admin",
        "execTime": "2022-01-21 09:55:05",
        "execEndTime": "2022-01-21 09:55:07",
        "duration": "2",
        "nextExecutionTime": "",
        "schedule": "",
        "passed": 16,
        "failed": 1,
        "error": 0,
        "notExecuted": 0,
        "testCount": 17
    },
  ...
]

Tag

API endpoint: /api/v1/testsuites/tag
Type: POST
Description: Returns test suite info with results for tag(s)
Parameters: names
Example body:

{"names": ["live", "aws"]}

Result:

[
    {
        "id": 10,
        "name": "Bike_store",
        "owner": "admin",
        "lastExecBy": "REST",
        "execTime": "2022-01-21 10:42:26",
        "execEndTime": "2022-01-21 10:42:26",
        "duration": "0",
        "nextExecutionTime": "2022-01-21 16:21:00",
        "schedule": "Daily / 16:21",
        "passed": 37,
        "failed": 0,
        "error": 0,
        "notExecuted": 0,
        "testCount": 37
    },
    {
        "id": 11,
        "name": "Music_data",
        "owner": "John",
        "lastExecBy": "System",
        "execTime": "2022-01-17 12:02:26",
        "execEndTime": "2022-01-17 12:02:35",
        "duration": "9",
        "nextExecutionTime": "2022-01-24 10:00:00",
        "schedule": "Mondays / 10:00",
        "passed": 107,
        "failed": 24,
        "error": 26,
        "notExecuted": 0,
        "testCount": 157
    },
  ...
]

Test cases

Test suite

API endpoint: /api/v1/testcases/testsuite
Type: POST
Description: Returns test cases for test suite(s)
Parameters: names
Example body:

{"names": ["covid", "rfam"]}

Result:

[
    {
        "testSuiteName": "Covid",
        "connectionName": "Covid endpoint",
        "description": "Covid infections in Estonia",
        "sql": "SELECT Confirmed FROM <object> WHERE date > current_date-1\n",
        "expectedResult": ">0",
        "lastResult": "271500.0",
        "lastExecution": "2022-01-20 12:00:47",
        "status": "nok",
        "executedBy": "System",
        "owner": "John",
        "type": "Query"
    },
    {
        "testSuiteName": "Rfam",
        "connectionName": "Rfam_public",
        "description": "Rfam._annotated_file - Count of rows",
        "sql": "SELECT COUNT(*) FROM Rfam._annotated_file",
        "expectedResult": ">0",
        "lastResult": "4074",
        "lastExecution": "2022-01-21 09:40:31",
        "status": "ok",
        "executedBy": "System",
        "owner": "John",
        "type": "Query"
    },
    {
        "testSuiteName": "Rfam",
        "connectionName": "Rfam_public",
        "description": "Rfam._annotated_file - Full duplicates",
        "sql": "SELECT COUNT(*) FROM (SELECT rfam_acc,seed,cm,full FROM Rfam._annotated_file GROUP BY rfam_acc,seed,cm,full HAVING COUNT(*)>1) a",
        "expectedResult": "=0",
        "lastResult": "0",
        "lastExecution": "2022-01-21 09:40:31",
        "status": "ok",
        "executedBy": "System",
        "owner": "John",
        "type": "Query"
    },
  ...
]

Execute

API endpoint: /api/v1/testcases/execute
Type: POST
Description: Executes selected test(s) and returns result(s)
Parameters: test filters
Example body:

{
    "testIds": [24, 52, 67],
    "descriptionFilters": ["price"],
    "sqlFilters": ["price_usd"],
    "connectionFilters": ["crypto"],
    "testsuiteFilters": ["Crypto"],
  	"labelFilters": ["label1", "label2"],
  	"variables": {
      "variable_name_1": "variable_value_1",
      "variable_name_2": "variable_value_2"
    }
}

Result:

{
    "count": 3,
    "results": [
        {
            "testSuiteName": "Crypto",
            "connectionName": "Crypto",
            "description": " BitCoin price test",
            "sql": "SELECT price_usd FROM API.object WHERE id = 33422 ",
            "expectedResult": ">0",
            "lastResult": "22440.88",
            "lastExecution": "2023-03-05 15:01:22",
            "status": "ok",
            "executedBy": "John",
            "owner": "John",
            "info": "g",
            "type": "Query"
        },
        {
            "testSuiteName": "Crypto",
            "connectionName": "Crypto",
            "description": " Dogecoin price test",
            "sql": "SELECT price_usd FROM API.object WHERE id = 2 ",
            "expectedResult": ">0",
            "lastResult": "0.076033",
            "lastExecution": "2023-03-05 15:01:22",
            "status": "ok",
            "executedBy": "John",
            "owner": "John",
            "type": "Query"
        },
      ...
   ]
}

Search

API endpoint: /api/v1/testcases/search
Type: POST
Description: Returns selected test(s) result(s)
Parameters: test filters
Example body:

{
    "testIds": [24, 52, 67],
    "descriptionFilters": ["price"],
    "sqlFilters": ["price_usd"],
    "connectionFilters": ["crypto"],
    "testsuiteFilters": ["Crypto"]
}

Result:

{
    "count": 3,
    "results": [
        {
            "testSuiteName": "Crypto",
            "connectionName": "Crypto",
            "description": " BitCoin price test",
            "sql": "SELECT price_usd FROM API.object WHERE id = 33422 ",
            "expectedResult": ">0",
            "lastResult": "22440.88",
            "lastExecution": "2023-03-05 15:01:22",
            "status": "ok",
            "executedBy": "John",
            "owner": "John",
            "info": "g",
            "type": "Query"
        },
        {
            "testSuiteName": "Crypto",
            "connectionName": "Crypto",
            "description": " Dogecoin price test",
            "sql": "SELECT price_usd FROM API.object WHERE id = 2 ",
            "expectedResult": ">0",
            "lastResult": "0.076033",
            "lastExecution": "2023-03-05 15:01:22",
            "status": "ok",
            "executedBy": "John",
            "owner": "John",
            "type": "Query"
        },
      ...
   ]
}

Profiling

Execute

API endpoint: /api/v1/profiling/execute
Type: POST
Description: Executes profiling objects and returns results
Parameters: objects
Example body:

{"objects": 
 [
   {"object":"rfam.family", "connection": "rfam_public"}, 
   {"object":"rfam.version", "connection": "rfam_public"}
 ]
}

Result:

[
    {
        "connectionName": "Rfam_public",
        "schemaName": "Rfam",
        "objectName": "family",
        "lastExecuted": "2022-01-21 10:48:39",
        "nextExecution": "2022-01-22 10:00:00",
        "schedule": "Daily / 10:00",
        "filter": "author is not null",
        "allowedErrors": 0,
        "columns": [
            {
                "columnName": "author",
                "dataType": "tinytext",
                "rules": [
                    {
                        "ruleDescription": "Count of NULLs",
                        "lastResult": "0",
                        "previousResult": "0",
                        "status": "ok",
                        "lastExecuted": "2022-01-21 10:48:35",
                        "threshold": 0.0
                    },
                    {
                        "ruleDescription": "Count of unique values",
                        "lastResult": "140",
                        "previousResult": "140",
                        "status": "ok",
                        "lastExecuted": "2022-01-21 10:48:38",
                        "threshold": 5.0
                    }
                ],
                "values": [
                    {
                        "columnValue": "Griffiths-Jones SR",
                        "valueCount": 1301,
                        "status": "ok"
                    },
                    {
                        "columnValue": "Eberhardt R",
                        "valueCount": 513,
                        "status": "ok"
                    },
                  ...
]

Objects

API endpoint: /api/v1/profiling/objects
Type: POST
Description: Returns profiling object results
Parameters: objects
Example body:

{"objects": 
 [
   {"object":"rfam.family", "connection": "rfam_public"}, 
   {"object":"rfam.version", "connection": "rfam_public"}
 ]
}

Result:

[
    {
        "connectionName": "Rfam_public",
        "schemaName": "Rfam",
        "objectName": "family",
        "lastExecuted": "2022-01-21 10:48:39",
        "nextExecution": "2022-01-22 10:00:00",
        "schedule": "Daily / 10:00",
        "filter": "author is not null",
        "allowedErrors": 0,
        "columns": [
            {
                "columnName": "author",
                "dataType": "tinytext",
                "rules": [
                    {
                        "ruleDescription": "Count of NULLs",
                        "lastResult": "0",
                        "previousResult": "0",
                        "status": "ok",
                        "lastExecuted": "2022-01-21 10:48:35",
                        "threshold": 0.0
                    },
                    {
                        "ruleDescription": "Count of unique values",
                        "lastResult": "140",
                        "previousResult": "140",
                        "status": "ok",
                        "lastExecuted": "2022-01-21 10:48:38",
                        "threshold": 5.0
                    }
                ],
                "values": [
                    {
                        "columnValue": "Griffiths-Jones SR",
                        "valueCount": 1301,
                        "status": "ok"
                    },
                    {
                        "columnValue": "Eberhardt R",
                        "valueCount": 513,
                        "status": "ok"
                    },
                  ...
]

Connections

Status

API endpoint: /api/v1/connections/status
Type: GET
Description: Returns connection info and status for all connections
Parameters: none
Result:

[
    {
        "connectionName": "Crypto",
        "connectionType": "rest",
        "connected": true,
        "connectionUrl": "https://api.coinlore.net/api/tickers/?start=1&limit=1000"
    },
    {
        "connectionName": "Genome_public",
        "connectionType": "mariadb",
        "connected": true,
        "connectionUrl": "jdbc:mariadb://genome-euro-mysql.soe.ucsc.edu:3306/hgcentral"
    },
    {
        "connectionName": "RNAcentral_public",
        "connectionType": "postgresql",
        "connected": true,
        "connectionUrl": "jdbc:postgresql://hh-pgsql-public.ebi.ac.uk:5432/pfmegrnargs"
    },
    {
        "connectionName": "Rfam_public",
        "connectionType": "mysql",
        "connected": true,
        "connectionUrl": "jdbc:mysql://mysql-rfam-public.ebi.ac.uk:4497/Rfam"
    },
    {
        "connectionName": "SAPIQ",
        "connectionType": "sapiq",
        "connected": false,
        "connectionUrl": "jdbc:sybase:Tds:dev.litech.app:2638?ServiceName=dba"
    },
  ...
]

Executions

Current

API endpoint: /api/v1/executions/current
Type: GET
Description: Returns all currently running executions
Parameters: none
Result:

[
    {
        "user": "admin",
        "executedTests": "68",
        "totalTests": "211",
        "progress": "68/211",
        "executionName": "Rfam.family"
    },
    {
        "user": "System",
        "executedTests": "51",
        "totalTests": "270",
        "progress": "51/270",
        "executionName": "RNAcentral"
    }
]

Scheduled

API endpoint: /api/v1/executions/scheduled
Type: GET
Description: Returns info about scheduled executions
Parameters: none
Result:

[
    {
        "executionName": "RNAcentral",
        "nextExecutionTime": "2022-01-21 09:00:00",
        "timeLeft": "In queue",
        "schedule": "Daily / 09:00",
        "currentTime": "2022-01-21 10:31:56",
        "type": "ts"
    },
    {
        "executionName": "Rfam.full_region",
        "nextExecutionTime": "2022-01-21 11:00:00",
        "timeLeft": "0h 28m 03s",
        "schedule": "Daily / 11:00",
        "currentTime": "2022-01-21 10:31:56",
        "type": "object"
    },
    {
        "executionName": "Crypto",
        "nextExecutionTime": "2022-01-21 11:19:31",
        "timeLeft": "0h 47m 34s",
        "schedule": "Every 100 minutes",
        "currentTime": "2022-01-21 10:31:56",
        "type": "ts"
    }
]

Users

NB! Users endpoint requires extra ‘admin’ role in addition to ‘rest’ role

All

API endpoint: /api/v1/users
Type: GET
Description: Returns application’s users
Parameters: none

Result:

[
	{
		"id": 123,
		"username": "John",
		"admin": false,
		"role": [
			"analyst"
		],
		"privileges": [
			"allowToExecute"
		],
		"lastActive": "2023-06-22 10:02:35"
	},
  	...
]

Add

API endpoint: /api/v1/users/add
Type: POST
Description: Add user
Parameters: user details
Example body:

{
  	"userName": "David",
  	"displayName": "David Rockstone",
  	"password": "secretPassword",
  	"roles": ["analyst"]
}

Result:

{
	"id": 13,
	"username": "David",
	"admin": false,
	"role": [
		"analyst"
	],
	"privileges": [
		"allowToExecute"
	],
	"lastActive": null
}

Delete

API endpoint: /api/v1/users/delete
Type: POST
Description: Delete user
Parameters: user details
Example body:

{
  	"userName": "David"
}

Result: none

Roles

API endpoint: /api/v1/users/roles
Type: GET
Description: Get all available user roles
Parameters: none

Result:

[
	{
		"roleId": 14,
		"roleName": "Rest Analyst",
		"allowedConnections": [
			"Live DWH"
		],
		"privileges": [
			"addEditTestsuites",
			"addEditTestCases"
		]
	},
	{
		"roleId": 20,
		"roleName": "executor",
		"allowedConnections": [
        	"Crypto",
          	"Live DWH"
        ],
		"privileges": [
			"allowToExecute",
			"addEditTestCases"
		]
	},
  	...
]

Assign roles

API endpoint: /api/v1/users/roles/assign
Type: POST
Description: Assign role(s) to user
Parameters: user details
Example body:

{
	"userName": "David",
	"roles": ["user", "exporter"]
}

Result:

{
	"id": 49,
	"username": "David",
	"admin": false,
	"role": [
		"user",
		"exporter"
	],
	"privileges": [
		"addEditConnections",
		"addEditDirectories",
		"addEditProfilingObjects",
		"addEditProfilingRules",
		"addEditRules",
		"addEditTestCases",
		"addEditTestsuites",
		"allowExport",
		"allowToExecute"
	],
	"lastActive": "2023-06-21 11:19:09"
}

Import

API endpoint: /api/v1/import
Type: POST
Description: Import endpoint for any JSON objects that are previously exported from DQM
Parameters: Either singular JSON import object or JSON array of objects
Example body:

[
    {
        "entityType": "TEST_CASE",
        "entity": {
            "id": "fd523557-118e-4356-81e9-432ed462d50c",
            "connectionRef": "11d6f2ee-424b-4e64-abcb-f95902496b4a",
            "testsuiteRef": "d2f2d729-721c-4e6e-b5ab-4dad679cb561",
            "description": "public.addresses - Count of rows",
            "sql": "SELECT COUNT(*) FROM public.addresses",
            "expectedResult": ">0",
            "type": "Query",
            "owner": "David",
            "dynamicRuleRef": "eaf2f027-88fe-4258-9804-b50645ff5eb7",
            "autoUpdate": false,
            "disabled": true,
            "relations": {
                "columns": [],
                "schema": "public",
                "object": "addresses"
            },
            "labels": ["LIVE"]
        }
    },
    {
        "entityType": "TEST_CASE",
        "entity": {
            "id": "1e5d783a-dd41-4712-b083-0d5e9a3dc9d8",
            "connectionRef": "11d6f2ee-424b-4e64-abcb-f95902496b4a",
            "testsuiteRef": "d2f2d729-721c-4e6e-b5ab-4dad679cb561",
            "description": "public.addresses - Duplicates",
            "sql": "SELECT COUNT(*) FROM (SELECT \"language\",\"suite\" FROM public.addresses GROUP BY \"language\",\"suite\" HAVING COUNT(*)>1) a",
            "expectedResult": "=0",
            "type": "Query",
            "owner": "David",
            "dynamicRuleRef": "86f004bc-757f-480e-bf20-19a1f161cd5f",
            "autoUpdate": false,
            "disabled": false,
            "relations": {
                "columns": [
                    "language",
                    "suite"
                ],
                "schema": "public",
                "object": "addresses"
            },
            "labels": []
        }
    }
]

Result:

{
	"type": "TEST_CASE",
	"created": 2,
	"updated": 0,
	"failed": 0,
	"total": 2
}

Delete

API endpoint: /api/v1/delete
Type: POST
Description: Delete any imported entity by the reference id
Parameters: List of reference UUIDs to delete
Example body:

{
	"ids": ["3244945c-c777-4fc8-9b63-cf1501011bf3"]
}

Result:

{
	"deleted": 1,
	"failed": 0,
	"total": 1,
	"errors": []
}