API of Allure TestOps
The description if all the API methods available in Allure TestOps can be found by accessing the following URL: <TESTOPS>/swagger-ui.html
Limitations
All the API methods described could be used in your applications to retrieve, manage the information in Allure TestOps.
There is one exception – the upload of the test results. Upload of the tests results is a proprietary workflow which could be changed any time without any notice and without any support from our side.
There is only safe and proper way to upload test results to Allure TestOps – using the tools developed by Qameta Software; these are especially designed for this purpose – CI plug-ins (e.g. Allure TestOps Jenkins plug-in), or allurectl
which will always support correct workflow and will guarantee the system's performance won't degrade.
Swagger page
Swagger section of Allure TestOps has two main sections dedicated to API of i) report service, ii) uaa service.
API or report service
API of report service is needed to create, manage retrieve the data related to your tests:
- test cases
- test results
- launches
- statistics
- etc.
API of uaa service
API of report service is needed to create, manage retrieve the data related to Allure TestOps users, license
Try it out
You can try out the API methods right in Swagger UI.
Swagger UI will show you the curl string which was used, all the parameters and will show the results of API method execution.
Authentication
When you are using swagger page to try an API call, then you are automatically authenticated via application cookies, and there are no additional parameters are required from your side for the authentication purposes.
Despite the swagger API calls contain a XSRF-TOKEN, this is not a token used for the authentication but a parameter used to prevent cross-site requests forgery. See here for the reference: https://duckduckgo.com/?q=XSRF-TOKEN
When developing your own integration using one of the programming languages, you need to be properly authenticated in Allure TestOps to be able to call API methods.
First you need to generate a Bearer token, and then use this Bearer token to authenticate the attempts to invoke the API calls on Allure TestOps side.
- Generate Bearer token
- Use Bearer token for the authentication of your API requests.
Generation of Bearer token
export ENDPOINT="https://demo.testops.cloud"
export USER_TOKEN="ef06773a-544b-4f0b-ad53-5a11972c8b74"
echo "Obtaining jwt token"
JWT_TOKEN=$(curl -s -X POST "${ENDPOINT}/api/uaa/oauth/token" \
--header "Expect:" \
--header "Accept: application/json" \
--form "grant_type=apitoken" \
--form "scope=openid" \
--form "token=${USER_TOKEN}" \
| jq -r .access_token)
Usage of Bearer token for the authentication of API requests
echo "Getting user information"
curl -s -G "${ENDPOINT}/api/uaa/me" \
--header "Accept: application/json" \
--header "Authorization: Bearer ${JWT_TOKEN}"
Validity of bearer token
Bearer token is generated by Allure TestOps with limited validity which by default is 1 hour and this duration is defined by your instance configuration settings via ALLURE_JWT_ACCESS_TOKEN_VALIDITY_SECONDS
parameter.