Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I am using the Qlik SAAS API.
When i attempt to reload a dashboard, the error below is returned.
{"traceId":"67d14d4c1cd2410595748ce67ac04c88","errors":[{"code":"RELOADS-001","title":"Invalid request."}]}
This is what I am using
curl "https://your-tenant.us.qlikcloud.com/api/v1/reloads" \
-X POST \
-H "Authorization: Bearer <API-key>" \
-H "Content-type: application/json" \
-d '{"appId":"116dbfae-7fb9-4983-8e23-5ccd8c508722","partial":true}'
This seems to be an artifact of curl for Windows on my end. This is working for me:
curl "https://<tenant>.<region>.qlikcloud.com/api/v1/reloads" -X POST -H "Authorization: Bearer <myApiKey>" -H "Content-type: application/json" -d "{\"appId\":\"<myAppId\"}"
Single quotes (') around the body and not escaping the double quotes in the body isn't needed on curl launched via the Linux Subsystem for Windows install I have.
Hello @mstoler
The syntax looks correct as per the help site https://qlik.dev/apis/rest/reloads#%23%2Fentries%2Freloads-post
When I check in the Qlik Sense SaaS backend logs based on your traceId, it complains about the backslash
{"caller":"middleware.go:265","error":"invalid character '\\'' looking for beginning of value","level":"error","message":"could not unmarshal reload request JSON","timestamp":"2021-08-06T13:41:43.325917317Z","traceId":"67d14d4c1cd2410595748ce67ac04c88"}
Could you try to remove all the backslashes and just have a one line cURL request and see if that makes any difference ?
Hello,
I just did a bunch of requests today using the syntax below but using one line on Sat 8/14.
Please let me know what you see. I would like to get this working.
Thanks,
Michael
curl "https://your-tenant.us.qlikcloud.com/api/v1/reloads" \ -X POST \ -H "Authorization: Bearer <API-key>" \ -H "Content-type: application/json" \ -d '{"appId":"116dbfae-7fb9-4983-8e23-5ccd8c508722","partial":true}'
Hello @mstoler
It's still showing the same error
{
error: invalid character '\'' looking for beginning of value
level: error
message: could not unmarshal reload request JSON
timestamp: 2021-08-14T17:49:37.109386048Z
traceId: 9c5601c7be832b5ec41eb2f5527a8bdd
}
Did you make sure to remove all the backslashes when you did the request as a one line request ?
curl "https://your-tenant.us.qlikcloud.com/api/v1/reloads" -X POST -H "Authorization: Bearer <API-key>" -H "Content-type: application/json" -d '{"appId":"116dbfae-7fb9-4983-8e23-5ccd8c508722","partial":true}'
Also could you as well try the same in PowerShell and see if that's also the same issue ?
https://community.qlik.com/t5/Knowledge/How-to-Generate-API-Keys-in-Qlik-Sense-SaaS-using-APIs/ta-p/...
Something like:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$body='{"appId":"116dbfae-7fb9-4983-8e23-5ccd8c508722","partial":true}'
$hdrs = @{}
$hdrs.Add("Authorization","Bearer eyJhbGciOiJFUzM4NCIsImtp...NOofkzjW3R1fc4h")
$hdrs.Add("content-type","application/json")
$url = "https://yourtenant.eu.qlikcloud.com/api/v1/reloads"
Invoke-RestMethod -Uri $url -Method Post -Headers $hdrs -Body $body
Hello,
I did try both.
I think what might help is if there is a working example using curl that shows me the exact syntax.
Where the documentation indicates
Authorization: Bearer <API-key>"
Do we actually use the angle brackets? I am not.
"Authorization: Bearer xxxxxx"
Is it possible to just show a working example without the confidential information?
Thanks,
Michale
Hi Michale,
Just out of curiosity, are you using curl on windows or Mac? On windows the escape character is ^ and not \. Maybe that's the issue?
Angle brackets should not be included so you're right on the bearer format, like
"Authorization: Bearer xxxxxx"
Best
Björn
Hello,
I am just using a single line on Windows.
Do you have a working example of how to reload a Dashboard (take out the sensitive part)?
Thanks,
Mchael
And you also updated:
This seems to be an artifact of curl for Windows on my end. This is working for me:
curl "https://<tenant>.<region>.qlikcloud.com/api/v1/reloads" -X POST -H "Authorization: Bearer <myApiKey>" -H "Content-type: application/json" -d "{\"appId\":\"<myAppId\"}"
Single quotes (') around the body and not escaping the double quotes in the body isn't needed on curl launched via the Linux Subsystem for Windows install I have.