3 Replies Latest reply: Mar 22, 2017 6:09 AM by Craig Nicholas RSS

    How to change App / AppObject owner using the API?

    Jack Lee

      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=eyrHB7kx06FPp2TI


      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?Xrfkey=aasdfasdfa33

       

      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?