Skip to content

Importing results through the API

Calliope.pro supports importing test results through our API, here you'll get a basic explanation of how to do that. For more detailed and technical documentation you can take a look at our Swagger API Documentation.

Formatter endpoints

  • http://app.calliope.pro/api/v2/profile/{profile_id}/import/cucumber
  • http://app.calliope.pro/api/v2/profile/{profile_id}/import/junit
  • http://app.calliope.pro/api/v2/profile/{profile_id}/import/zaproxy
  • http://app.calliope.pro/api/v2/profile/{profile_id}/import/testng
  • http://app.calliope.pro/api/v2/profile/{profile_id}/import/xctest
  • And more...

The /import/formatter endpoint will try to import your file with that specific formatter.

Warning

Maximum allowed filesize is 50 MB

  • http://app.calliope.pro/api/v2/profile/{profile_id}/import

The /import endpoint will try out all available formatters. If your files are recognised by multiple formatters, it will return a failed status. This endpoint is not recommended because processing takes longer and unexpected failures may occur. It is mainly used for front end functionality.

Warning

Maximum allowed filesize is 30 MB

Formatter variables

Profile ID

All formatter API endpoints contain {profile_id}, this should be replaced with the profile you wish to push your results to.

You can find the profile ID in the top right corner dropdown of a profile, or in the profile sidebar.

Clicking the Copy Profile ID button will copy the {profile_id} to your clipboard. The tooltip displays the {profile_id}.

Profile ID in Dropdown

Profile ID in Sidebar

API Key

You can verify yourself by putting your API key in the header as x-api-key. You can find and copy your API key on your account page.
Copy API key

Test result (body)

The test results can be given in multiple ways.

  • form-data by using the ?file[]= parameter to attach one of multiple files <-- Recommended
  • raw by putting the result file as a string directly into the body
  • binary by attaching the result file to the body

Import options

Go to the import options page for all details about every option.

An example of parameters you could add to an API call:

Example API URL containing these variables
http://app.calliope.pro/api/v2/profile/2/import/cucumber?tag[]=os:test&tag[]=platform:test2&tag[]=build:123test&smart=false

Curl examples

An API request that sends a JSON or XML test result file using curl looks like this:

Single file

curl -X POST \
     -H "Content-Type:multipart/form-data" \
     -H "x-api-key:<API_KEY>" \
     -F "file[]=@path/to/testresult" \
     -F "tag[]=<YOUR_OS>" \
     -F "tag[]=<YOUR_PLATFORM>" \
     -F "tag[]=<YOUR_BUILD>" \
     "https://app.calliope.pro/api/v2/profile/<profile_id>/import/"

Note

The \'s are supposed to escape the new-line characters. This might not work in all systems, so in that case put everything on 1 line*

Multi-file

curl -X POST \
     -H "Content-Type:multipart/form-data" \
     -H "x-api-key:<API_KEY>" \
     -F "file[]=@path/to/testresult_01" \
     -F "file[]=@path/to/testresult_02" \
     -F "file[]=@path/to/testresult_03" \
     "https://app.calliope.pro/api/v2/profile/<profile_id>/import?tag[]=<YOUR_OS>&tag[]=<YOUR_PLATFORM>&tag[]=<YOUR_BUILD>"

You can find and copy your specific API import curl command on your Calliope.pro upload view:

  • Click the Upload-button at the top of the screen.
  • Select any file to open the upload.
  • Click on the API Upload-tab.
  • Here you will find a code-block containing your personal curl-command.

As body

curl -X POST \
     -H "Content-Type:text/xml" \
     -H "x-api-key:<API_KEY>" \
     -d "@path/to/testresult" \
     "https://app.calliope.pro/api/v2/profile/<profile_id>/import?tag[]=<YOUR_OS>&tag[]=<YOUR_PLATFORM>&tag[]=<YOUR_BUILD>"

As data binary

curl -X POST \
     -H "Content-Type:text/xml" \
     -H "x-api-key:<API_KEY>" \
     --data-binary "@path/to/testresult" \
     "https://app.calliope.pro/api/v2/profile/<profile_id>/import?tag[]=<YOUR_OS>&tag[]=<YOUR_PLATFORM>&tag[]=<YOUR_BUILD>"

As urlencoded raw file

curl -X POST \
     -H "Content-Type:application/x-www-form-urlencoded" \
     -H "x-api-key:<API_KEY>" \
     -F "file[]=UrlEncodedResultFile" \
     "https://app.calliope.pro/api/v2/profile/<profile_id>/import/?tag[]=<YOUR_OS>&tag[]=<YOUR_PLATFORM>&tag[]=<YOUR_BUILD>"

Try out API import

Try out our api end points, follow these few steps to import a report via swagger:

Authorize

  • Click "Try it out" for the "POST /profile/{profileId}/import" api call

Try it out

  • Fill in the required variables:

    • The profileId of the profile you want to upload the file in

    • A body (if you don't have a file to upload use this file as a test file)

    • The Content type (Application/json for our test file)

  • Execute the POST call

  • Look at the Calliope profile and see if the results have been imported!