Skip to main content
All CollectionsKnowledge BaseGeneral issues
Getting the URL for test artifacts
Getting the URL for test artifacts
Updated over 5 months ago

Issue:

Is there a way to get the URL for the test artifacts that were generated during my build?

Possible solutions:

Yes, you can use the Bitrise API to get this information. You can retrieve the data of a specific artifact by using the GET/apps/{app-slug}/builds/{build-slug}/artifacts/{artifact-slug} endpoint.

Here is an example script that uses the Bitrise Artifact API to send the Artifact URLs to Slack:

#!/usr/bin/env bash
#access token can be generated here(https://app.bitrise.io/me/profile#/security) and stored as secret
access_token=$BITRISE_API_ACCESS_TOKEN
app_slug="your-app-id" # the id of your app
build_slug=$BITRISE_BUILD_SLUGbitrise_api_url="https://api.bitrise.io/v0.1"
the_url="$bitrise_api_url/apps/$app_slug/builds/$build_slug/artifacts"artifacts_array=$(curl -s -H "Authorization: $access_token" $the_url)for artifact_index in 0 1 2 #we have 3 artifacts
do
    artifact=$(echo ${artifacts_array} | jq -r ".data[$artifact_index]")    artifact_slug=$(echo ${artifact} | jq -r '.slug')    artifact_url="$the_url/$artifact_slug"    artifact_metadata_response=$(curl -s -H "Authorization: $access_token" ${artifact_url})
    artifact_name=$(echo ${artifact_metadata_response} | jq -r '.data .title')
    artifact_download_url=$(echo ${artifact_metadata_response} | jq -r '.data .expiring_download_url')
    echo
    echo ":point_down: $artifact_name :point_down:"
    echo
    echo ${artifact_download_url}
done

Additional information:

Did this answer your question?