Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
PGeorge
Contributor III
Contributor III

Export Data using RestClient gives forbidden request

I am trying to export data in excel using the RestClient approach documented here by Øystein_Kolsrudhttps://github.com/kolsrud/qlik_rest_sdk/blob/master/Qlik.Sense.RestClient/Examples/QcsExportExcel 

 

var appId = "app-ID";
var objectId = "object-ID";

var client = new RestClient("wss://test.eu.qlikcloud.com");
client.AsApiKeyViaQcs("API_KEY");
                
var requestBody = CreateRequestBody(appId, objectId);
var httpRsp = client.PostHttpAsync("/api/v1/reports", requestBody);
var httpResult = httpRsp.Result;
var statusLocation = httpResult.Headers.Location;

var dataLocation = AwaitExportCompletion(client, statusLocation.AbsolutePath);
var dataLocationUri = new Uri(dataLocation);
byte[] exportBytes = await client.GetBytesAsync(dataLocationUri.AbsolutePath);
return File(exportBytes, "application/xlsx", "out.xlsx");

 

 When in httpRsp.Result i get the following error: 

 

HttpRequestException: 403: Forbidden, {"code":403,"message":"You are not entitled to perform that operation. Export capability is off.","errors":[{"code":"REP-403026","detail":"Reporting capability is off","meta":{},"title":"You are not entitled to perform that operation. Export capability is off."}

 

Is there any configuration I might be missing and i get this error?

I have also tried the ExportData approach from .NET SDK which is incompatible from what i read.

Thanks in advance.

Labels (1)
  • API

7 Replies
jprdonnelly
Employee
Employee

@PGeorge - the error message you are seeing is related to how exportData differs from Client-Managed Qlik Sense and Qlik Cloud.

In Client-Managed Qlik Sense Enterprise, the Engine handles the data exports. In Qlik Cloud, they are handled by the Reporting Service. The error message is indicating that the Reporting capability is off, which most likely indicates that your subscription needs to be updated to support Reporting services.

- @jprdonnelly
PGeorge
Contributor III
Contributor III
Author

Thanks for your prompt answer. 

Are the attached options related to the subscription package you are referring to?

Because I can't find any other details to update to Reporting services level.

DaveChannon
Employee
Employee

Hi @PGeorge 

Replying before @jprdonnelly wakes up...

Here's an example of using the reports API in Qlik Cloud to generate outputs: https://qlik.dev/embed/generate-reports/reporting-api-samples

You are able to generate single object outputs using this method, and the reports API also supports our Reporting Service which helps you generate compositions of objects and sheets into a single file (both are covered in the link above).

PGeorge
Contributor III
Contributor III
Author

Very informative and helpful link.

I followed the link's instructions and created a POST request which I sent through Postman and the response remains the same as above. 

{
    "code": 403,
    "message": "You are not entitled to perform that operation. Export capability is off.",
    "errors": [
        {
            "code": "REP-403026",
            "detail": "Reporting capability is off",
            "meta": {},
            "title": "You are not entitled to perform that operation. Export capability is off."
        },
        {
            "code": "REP-403026",
            "detail": "Reporting capability is off",
            "meta": {
                "appErrors": [
                    {
                        "appId": "app-id",
                        "method": "CheckExportCapabilities",
                        "parameters": {
                            "appID": "app-id",
                            "tags": "[api.public]",
                            "taskID": "task-id",
                            "tenantID": "tenant-id",
                            "userID": "user-id"
                        }
                    }
                ]
            },
            "title": "forbidden request"
        }
    ]
}

 Which part of my subscription package do I have to update,  since I am not entitled to perform the operation?

PGeorge
Contributor III
Contributor III
Author

@jprdonnelly  @DaveChannon did you have a chance to look into it? Thanks

DaveChannon
Employee
Employee

@PGeorge , did a little digging, could it be that you're using a Qlik Sense Business, rather than Enterprise subscription? It seems we might restrict which APIs and services the former can access.

PGeorge
Contributor III
Contributor III
Author

@DaveChannon  I will check my subscription options and come back to you.