Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
In Qlik Cloud, there are no separate environments for dev/qa/prod. These just exist as spaces in the tenant. I found documentation with some guidance.
In this post, there is also a video saying that you can create script to determine what space you are in.
I cannot find any documentation on how to create the rest connector to access this information. We did our best to create the rest connection but in doing so, we had to create an API key. This has an expiration attached to the API key. This can't be the case for code that will be used every day. I don't think this is reasonable. Given that this is a solution that Qlik is suggesting, what is the right solution to this?
The GetSysAttr() function allows you to see a lot of Cloud specific metadata such as tenant, space etc...
Hi @micahsakata,
the only way I could find is to, indeed, use the Rest connector, providing the API's key in the headers.
In a space called Shared you can create a connection to https://TN.RG.qlikcloud.com/api/v1/apps called REST_Apps and one called REST_space to https://TN.RG.qlikcloud.com/api/v1/spaces
LIB CONNECT TO 'Shared:REST_Apps';
RestConnectorMasterTable:
SQL SELECT
"__KEY_root",
(SELECT
"__FK_data",
"__KEY_data",
(SELECT
"id",
"spaceId",
"__FK_attributes",
"__KEY_attributes"
FROM "attributes" PK "__KEY_attributes" FK "__FK_attributes")
FROM "data" PK "__KEY_data" FK "__FK_data")
FROM JSON (wrap on) "root" PK "__KEY_root";
[attributes]:
LOAD [id],
[spaceId]
RESIDENT RestConnectorMasterTable
WHERE NOT IsNull([__FK_attributes]);
DROP TABLE RestConnectorMasterTable;
LIB CONNECT TO 'Shared:REST_spaces';
RestConnectorMasterTable:
SQL SELECT
"__KEY_root",
(SELECT
"id",
"name",
"__FK_data",
"__KEY_data"
FROM "data" PK "__KEY_data" FK "__FK_data")
FROM JSON (wrap on) "root" PK "__KEY_root";
[data]:
LOAD [id] as [spaceId],
[name]
RESIDENT RestConnectorMasterTable
WHERE NOT IsNull([__FK_data]);
DROP TABLE RestConnectorMasterTable;
Then compare that to the current appId accessible via DocumentName()
And yes, APIs will expire at some point, but you can set the expiration date a long way in the future.
Maybe @Leigh_Kennedy who created the video has some better tips.
If you think it would be useful to add a SpaceName() function, please, log an idea, so that we can gather consensus around it.
I'm seeing the expiration for a new API key is either "6 hours" or "a day". Again, if this solution from the posts are being touted as a way to navigate your environments, there is no way I can be expected to update that data connection daily. Am I missing something?
The GetSysAttr() function allows you to see a lot of Cloud specific metadata such as tenant, space etc...
As Jonny says, GetSysAttr() is the way to do it now (it didn't exist when I prepared that material). I have an updated version of that paper almost ready to release.
Thanks @JonnyPoole !
I had missed that, this settles it!
Hi @micahsakata ,
you got the answer to your query from @JonnyPoole. When it comes to the API duration, the maximum default is indeed one day, but you can change that in the tenant's settings.