Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to change App / AppObject owner using the API?

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:


https://[servername]/qrs/Selection/16c01704-74bd-4e1f-84e8-768ae8b150aa/App/Object/synthetic?xrfkey=...


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:

URI: https://[servername]:4242/qrs/Selection/5d79c08e-6726-4e23-bc9f-c1f58b828092/App/Object/synthetic?Xr...

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?

1 Solution

Accepted Solutions
s29124141
Partner - Creator II
Partner - Creator II

  • First create a selection object with POST body with objectId as app Id

  {"items":[{"type":"App","objectID":"c0d3bc5b-6ea2-42ea-8ecb-3bc90077bb34"}]}

  • Then call synthetic endpoint. It should be PUT not GET. Remember to add LatestModifiedDate

URI: https://[servername]:4242/qrs/Selection/5d79c08e-6726-4e23-bc9f-c1f58b828092/App/synthetic?Xrfkey=aa...

Body:

{

  "properties": [{

  "name": "owner",

  "value": "b6145ba2-66b5-4b71-a062-45d6d8b49469",

  "valueIsModified": true

  }],

  "type": "App",

"LatestModifiedDate": CurrentTime

}

View solution in original post

4 Replies
s29124141
Partner - Creator II
Partner - Creator II

  • First create a selection object with POST body with objectId as app Id

  {"items":[{"type":"App","objectID":"c0d3bc5b-6ea2-42ea-8ecb-3bc90077bb34"}]}

  • Then call synthetic endpoint. It should be PUT not GET. Remember to add LatestModifiedDate

URI: https://[servername]:4242/qrs/Selection/5d79c08e-6726-4e23-bc9f-c1f58b828092/App/synthetic?Xrfkey=aa...

Body:

{

  "properties": [{

  "name": "owner",

  "value": "b6145ba2-66b5-4b71-a062-45d6d8b49469",

  "valueIsModified": true

  }],

  "type": "App",

"LatestModifiedDate": CurrentTime

}

Not applicable
Author

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.

Not applicable
Author

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


Anonymous
Not applicable
Author

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.

s29124141