Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I have the below powershell script which is successfully duplicating an app in my Qlik Sense site.
$qlikserver = 'myqlikserver'
$appid = 'fee68b53-e3e3-4ddf-18bb-0fce33920072'
$xrfkey = "iX83QmNlvu87yyAB"
$url = "https://$($qlikserver)/header/qrs/app/$($appid)/copy?xrfkey=$($xrfkey)"
$headers = @{}
$headers.Add("X-Qlik-xrfkey","$xrfkey")
$headers.Add("X-Qlik-User","UserDirectory=INTERNAL;UserId=sa_repository")
$headers.Add("Header","myuser")
$body = ''
Invoke-RestMethod -Uri $url -Method Post -Body $body -ContentType 'application/json' -Headers $headers
However once I try and add the name parameter to the path I get a 403 error.
$qlikserver = 'myqlikserver'
$xrfkey = "iX83QmNlvu87yyAB"
$appid = 'fee68b53-e3e3-4ddf-18bb-0fce33920072'
$appname = 'mycopy'
$url = "https://$($qlikserver)/header/qrs/app/$($appid)/copy?name=$($appname)?xrfkey=$($xrfkey)"
$headers = @{}
$headers.Add("X-Qlik-xrfkey","$xrfkey")
$headers.Add("X-Qlik-User","UserDirectory=INTERNAL;UserId=sa_repository")
$headers.Add("Header","myuser")
$body = ''
Invoke-RestMethod -Uri $url -Method Post -Body $body -ContentType 'application/json' -Headers $headers
Does anyone have any thoughts?
Thanks,
Mark
Hello @mjperreault
There is a syntax mistake on this line:
$url = "https://$($qlikserver)/header/qrs/app/$($appid)/copy?name=$($appname)?xrfkey=$($xrfkey)"
It should be ..&xrfkey=..
When you have several URL parameters, the other parameters should be preceded by &
You are getting 403 because the xrfkey key doesn't get passed.
Hello @mjperreault
There is a syntax mistake on this line:
$url = "https://$($qlikserver)/header/qrs/app/$($appid)/copy?name=$($appname)?xrfkey=$($xrfkey)"
It should be ..&xrfkey=..
When you have several URL parameters, the other parameters should be preceded by &
You are getting 403 because the xrfkey key doesn't get passed.
Thank you @Damien_V !