Adding Member to group using account databricks rest api
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2024 12:27 AM
Hi All,
I want to add a member to a group in databricks account level using rest api (https://docs.databricks.com/api/azure/account/accountgroups/patch) as mentioned in this link I could able to authenticate but not able to add member while using below body. Could please someone guide what i missed to add in body?
{"schemas": [
"urn:ietf:params:scim:api:messages:2.0:PatchOp"
],
"Operations":[
{
"op": "add",
"path": "/members",
"value": "xyz@abcdcomapny.com"
}
]
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2024 05:22 AM
Hi @Retired_mod
I have tried suggest body also but still member is not added to group. is there any other method that i can use add member to the group at account level
Thanks,
Phani.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2024 06:26 AM
@Retired_mod I am having the same issue as @pragarwal : after sending the api request and getting success code 200 the member is not added to the admin group.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2024 06:36 PM - edited 07-23-2024 07:40 PM
I am working on workspace-local group APIs on Azure Databricks though what @Retired_mod suggested did not work to me too. I checked the payload sent from Databricks workspace frontend and the following worked to me. Has API signature been changed but document hasn't been updated?
{
"schemas": [
"urn:ietf:params:scim:api:messages:2.0:PatchOp"
],
"Operations": [
{
"op": "add",
"value": {
"members": [
{
"value": "0000000000000000 (replace this with your Databricks USER ID)"
}
]
}
}
]
}
Edit:
I am using PATCH `/api/2.0/preview/scim/v2/Groups/{id}` API. I found another doc which looks like v2.1 API reference and the signature looks quite similar to what I used.
Account SCIM 2.1 Documentation (databricks.com)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2024 01:05 PM - edited 07-27-2024 06:08 PM
Looks like value should be an array. This worked to me to add three users to a group. Replace xxx/yyy/zzz with account ID.
{
"schemas": [
"urn:ietf:params:scim:api:messages:2.0:PatchOp"
],
"Operations": [
{
"path": "members",
"op": "add",
"value": [
{
"value": "xxx"
},
{
"value": "yyy"
},
{
"value": "zzz"
}
]
}
]
}
On the other hand, remove operation seems a bit different format. Add remove operation for each entry to remove. Here is an example to remove three users with ID xxx, yyy and zzz from a group.
{
"schemas": [
"urn:ietf:params:scim:api:messages:2.0:PatchOp"
],
"Operations": [
{
"op": "remove",
"path": "members[value eq \"xxx\"]"
},
{
"op": "remove",
"path": "members[value eq \"yyy\"]"
},
{
"op": "remove",
"path": "members[value eq \"zzz\"]"
}
]
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2024 02:47 PM - edited 09-06-2024 02:51 PM
Does the above work? I still can't quite figure it out. Any help would be much appreciated.
I know authentication is not an issue as I can use a lot of the other endpoints. I just can't figure out the correct body syntax to add a member to a group.
url= https://accounts.azuredatabricks.net/api/2.0/accounts/<account_id>/scim/v2/Groups/<group_id>
data= {
'schemas': [
'urn:ietf:params:scim:api:messages:2.0:PatchOp'
],
'Operations': [
{
'op': 'add',
'path': '/members',
'value': {
'value': '<user>@<domain>.com'
}
}
]
}
header={'Content-Type': 'Authorization': 'Bearer <token>'}
My code is
'schemas': [
'urn:ietf:params:scim:api:messages:2.0:Error'
],
'scimType': "Invalid JSON provided in request body. PATCH\nUnrecognized token 'schemas': was expecting ('true', 'false' or 'null')\n at [Source: schemas=urn%3Aietf%3Aparams%3Ascim%3Aapi%3Amessages%3A2.0%3APatchOp&Operations=op&Operations=path&Operations=value; line: 1, column: 8]",
'detail': 'Request is unparsable, syntactically incorrect, or violates schema.',
'status': '400'
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2024 03:02 PM
This payload worked for me:
URL: https://{databricks_instance}/api/2.0/account/scim/v2/Groups/{group_id}
PATCH with this payload