REST API

QRebel provides a public API, allowing users to receive raw data for analysis and storage. The API is particularly useful when used from your CI server where automated tests are run. This setup allows you to inject QRebel performance regression detection into your existing CI/CD pipeline, so as to empower your test jobs with automated performance quality gates.


REST API authentication

Every QRebel project has a unique API token for authentication. This token is required for all API calls.

To acquire the project’s API token, an administrator needs to enable API functionality for the project from the Settings section. Once an API token has been generated for a project, you can choose to regenerate the token or disable API for the project.

../_images/token.png

The token is passed using the standard Authorization HTTP header.

GET https://hub.qrebel.com/api/applications/{appName}/issues/?targetBuild=build1
Authorization: {API token}

Queries

Note

API queries support only user-defined build names.

Here is an example of a complete API query:

GET https://hub.qrebel.com/api/applications/{appName}/issues/?targetVersion=2.0-SNAPSHOT&targetBuild=build2&baselineVersion=1.0&baselineBuild=build5&issues=DURATION,IO,EXCEPTIONS

The elements used in this query include:

  • https://hub.qrebel.com/api/applications/{appName}/issues/ – QRebel URL with the application title.
  • targetBuild={build} – target build for the query (required).
  • targetVersion={version} – target version for the query (optional).
  • baselineBuild={build} – baseline build for the comparison. When none is specified, the comparison of targetBuild is performed against the globally set static threshold.
  • baselineVersion={version} – baseline version for the comparison. (NB! baselineVersion cannot be specified without baselineBuild).
  • defaultBaseline – can be used when no baselineBuild is specified, see the next section.
  • issues=DURATION,IO,EXCEPTIONS – types of issues for the query. When none specified, all issue types are returned by default.
  • DURATION – returns slow request issues.
  • IO – returns excessive IO issues.
  • EXCEPTIONS – returns exception type issues.

Default baseline

You can define the default baseline build (with optional version) to be used for comparison. To set a default baseline, use the following API call:

PUT https://hub.qrebel.com/api/applications/{appName}/baselines/default/
JSON Payload:
{ "build": "build1" }
or
{ "build": "build1", "version": "1.0" }

A good candidate for the default baseline is the last build deployed to production.

To compare to the default baseline, use the defaultBaseline query parameter:

GET https://hub.qrebel.com/api/applications/{appName}/issues/?targetBuild=build2&defaultBaseline

Query examples

Complete query example:

GET https://hub.qrebel.com/api/applications/{appName}/issues/?targetBuild=build2&baselineBuild=build1&baselineVersion=1.0&issues=IO,DURATION,EXCEPTIONS

Build versus static threshold with all issue types (two equivalents):

GET https://hub.qrebel.com/api/applications/{appName}/issues/?targetBuild=build1
GET https://hub.qrebel.com/api/applications/{appName}/issues/?targetBuild=build1&baselineBuild=build1

Exceptions only:

GET https://hub.qrebel.com/api/applications/{appName}/issues/?targetBuild=build2&baselineBuild=build1&issues=EXCEPTIONS

Compare against the default baseline build:

GET https://hub.qrebel.com/api/applications/{appName}/issues/?targetBuild=build2&defaultBaseline

Query response example

This is an example of the REST API query JSON response (quotes omitted for brevity).

{
    appName: string,
    targetBuild: string,
    targetVersion: string
    baselineBuild: string,
    baselineVersion: string
    issuesCount: {
        duration: number,
        io: number,
        exceptions: number
    },
    entryPoints: [
        {
            hits: number,
            name: string,
            duration: {
                slowestPercentile: number,
                averageIncrease: decimal,
                scopePercentage: number
            },
            io: {
                highestPercentile: number,
                averageIncrease: decimal,
                scopePercentage: number
            },
            exceptions: [
                exception: {
                    name: string,
                    count: number
                }
            ]
        }
    ],
    appViewUrl: string
}