Qlik Community

Integration, Extension & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

Announcements
QlikWorld 2022, LIVE in Denver CO., May 16-19, 2022. REGISTER NOW TO RECEIVE EARLY BIRD PRICING
cancel
Showing results for 
Search instead for 
Did you mean: 
gandalfgray
Specialist II
Specialist II

Is it not possible to set owner of an object via api?

Hi

I would like to create a DataConnection and set owner of it via api.

I use /qrs/dataconnection/ and creating the DataConnection works fine, but I have no success setting the owner to a specific user,

is that not possible?

1 Solution

Accepted Solutions
Levi_Turner
Employee
Employee

Hey Goran.

Sure. Anything you do in the QMC can be done via QRS API. The endpoints are in this vein:

GET /qrs/dataconnection/6cf48bd8-3b28-461d-8578-e92a9a0aa21a

{

  "id": "6cf48bd8-3b28-461d-8578-e92a9a0aa21a",

  "createdDate": "2017-05-08T18:20:45.118Z",

  "modifiedDate": "2018-08-27T13:47:24.434Z",

  "modifiedByUserName": "QTSEL\\ltu",

  "customProperties": [],

  "owner": {

    "id": "5334b296-493b-46ee-b621-79ba238ceb2c",

    "userId": "sa_repository",

    "userDirectory": "INTERNAL",

    "name": "sa_repository",

    "privileges": null

  },

  "name": "data",

  "connectionstring": "C:\\Data\\",

  "type": "folder",

  "engineObjectId": "6cf48bd8-3b28-461d-8578-e92a9a0aa21a",

  "username": "",

  "password": "",

  "logOn": 0,

  "architecture": 0,

  "tags": [],

  "privileges": null,

  "schemaPath": "DataConnection"

}

PUT /qrs/dataconnection/6cf48bd8-3b28-461d-8578-e92a9a0aa21a

Body:

{

  "id": "6cf48bd8-3b28-461d-8578-e92a9a0aa21a",

  "createdDate": "2017-05-08T18:20:45.118Z",

  "modifiedDate": "2018-08-27T13:47:24.434Z",

  "modifiedByUserName": "QTSEL\\ltu",

  "customProperties": [],

  "owner": {

    "id": "0d11d863-1c53-4a00-8699-3837b09109aa",

    "userId": "ltu",

    "userDirectory": "QTSEL",

    "name": "Levi Turner",

    "privileges": null

  },

  "name": "data",

  "connectionstring": "C:\\Data\\",

  "type": "folder",

  "engineObjectId": "6cf48bd8-3b28-461d-8578-e92a9a0aa21a",

  "username": "",

  "password": "",

  "logOn": 0,

  "architecture": 0,

  "tags": [],

  "privileges": null,

  "schemaPath": "DataConnection"

}

So basically you are altering the owner elements of the JSON to point to another user.

Hope that helps.

View solution in original post

2 Replies
Levi_Turner
Employee
Employee

Hey Goran.

Sure. Anything you do in the QMC can be done via QRS API. The endpoints are in this vein:

GET /qrs/dataconnection/6cf48bd8-3b28-461d-8578-e92a9a0aa21a

{

  "id": "6cf48bd8-3b28-461d-8578-e92a9a0aa21a",

  "createdDate": "2017-05-08T18:20:45.118Z",

  "modifiedDate": "2018-08-27T13:47:24.434Z",

  "modifiedByUserName": "QTSEL\\ltu",

  "customProperties": [],

  "owner": {

    "id": "5334b296-493b-46ee-b621-79ba238ceb2c",

    "userId": "sa_repository",

    "userDirectory": "INTERNAL",

    "name": "sa_repository",

    "privileges": null

  },

  "name": "data",

  "connectionstring": "C:\\Data\\",

  "type": "folder",

  "engineObjectId": "6cf48bd8-3b28-461d-8578-e92a9a0aa21a",

  "username": "",

  "password": "",

  "logOn": 0,

  "architecture": 0,

  "tags": [],

  "privileges": null,

  "schemaPath": "DataConnection"

}

PUT /qrs/dataconnection/6cf48bd8-3b28-461d-8578-e92a9a0aa21a

Body:

{

  "id": "6cf48bd8-3b28-461d-8578-e92a9a0aa21a",

  "createdDate": "2017-05-08T18:20:45.118Z",

  "modifiedDate": "2018-08-27T13:47:24.434Z",

  "modifiedByUserName": "QTSEL\\ltu",

  "customProperties": [],

  "owner": {

    "id": "0d11d863-1c53-4a00-8699-3837b09109aa",

    "userId": "ltu",

    "userDirectory": "QTSEL",

    "name": "Levi Turner",

    "privileges": null

  },

  "name": "data",

  "connectionstring": "C:\\Data\\",

  "type": "folder",

  "engineObjectId": "6cf48bd8-3b28-461d-8578-e92a9a0aa21a",

  "username": "",

  "password": "",

  "logOn": 0,

  "architecture": 0,

  "tags": [],

  "privileges": null,

  "schemaPath": "DataConnection"

}

So basically you are altering the owner elements of the JSON to point to another user.

Hope that helps.

View solution in original post

gandalfgray
Specialist II
Specialist II
Author

Thanks Levi for pushing me in the right direction!

I tried doing it using the

POST /qrs/dataconnection endpoint only,

but that one seems to ignore the owner part, and always defaults to INTERNALsa_repository

So now I do it in two steps:

POST /qrs/dataconnection

PUT /qrs/dataconnection/{id}


and it works!