Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I'm currently testing out the Qlik REST API for an internal project and I'm having trouble getting the datafiles endpoint to work as expected. When using a space id in the connectionId parameter for the other endpoints (Spaces, Apps, Data Connections) I get data returned filtered for that specific space. However, when I try to request all the datafiles for the same space, I receive this:
{
"errors": [
{
"title": "One or more validation errors occurred.",
"code": "HTTP-400",
"detail": "The value 'SPACEIDHERE' is not valid for ConnectionId."
}
]
}
There is absolutely no difference in how I query the Datafiles and other endpoints, so as far as I can tell it's a specific issue with the Datafiles endpoint. Example cURLs (Dataconnection endpoint working, Datafiles not working):
curl --location 'https://TENANTURLHERE/api/v1/data-connections?connectionId=SPACEIDHERE' \
--header 'Authorization: Bearer APIKEYHERE'
curl --location 'https://TENANTURLHERE/api/v1/data-files?connectionId=SPACEIDHERE' \
--header 'Authorization: Bearer APIKEYHERE'
The documentation has no reference to the connectionId parameter, I only found it by chance in a forum post but don't have the link anymore here Found the references in the documentation, it specifies a uuid just as the API itself returns. I've also tried difference spaces, so it's not a space-specific issue. Am I doing something wrong, or is there a different way to fetch all the datafiles for a specific space?
The connectionId value is the ID of the connection itself. The way I approach this is by doing this flow:
GET /api/v1/data-connections?space=<spaceid>
Example Response:
{
"data": [
{
"created": "2021-04-15T15:17:40.576Z",
"datasourceID": "azure_sql",
"id": "5a691104-9c88-42eb-bdb6-74c86b73cc83",
"links": {
"self": {
"href": "https://<tenant>/api/v1/data-connections/5a691104-9c88-42eb-bdb6-74c86b73cc83"
}
},
"privileges": [
"change_owner",
"change_space",
"delete",
"list",
"read",
"update"
],
"qArchitecture": 0,
"qConnectStatement": "CUSTOM CONNECT TO \"provider=QvOdbcConnectorPackage.exe;driver=azure_sql;host=<host>;port=1433;database=tpch1-merge;separateCredentials=false;allowNonSelectQueries=false;useBulkReader=false;bulkFetchSize=50;rowBatchSize=1;bulkFetchColumnMode=true;maxStringLength=4096;maxTotalBufferSize=4;maxFieldBufferSize=16;QueryTimeout=30;EnableQuotedIdentifiers=1;ReturnSpecificTypeAsOdbcType=yes;Min_TLS=1.0;\"",
"qCredentialsID": "88deed8d-9eda-4ad1-bb89-dda86cd5d550",
"qEngineObjectID": "5a691104-9c88-42eb-bdb6-74c86b73cc83",
"qID": "5a691104-9c88-42eb-bdb6-74c86b73cc83",
"qLogOn": 1,
"qName": "tpch1-merge",
"qSeparateCredentials": false,
"qType": "QvOdbcConnectorPackage.exe",
"qri": "qri:db:azure_sql://I_-JX4qmDBfnDIPa4rCUX0Xp0AAyTGAK_vd-tzhsmig",
"space": "5e58206c3117030001dec4d3",
"tags": null,
"tenant": "GB3No55mRF9tL0KpYMwXtMIdOv0mCHfe",
"updated": "2021-11-17T18:03:12.197Z",
"user": "Kxn7FT5eqdMCamH9vPAD_iTwZZ3RhqWZ",
"version": "V1"
},
{
"id": "3753f93a-830c-4f23-a0f9-b0035ead988c",
"links": {
"self": {
"href": "https://<tenant>/api/v1/data-connections/3753f93a-830c-4f23-a0f9-b0035ead988c"
}
},
"privileges": [
"read"
],
"qArchitecture": 0,
"qConnectStatement": "CUSTOM CONNECT TO \"provider=qix-datafiles.exe;path=Sandbox - EA:datafiles;\"",
"qEngineObjectID": "3753f93a-830c-4f23-a0f9-b0035ead988c",
"qID": "3753f93a-830c-4f23-a0f9-b0035ead988c",
"qLogOn": 0,
"qName": "DataFiles",
"qType": "qix-datafiles.exe",
"space": "5e58206c3117030001dec4d3",
"tags": null,
"tenant": "GB3No55mRF9tL0KpYMwXtMIdOv0mCHfe"
}
],
"links": {
"self": {
"href": "https://<tenant>/api/v1/data-connections?space=5e58206c3117030001dec4d3"
}
},
"meta": {
"count": 9
}
}
The ID for the DataFiles data connection is 3753f93a-830c-4f23-a0f9-b0035ead988c, so we call GET /api/v1/data-files?connectionId=3753f93a-830c-4f23-a0f9-b0035ead988c. Example response:
{
"data": [
{
"id": "108aee06-e1a2-493c-a373-f76c2250748a",
"name": "levi_all_sheets.csv",
"size": 45318,
"createdDate": "2021-12-08T19:15:09.239Z",
"modifiedDate": "2021-12-08T19:15:09.918Z",
"spaceId": "5e58206c3117030001dec4d3",
"ownerId": "VQGmdk0qDy1E_yhK7TNsa30s1Cj0QK6n"
},
{
"id": "de24f114-6d76-4841-b68e-85f7e31545f9",
"name": "BusinessHours_SKO22.qvd",
"size": 6435160,
"createdDate": "2021-12-01T14:12:23.464Z",
"modifiedDate": "2021-12-01T14:12:23.989Z",
"spaceId": "5e58206c3117030001dec4d3",
"ownerId": "VQGmdk0qDy1E_yhK7TNsa30s1Cj0QK6n"
},
{
"id": "5de3d58e-4f8d-4e68-915f-d477f2732467",
"name": "MyFile2.csv",
"size": 62834,
"createdDate": "2022-05-02T22:31:09.89Z",
"modifiedDate": "2022-05-02T22:31:10.06Z",
"spaceId": "5e58206c3117030001dec4d3",
"ownerId": "VQGmdk0qDy1E_yhK7TNsa30s1Cj0QK6n"
},
{
"id": "31fd3790-2ddd-418e-96b5-016384bd2437",
"name": "Business_SKO22.qvd",
"size": 21981119,
"createdDate": "2021-12-01T14:12:17.369Z",
"modifiedDate": "2021-12-01T14:12:18.073Z",
"spaceId": "5e58206c3117030001dec4d3",
"ownerId": "VQGmdk0qDy1E_yhK7TNsa30s1Cj0QK6n"
},
{
"id": "de68ae93-800f-4723-8a5a-b5367b384e03",
"name": "BusinessAttributes_SKO22.qvd",
"size": 5449996,
"createdDate": "2021-12-01T14:12:20.528Z",
"modifiedDate": "2021-12-01T14:12:21.02Z",
"spaceId": "5e58206c3117030001dec4d3",
"ownerId": "VQGmdk0qDy1E_yhK7TNsa30s1Cj0QK6n"
},
{
"id": "8270cf95-0349-435a-85bb-bed768804d95",
"name": "sheet_metadata.csv",
"size": 204376,
"createdDate": "2024-01-12T18:54:41.802Z",
"modifiedDate": "2024-01-12T18:54:42.141Z",
"spaceId": "5e58206c3117030001dec4d3",
"ownerId": "VQGmdk0qDy1E_yhK7TNsa30s1Cj0QK6n"
},
{
"id": "41402fa7-2e37-4d28-ae69-7dc017bdddfb",
"name": "Users_SKO22.qvd",
"size": 177428655,
"createdDate": "2021-12-01T14:13:12.834Z",
"modifiedDate": "2021-12-01T14:13:14.901Z",
"spaceId": "5e58206c3117030001dec4d3",
"ownerId": "VQGmdk0qDy1E_yhK7TNsa30s1Cj0QK6n"
},
{
"id": "513830a8-9c3c-4ec0-8869-398c7ff3c806",
"name": "UsersElite_SKO22.qvd",
"size": 61602387,
"createdDate": "2021-12-01T14:13:17.399Z",
"modifiedDate": "2021-12-01T14:13:18.977Z",
"spaceId": "5e58206c3117030001dec4d3",
"ownerId": "VQGmdk0qDy1E_yhK7TNsa30s1Cj0QK6n"
},
{
"id": "28f987ac-16f0-4f8f-a6a6-772806319b2f",
"name": "user_metadata.csv",
"size": 7612,
"createdDate": "2024-01-12T18:54:46.287Z",
"modifiedDate": "2024-01-12T18:54:46.814Z",
"spaceId": "5e58206c3117030001dec4d3",
"ownerId": "VQGmdk0qDy1E_yhK7TNsa30s1Cj0QK6n"
},
{
"id": "45126bb8-da51-4e11-bb71-15654862669e",
"name": "ReviewsTipsCheckins_SKO22.qvd",
"size": 2304533318,
"createdDate": "2021-12-01T14:12:26.833Z",
"modifiedDate": "2021-12-01T14:13:10.36Z",
"spaceId": "5e58206c3117030001dec4d3",
"ownerId": "VQGmdk0qDy1E_yhK7TNsa30s1Cj0QK6n"
},
{
"id": "2fb233ba-d5a6-489a-aa20-624cff1500e8",
"name": "ODAG_Data.qvd",
"size": 43824,
"createdDate": "2021-12-16T13:19:57.711Z",
"modifiedDate": "2021-12-16T13:27:11.893Z",
"spaceId": "5e58206c3117030001dec4d3",
"ownerId": "VQGmdk0qDy1E_yhK7TNsa30s1Cj0QK6n"
},
{
"id": "60a244c0-4ab0-4722-a613-a1e6018f32e4",
"name": "dummy_source_data.csv",
"size": 99341,
"createdDate": "2022-04-04T12:15:30.23Z",
"modifiedDate": "2022-04-04T12:15:30.464Z",
"spaceId": "5e58206c3117030001dec4d3",
"ownerId": "VQGmdk0qDy1E_yhK7TNsa30s1Cj0QK6n"
},
{
"id": "2311f3dc-ea24-4786-beaa-6d9e9c0206ff",
"name": "BusinessCategories_SKO22.qvd",
"size": 6573619,
"createdDate": "2021-12-01T14:12:14.454Z",
"modifiedDate": "2021-12-01T14:12:14.915Z",
"spaceId": "5e58206c3117030001dec4d3",
"ownerId": "VQGmdk0qDy1E_yhK7TNsa30s1Cj0QK6n"
},
{
"id": "031db8de-fbbb-45cc-b978-38491cbcdb88",
"name": "object_metadata.csv",
"size": 1157275,
"createdDate": "2024-01-12T18:54:37.3Z",
"modifiedDate": "2024-01-12T18:54:37.64Z",
"spaceId": "5e58206c3117030001dec4d3",
"ownerId": "VQGmdk0qDy1E_yhK7TNsa30s1Cj0QK6n"
},
{
"id": "0b081ee3-3dfd-4355-a902-3c25826fdb4f",
"name": "MyFile.csv",
"size": 62834,
"createdDate": "2022-05-02T22:20:38.606Z",
"modifiedDate": "2022-05-02T22:20:38.702Z",
"spaceId": "5e58206c3117030001dec4d3",
"ownerId": "VQGmdk0qDy1E_yhK7TNsa30s1Cj0QK6n"
}
],
"links": {
"next": {},
"self": {
"href": "https://<tenant>:443/api/v1/data-files?connectionId=3753f93a-830c-4f23-a0f9-b0035ead988c"
},
"prev": {}
}
}
The connectionId value is the ID of the connection itself. The way I approach this is by doing this flow:
GET /api/v1/data-connections?space=<spaceid>
Example Response:
{
"data": [
{
"created": "2021-04-15T15:17:40.576Z",
"datasourceID": "azure_sql",
"id": "5a691104-9c88-42eb-bdb6-74c86b73cc83",
"links": {
"self": {
"href": "https://<tenant>/api/v1/data-connections/5a691104-9c88-42eb-bdb6-74c86b73cc83"
}
},
"privileges": [
"change_owner",
"change_space",
"delete",
"list",
"read",
"update"
],
"qArchitecture": 0,
"qConnectStatement": "CUSTOM CONNECT TO \"provider=QvOdbcConnectorPackage.exe;driver=azure_sql;host=<host>;port=1433;database=tpch1-merge;separateCredentials=false;allowNonSelectQueries=false;useBulkReader=false;bulkFetchSize=50;rowBatchSize=1;bulkFetchColumnMode=true;maxStringLength=4096;maxTotalBufferSize=4;maxFieldBufferSize=16;QueryTimeout=30;EnableQuotedIdentifiers=1;ReturnSpecificTypeAsOdbcType=yes;Min_TLS=1.0;\"",
"qCredentialsID": "88deed8d-9eda-4ad1-bb89-dda86cd5d550",
"qEngineObjectID": "5a691104-9c88-42eb-bdb6-74c86b73cc83",
"qID": "5a691104-9c88-42eb-bdb6-74c86b73cc83",
"qLogOn": 1,
"qName": "tpch1-merge",
"qSeparateCredentials": false,
"qType": "QvOdbcConnectorPackage.exe",
"qri": "qri:db:azure_sql://I_-JX4qmDBfnDIPa4rCUX0Xp0AAyTGAK_vd-tzhsmig",
"space": "5e58206c3117030001dec4d3",
"tags": null,
"tenant": "GB3No55mRF9tL0KpYMwXtMIdOv0mCHfe",
"updated": "2021-11-17T18:03:12.197Z",
"user": "Kxn7FT5eqdMCamH9vPAD_iTwZZ3RhqWZ",
"version": "V1"
},
{
"id": "3753f93a-830c-4f23-a0f9-b0035ead988c",
"links": {
"self": {
"href": "https://<tenant>/api/v1/data-connections/3753f93a-830c-4f23-a0f9-b0035ead988c"
}
},
"privileges": [
"read"
],
"qArchitecture": 0,
"qConnectStatement": "CUSTOM CONNECT TO \"provider=qix-datafiles.exe;path=Sandbox - EA:datafiles;\"",
"qEngineObjectID": "3753f93a-830c-4f23-a0f9-b0035ead988c",
"qID": "3753f93a-830c-4f23-a0f9-b0035ead988c",
"qLogOn": 0,
"qName": "DataFiles",
"qType": "qix-datafiles.exe",
"space": "5e58206c3117030001dec4d3",
"tags": null,
"tenant": "GB3No55mRF9tL0KpYMwXtMIdOv0mCHfe"
}
],
"links": {
"self": {
"href": "https://<tenant>/api/v1/data-connections?space=5e58206c3117030001dec4d3"
}
},
"meta": {
"count": 9
}
}
The ID for the DataFiles data connection is 3753f93a-830c-4f23-a0f9-b0035ead988c, so we call GET /api/v1/data-files?connectionId=3753f93a-830c-4f23-a0f9-b0035ead988c. Example response:
{
"data": [
{
"id": "108aee06-e1a2-493c-a373-f76c2250748a",
"name": "levi_all_sheets.csv",
"size": 45318,
"createdDate": "2021-12-08T19:15:09.239Z",
"modifiedDate": "2021-12-08T19:15:09.918Z",
"spaceId": "5e58206c3117030001dec4d3",
"ownerId": "VQGmdk0qDy1E_yhK7TNsa30s1Cj0QK6n"
},
{
"id": "de24f114-6d76-4841-b68e-85f7e31545f9",
"name": "BusinessHours_SKO22.qvd",
"size": 6435160,
"createdDate": "2021-12-01T14:12:23.464Z",
"modifiedDate": "2021-12-01T14:12:23.989Z",
"spaceId": "5e58206c3117030001dec4d3",
"ownerId": "VQGmdk0qDy1E_yhK7TNsa30s1Cj0QK6n"
},
{
"id": "5de3d58e-4f8d-4e68-915f-d477f2732467",
"name": "MyFile2.csv",
"size": 62834,
"createdDate": "2022-05-02T22:31:09.89Z",
"modifiedDate": "2022-05-02T22:31:10.06Z",
"spaceId": "5e58206c3117030001dec4d3",
"ownerId": "VQGmdk0qDy1E_yhK7TNsa30s1Cj0QK6n"
},
{
"id": "31fd3790-2ddd-418e-96b5-016384bd2437",
"name": "Business_SKO22.qvd",
"size": 21981119,
"createdDate": "2021-12-01T14:12:17.369Z",
"modifiedDate": "2021-12-01T14:12:18.073Z",
"spaceId": "5e58206c3117030001dec4d3",
"ownerId": "VQGmdk0qDy1E_yhK7TNsa30s1Cj0QK6n"
},
{
"id": "de68ae93-800f-4723-8a5a-b5367b384e03",
"name": "BusinessAttributes_SKO22.qvd",
"size": 5449996,
"createdDate": "2021-12-01T14:12:20.528Z",
"modifiedDate": "2021-12-01T14:12:21.02Z",
"spaceId": "5e58206c3117030001dec4d3",
"ownerId": "VQGmdk0qDy1E_yhK7TNsa30s1Cj0QK6n"
},
{
"id": "8270cf95-0349-435a-85bb-bed768804d95",
"name": "sheet_metadata.csv",
"size": 204376,
"createdDate": "2024-01-12T18:54:41.802Z",
"modifiedDate": "2024-01-12T18:54:42.141Z",
"spaceId": "5e58206c3117030001dec4d3",
"ownerId": "VQGmdk0qDy1E_yhK7TNsa30s1Cj0QK6n"
},
{
"id": "41402fa7-2e37-4d28-ae69-7dc017bdddfb",
"name": "Users_SKO22.qvd",
"size": 177428655,
"createdDate": "2021-12-01T14:13:12.834Z",
"modifiedDate": "2021-12-01T14:13:14.901Z",
"spaceId": "5e58206c3117030001dec4d3",
"ownerId": "VQGmdk0qDy1E_yhK7TNsa30s1Cj0QK6n"
},
{
"id": "513830a8-9c3c-4ec0-8869-398c7ff3c806",
"name": "UsersElite_SKO22.qvd",
"size": 61602387,
"createdDate": "2021-12-01T14:13:17.399Z",
"modifiedDate": "2021-12-01T14:13:18.977Z",
"spaceId": "5e58206c3117030001dec4d3",
"ownerId": "VQGmdk0qDy1E_yhK7TNsa30s1Cj0QK6n"
},
{
"id": "28f987ac-16f0-4f8f-a6a6-772806319b2f",
"name": "user_metadata.csv",
"size": 7612,
"createdDate": "2024-01-12T18:54:46.287Z",
"modifiedDate": "2024-01-12T18:54:46.814Z",
"spaceId": "5e58206c3117030001dec4d3",
"ownerId": "VQGmdk0qDy1E_yhK7TNsa30s1Cj0QK6n"
},
{
"id": "45126bb8-da51-4e11-bb71-15654862669e",
"name": "ReviewsTipsCheckins_SKO22.qvd",
"size": 2304533318,
"createdDate": "2021-12-01T14:12:26.833Z",
"modifiedDate": "2021-12-01T14:13:10.36Z",
"spaceId": "5e58206c3117030001dec4d3",
"ownerId": "VQGmdk0qDy1E_yhK7TNsa30s1Cj0QK6n"
},
{
"id": "2fb233ba-d5a6-489a-aa20-624cff1500e8",
"name": "ODAG_Data.qvd",
"size": 43824,
"createdDate": "2021-12-16T13:19:57.711Z",
"modifiedDate": "2021-12-16T13:27:11.893Z",
"spaceId": "5e58206c3117030001dec4d3",
"ownerId": "VQGmdk0qDy1E_yhK7TNsa30s1Cj0QK6n"
},
{
"id": "60a244c0-4ab0-4722-a613-a1e6018f32e4",
"name": "dummy_source_data.csv",
"size": 99341,
"createdDate": "2022-04-04T12:15:30.23Z",
"modifiedDate": "2022-04-04T12:15:30.464Z",
"spaceId": "5e58206c3117030001dec4d3",
"ownerId": "VQGmdk0qDy1E_yhK7TNsa30s1Cj0QK6n"
},
{
"id": "2311f3dc-ea24-4786-beaa-6d9e9c0206ff",
"name": "BusinessCategories_SKO22.qvd",
"size": 6573619,
"createdDate": "2021-12-01T14:12:14.454Z",
"modifiedDate": "2021-12-01T14:12:14.915Z",
"spaceId": "5e58206c3117030001dec4d3",
"ownerId": "VQGmdk0qDy1E_yhK7TNsa30s1Cj0QK6n"
},
{
"id": "031db8de-fbbb-45cc-b978-38491cbcdb88",
"name": "object_metadata.csv",
"size": 1157275,
"createdDate": "2024-01-12T18:54:37.3Z",
"modifiedDate": "2024-01-12T18:54:37.64Z",
"spaceId": "5e58206c3117030001dec4d3",
"ownerId": "VQGmdk0qDy1E_yhK7TNsa30s1Cj0QK6n"
},
{
"id": "0b081ee3-3dfd-4355-a902-3c25826fdb4f",
"name": "MyFile.csv",
"size": 62834,
"createdDate": "2022-05-02T22:20:38.606Z",
"modifiedDate": "2022-05-02T22:20:38.702Z",
"spaceId": "5e58206c3117030001dec4d3",
"ownerId": "VQGmdk0qDy1E_yhK7TNsa30s1Cj0QK6n"
}
],
"links": {
"next": {},
"self": {
"href": "https://<tenant>:443/api/v1/data-files?connectionId=3753f93a-830c-4f23-a0f9-b0035ead988c"
},
"prev": {}
}
}
That's the solution! I've simply gone about it all wrong. Here I was thinking I could directly request the datafiles, but using the dataconnections makes sense. Problem solved, thank you kindly!