cancel
Showing results for 
Search instead for 
Did you mean: 

API to update group parameter

ramansingh89
10 - ETL
10 - ETL

Hi Experts

I wonder if there is any API that i can use to create/update group parameters in sisense?

2 ACCEPTED SOLUTIONS

Hi @ramansingh89,

 

The payload would look something like this to the endpoint POST /api/v1/user-parameters (Not all the parameters will match exactly on your server and use case, 660e9f7464a70f002df9a38c is the group ID of clientabc in this example)

 

{
  "name": "Example",
  "displayName": "Example",
  "hidden": false,
  "type": "string",
  "applicableAreas": [
    "Connections"
  ],
  "description": "",
  "users": {},
  "groups": {
    "660e9f7464a70f002df9a38c": {
      "contextId": "660e9f7464a70f002df9a38c",
      "contextType": "groups",
      "value": "ABC",
      "priority": 0
    }
  },
  "default": {}
}

 

 

The group name is not directly used, the group ID is used, which can be found in the Get Groups API endpoint, and for the current user with the prism.user.groupsName console command.

 

It may be helpful to create a few example parameters using the parameter GUI interface, and observe the POST /api/v1/user-parameters payloads generated by the Sisense UI in the browser developer tools network tab, this can be useful in learning the exact format for different parameter types.

View solution in original post

DRay
Community Team Member
Community Team Member

Hello @ramansingh89 ,

I wanted to follow up to see if the solution offered by @JeremyFriedel worked for you.

If so, please click the 'Accept as Solution' button so that other users with the same questions can find the answer faster. If not, please let us know so that we can continue to help.

Thank you.

David Raynor (DRay)

View solution in original post

10 REPLIES 10

DRay
Community Team Member
Community Team Member

Hello @ramansingh89,

Thank you for your question. Can you let us know specifically what parameters you are wanting to update?

Thank you.

David Raynor (DRay)

Hi @DRay  so we have setup this user parameter and would like to find out if there is an API I can use to programmatically update the group values of that parameter?

ramansingh89_0-1712084979217.png

 

DRay
Community Team Member
Community Team Member

Hi @ramansingh89,

I'm not clear on what you mean by 'update the group values of that parameter", but I can point you to our API documentation. We have a couple of endpoints for groups, https://sisense.dev/guides/restApi/v0/?platform=linux&spec=L2023.11#/groups and https://sisense.dev/guides/restApi/v1/?platform=linux&spec=L2023.11#/groups

Please review those and let us know if there is any more information you need.'

Thank you.

David Raynor (DRay)

Hi @DRay 

I have added a screenshot below. We have a parameter called DWS_NAME and I would like to understand if there is any API I can use to add groups to this parameter. Eg: I want to add group "Client A" and its value should be "XXY"

ramansingh89_0-1712156369573.png

 

DRay
Community Team Member
Community Team Member

Hi @ramansingh89,

Thank you for the clarification. Can you look at this endpoint and let us know if that's what you're looking for? https://sisense.dev/guides/restApi/v1/?platform=linux&spec=L2023.11#/parameters/createUserParameter

David Raynor (DRay)

Hi @DRay 

I wonder what should be the value in API response. This is the example I see on the API docs

[
{
"op": "update",
"path": "/users/61f16367832227001b55e9eb",
"value": {
"value": "administrator",
"priority": 5
}
}
]

I wonder what should be value under these keys: op, path, priority

Hi @ramansingh89,

 

The parameters shown in the documentation are contextId, contextType, value and priority:

  "contextId": "5f02edfab456d2002c1b29dc",      "contextType": "users",      "value": "[email protected]",      "priority": 0

The path value does not occur in this specific documentation.

The contextType is set to either "users" or "groups"

Value is a email.

Priority is in integer, starting at 0.

Hi @JeremyFriedel 

In my DWS_NAME parameter, i basically want to add this

group name: clientabc
value: ABC

so in this case, what should be the API post payload?

Hi @ramansingh89,

 

The payload would look something like this to the endpoint POST /api/v1/user-parameters (Not all the parameters will match exactly on your server and use case, 660e9f7464a70f002df9a38c is the group ID of clientabc in this example)

 

{
  "name": "Example",
  "displayName": "Example",
  "hidden": false,
  "type": "string",
  "applicableAreas": [
    "Connections"
  ],
  "description": "",
  "users": {},
  "groups": {
    "660e9f7464a70f002df9a38c": {
      "contextId": "660e9f7464a70f002df9a38c",
      "contextType": "groups",
      "value": "ABC",
      "priority": 0
    }
  },
  "default": {}
}

 

 

The group name is not directly used, the group ID is used, which can be found in the Get Groups API endpoint, and for the current user with the prism.user.groupsName console command.

 

It may be helpful to create a few example parameters using the parameter GUI interface, and observe the POST /api/v1/user-parameters payloads generated by the Sisense UI in the browser developer tools network tab, this can be useful in learning the exact format for different parameter types.

DRay
Community Team Member
Community Team Member

Hello @ramansingh89 ,

I wanted to follow up to see if the solution offered by @JeremyFriedel worked for you.

If so, please click the 'Accept as Solution' button so that other users with the same questions can find the answer faster. If not, please let us know so that we can continue to help.

Thank you.

David Raynor (DRay)