Downloading a report

With Reports API you can view and export any report that you created in BlueDolphin.

Overview of downloading a report:

  1. Get a list of reports and select one.

  2. Export the selected report.

  3. Download the exported file.

Picture

Follow the steps in this article to download a report from your BlueDolphin environment using the API.

Prerequisites

To start using BlueDolphin APIs to create integrations, you need to have:

  • A BlueDolphin environment

  • Set up an API key to use in this example in your BlueDolphin environment.

Step 1: Select a report

First you'll have to select the report to export. Only reports saved in the Dataset folder are available for download.
This is the report we want to export from BlueDolphin:

Picture

1. Retrieve the list of available reports
$ curl -X GET "https://{base}/api/v1/datasource-reports" \
-H "apiKey: f08a2bb9-3ab4-451a-9099-2ef531375147" \
-H "tenant: contoso"

Replace:

  • {base} with "services.eu.bluedolphin.app" or "services.us.bluedolphin.app", for EU and US tenants respectively.

2. Check the results and select the report you want to download

You should receive a response similar to the following, the result contains a list of reports:

{
"error_code": 0,
"error_message": null,
"error_message_explain": null,
"data": [
...,
{
"name": "All applications Report",
"uri": "/Datasets/All_applications_Report"
},
]
}

You need to remember the uri field of the report that you want to export and reuse in the next request. In this tutorial we will use "/Datasets/All_applications_Report".

Step 2: Export the report

1. Prepare the parameters for the export
{
"outputformat": "<outputformat>",
"reporturi": "<reporturi>",
"sharedaccessstring": "<sharedaccessstring>"
}

Replace:

  • <outputformat>with the desired output format. Supported formats are: csv, xml, xls, xlsx. In the example we will use 'csv'.

  • <reporturi> with the uri of the selected datasource, for example "/Datasets/All_applications_Report".

  • <sharedaccessstring> with a shared access string to a blob container, which must have write rights. The output file will be placed in this location, for example, the one returned from 'Get write shared access string' endpoint.

2. Send a request to export the selected report
$ curl -X POST "https://{base}/api/v1/datasource-reports/export" \
-H "apiKey: f08a2bb9-3ab4-451a-9099-2ef531375147" \
-H "tenant: contoso"
--data-raw '{
"outputformat": "csv",
"reporturi": "/Datasets/All_applications_Report",
"sharedaccessstring": "https://bddatastorageprd.blob.core.windows.net/97e78613-795e-4fc3-9cb1-d8ce344ea6ab?sv=2018-03-28&sr=c&sig=HsfuH%2B8Iqz2iN1tklQW7H5TVwEQuFr9mpZL9nn60d4M%3D&se=2022-01-17T13%3A30%3A05Z&sp=w"
}'

Replace:

  • {base} with "services.eu.bluedolphin.app" or "services.us.bluedolphin.app", for EU and US tenants respectively.

Step 3: Download the output file

After the export is finished, you can download the report that was placed on the provided blob storage location.

1. Check the result of the export request
{
"error_code": 0,
"error_message": null,
"error_message_explain": null,
"data": {
"file_name": "42e97865-ffed-4408-9670-10f218ddb8cf"
}
}

The file_name from the result is the name of the exported report. It is placed on the blob storage provided earlier.

2. Get a read access string pointing to the exported file
https://{base}/public-api/v0.1/sharedaccessstring/read?blob_name=<file-name>"

Replace:

  • {base} with "services.eu.bluedolphin.app" or "services.us.bluedolphin.app", for EU and US tenants respectively.

  • <file-name> with the file from the export result, ex. "42e97865-ffed-4408-9670-10f218ddb8cf".

$ curl -X GET "https://{base}/api/v1/sharedaccessstring/read?blob_name=42e97865-ffed-4408-9670-10f218ddb8cf" \
-H "apiKey: f08a2bb9-3ab4-451a-9099-2ef531375147" \
-H "tenant: contoso"

Replace:

  • {base} with "services.eu.bluedolphin.app" or "services.us.bluedolphin.app", for EU and US tenants respectively.

The result contains a read access string to the file. You can use this to download the file.

{ 
"error_code": 0,
"error_message": null,
"error_message_explain": null,
"data": "https://bdtst00eudata.blob.core.windows.net/97e78613-795e-4fc3-9cb1-d8ce344ea6ab/42e97865-ffed-4408-9670-10f218ddb8cf?sv=2018-03-28&sr=b&sig=tQg9MY74rEwQWmxfG44G7Psh2wAhjS7vsSM2KFZvbfA%3D&se=2022-01-17T16%3A20%3A43Z&sp=r"
}

The link is valid for one hour.

3. Download the file
$ curl -X GET "https://bdtst00eudata.blob.core.windows.net/97e78613-795e-4fc3-9cb1-d8ce344ea6ab/42e97865-ffed-4408-9670-10f218ddb8cf?sv=2018-03-28&sr=b&sig=tQg9MY74rEwQWmxfG44G7Psh2wAhjS7vsSM2KFZvbfA%3D&se=2022-01-17T16%3A20%3A43Z&sp=r"

Output:

ID,Title,Version,Vendor,Category
5npOMiLzKK,Google Chrome,97.0.4692,Google Inc.,Browsers
ugumq9vKF2,Mozilla Firefox,96.0.1,Mozilla,Browsers
yXmx2D5F17,Notepad++,8.2,Notepad++ Team,Code editor
rfAh8ttZ5H,VLC media player,3.0.16,VideoLAN,Media player
xvqVA5OoWj,Visual Studio Code,1.63.2,Microsoft,Code editor