Skip to main content

Qlik Sense ODAG API: How to create ODAG links (PowerShell)

No ratings
cancel
Showing results for 
Search instead for 
Did you mean: 
Damien_Villaret
Support
Support

Qlik Sense ODAG API: How to create ODAG links (PowerShell)

Last Update:

Sep 14, 2023 3:20:36 AM

Updated By:

Sonja_Bauernfeind

Created date:

Jun 8, 2020 10:21:30 AM

This is a sample to create ODAG links with the ODAG API using PowerShell.

Environment

Qlik Sense Enterprise on Windows 

 

Sample using JWT authentication:

 

$body = '{"name": "ODAGLink",
    "selectionApp": "67a7d998-fdcb-414f-9049-7b6350234b9d",
    "templateApp": "13617037-cfa5-4205-93a7-87aac10c1676",
    "rowEstExpr": "Count(Dim1)",
    "properties": {
        "rowEstRange": [
        {
            "context": "*",
            "highBound": 100000
        }]
    }
}'
$hdrs = @{}
$hdrs.Add("X-Qlik-xrfkey","12345678qwertyui")
$hdrs.Add("Authorization","Bearer eyJhbGciOi...GYyMdkVoQLxRFYP7r7mLbGaamCwUIApcHtUc7b3LEg")
$url = "https://qlikserver1.domain.local/jwt/api/odag/v1/links?xrfkey=12345678qwertyui"
Invoke-RestMethod -Uri $url -Method Post -Headers $hdrs -Body $body -ContentType 'application/json'

 

Sample using ticket authentication:

 

#Paste the ticket here
$ticket='5PEtidGu2GjhLn2k'

$body = '{"name": "ODAGLink",
    "selectionApp": "67a7d998-fdcb-414f-9049-7b6350234b9d",
    "templateApp": "13617037-cfa5-4205-93a7-87aac10c1676",
    "rowEstExpr": "Count(Dim1)",
    "properties": {
        "rowEstRange": [
        {
            "context": "*",
            "highBound": 100000
        }]
    }
}'
$hdrs = @{}
$hdrs.Add("X-Qlik-xrfkey","12345678qwertyui")
$url = "https://qlikserver1.domain.local/api/odag/v1/links?qlikticket="+$ticket
Invoke-RestMethod -Uri $url -Method Post -Headers $hdrs -Body $body -ContentType 'application/json'

 

Sample using certificates:

 

$body = '{"name": "ODAGLink",
    "selectionApp": "67a7d998-fdcb-414f-9049-7b6350234b9d",
    "templateApp": "13617037-cfa5-4205-93a7-87aac10c1676",
    "rowEstExpr": "Count(Dim1)",
    "properties": {
        "rowEstRange": [
        {
            "context": "*",
            "highBound": 100000
        }]
    }
}'
$hdrs = @{}
$hdrs.Add("X-Qlik-User","UserDirectory=DOMAIN;UserId=Administrator")
$cert = Get-ChildItem -Path "Cert:\CurrentUser\My" | Where {$_.Subject -like '*QlikClient*'}
$url = "https://qlikserver1.domain.local:9098/v1/links"
Invoke-RestMethod -Uri $url -Method Post -Headers $hdrs -Body $body -ContentType 'application/json' -Certificate $cert

 

 

 

Labels (2)
Comments
Richard_Smith_Uchotski
Contributor II
Contributor II

I have been using your code, and it appears that the odag apps are being made but nothing visually is appearing in the apps, how do I make it so that the button for app generation is also made, it just seems that the objects are being made in the QRS/backend but not appearing in the front? 

Version history
Last update:
‎2023-09-14 03:20 AM
Updated by: