Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
mhurley
Partner - Contributor
Partner - Contributor

QRS API: Updating a user's Custom Property values

Hello,

I have been working with the Qlik Sense Repository API and making API calls using Postman. Currently, I am trying to make an API call that will update a user's Custom Property values. For example, if a user has Custom Property "UserAppAccess" which allows them to see an app, and they already have "App 1" as a value assigned to them through UserAppAccess, I need an API call that can add "App 2" and "App 3" to the CP as well, so that they can see all 3 apps.

I have tried different kinds of requests, but the most success I've had was using a PUT call following a GET call, where the GET call gets the existing custom properties and their values based on a user id, and then the PUT call essentially copies the entire body of the GET call, changes the modifiedDate of the assigned CP to the user (in this case, the date when UserAppAccess was assigned to user) to the current time, copies and pastes the body for the CP values (body for App 1) and then changes the value to App 2, or App 3 etc. and lastly, changes the "id" of the body so that its a different random id. Clearly, this process is not ideal as it relies on randomizing the id of the CP value, and may potentially have conflict with other ids in the env (CPs, Users, Apps etc,?). 

Are there any alternative methods, maybe with PATCH or otherwise, which avoids having to deal with ids and can successfully update a user's assigned Custom Property values? Ideally, it could directly access a CP without dealing with dates, ids etc. and can simply add/remove a CP value.

For reference I am using certificate authentication to a Qlik Sense Enterprise server where I'm RootAdmin.

(Example below of the body for a user's CP where one value, App 1, is assigned. Info anonymized.)

{
    "id": "73b349f0-an1b-4f9f-a233-ef14br4361f4",
    "createdDate": "2024-04-15T18:38:41.905Z",
    "modifiedDate": "2024-05-09T15:33:16.282Z",
    "modifiedByUserName": "UserDir\\UserId",
    "customProperties": [
        {
            "id": "579b33b9-f9cd-471l-a9f9-5f51de903855",
            "createdDate": "2024-05-09T15:18:51.308Z",
            "modifiedDate": "2024-05-09T15:31:16.282Z",
            "modifiedByUserName": "UserDir\\UserId",
            "value": "App 1",
            "definition": {
                "id": "a495a6b1-d351-43b6-b995-a524652d63a3",
                "name": "UserAppAccess",
                "valueType": "Text",
                "choiceValues": [
                    "App 1",
                    "App 2",
                    "App 3"
                ],
                "privileges": null
            },
            "schemaPath": "CustomPropertyValue"
        }
    ],
    "userId": "UserId",
    "userDirectory": "UserDir",
    "userDirectoryConnectorName": "",
    "name": "UserId",
    "roles": [
        "RootAdmin"
    ],
    "attributes": [],
    "inactive": false,
    "removedExternally": false,
    "blacklisted": false,
    "deleteProhibited": false,
    "tags": [],
    "favorites": [],
    "privileges": null,
    "schemaPath": "User"
Labels (2)
0 Replies