Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I'm using the REST API to duplicate an app with user internal\sa_repository. This means the duplicated app and its objects are owned by internal\sa_repository. Is it possible to change the ownerId on the app and its objects?
What I've tried...
I've performed the change of owner in QMC while having Fiddler running in the background. It appears to me that the endpoint is as follows:
The request type is PUT and the body contains an array of properties. I've noticed that the property named 'owner' has these values:
{
"name": "owner",
"value": "b6145ba2-66b5-4b71-a062-45d6d8b49469",
"valueIsDifferent": false,
"valueIsModified": true
},
... which leads me to believe that 'valueIsModified' is the input argument to the engine on what to change.
So I constructed a request body that is much smaller than the one that QMC generates:
Body:
{
"properties": [{
"name": "owner",
"value": "b6145ba2-66b5-4b71-a062-45d6d8b49469",
"valueIsDifferent": false,
"valueIsModified": true
}],
"type": "App.Object"
}
Unfortunately, I get the error message back:
[{
"schemaPath": "Selection",
"errorText": "Cannot find the item for the \"Get\" operation."
}]
I am sure that the appObject in the URI exists cause I see it in /qmc/appobjects.
What am I missing?
{"items":[{"type":"App","objectID":"c0d3bc5b-6ea2-42ea-8ecb-3bc90077bb34"}]}
Body:
{
"properties": [{
"name": "owner",
"value": "b6145ba2-66b5-4b71-a062-45d6d8b49469",
"valueIsModified": true
}],
"type": "App",
"LatestModifiedDate": CurrentTime
}
{"items":[{"type":"App","objectID":"c0d3bc5b-6ea2-42ea-8ecb-3bc90077bb34"}]}
Body:
{
"properties": [{
"name": "owner",
"value": "b6145ba2-66b5-4b71-a062-45d6d8b49469",
"valueIsModified": true
}],
"type": "App",
"LatestModifiedDate": CurrentTime
}
Hi praveena.
I should have marked the thread as closed a long time ago but this is essentially what I did in the end, thanks for your help though.
As for the URI I used qrs/Selection/{0}/App/Object/synthetic where {0} is the appId.
Also, for the value CurrentTime I had to format the resulting time as such:
DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fffZ").
I'll mark your answer as the correct one.
Hi
Being new to the QRS API I'm interested to know if this is a two step procedure if doing this using Postman.
Please can you explain a little more about the first step "First create a selection object" ?
Thanks
Hi Jack
We are also struggling to change the owner of an app through the QRS API for Qlik Sense.
From what I can gather online I need to use the URL qrs/Selection/{0}/App/synthetic where {0} is the app ID and send a PUT request.
You pass through a JSON object with the body:
{\"properties\": [{\"name\": \"owner\",\"value\": \"" + id + "\",\"valueIsModified\": true, \"valueIsdifferent\": true}],\"type\": \"App\",\"LatestModifiedDate\": \"" + DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fffZ") + "\"}
Where id is the id of the user you want the new owner to be.
I get a response saying this path is not valid, indicating possibly the URL is not valid.