

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Tags:
- dataconnection
- owner
Accepted Solutions


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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!
