Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How do you get the json values required by the Crowd group-level-admin REST method?

thomas.fregin March 8, 2022

Im using a local crowd environment for development and i would like to add a group admin via rest api as described in => https://docs.atlassian.com/atlassian-crowd/4.0.0/REST/#admin/1.0/group-level-admin-addGroupAdministrators
So far i couldn't understand the json schema needed to add a group administrator =>

{
    "id": "https://docs.atlassian.com/jira/REST/schema/list-of-directory-entity-rest#",
    "title": "List of Directory Entity Rest",
    "type": "array",
    "items": {
        "title": "Directory Entity Rest",
        "type": "object",
        "properties": {
            "id": {
                "title": "Directory Entity Id",
                "type": "object"
            },
            "type": {
                "type": "string",
                "enum": [
                    "USER",
                    "GROUP"
                ]
            }
        },
        "additionalProperties": false
    }}


As value for the id i used the groupId as mentioned here=>https://community.atlassian.com/t5/Crowd-questions/How-do-you-get-the-groupId-required-by-the-Crowd-group-level/qaq-p/1127534 which worked for a rest api get on a group but i dont understand the other values in the schema.

 

2 answers

0 votes
GRENIER REMI December 12, 2022

Hi

Are you able to use it ?

The entityName, it's the group name (base-64 encoded) right ?

I have the error:

Can not deserialize instance of java.util.ArrayList out of START_OBJECT token

Then, I have surunded the payload by "[" and "]". I get this error:

Unrecognized field "grantEntities" (Class com.atlassian.crowd.plugin.rest.entity.directory.DirectoryEntityRestDTO), not marked as ignorable
at [Source: org.apache.catalina.connector.CoyoteInputStream@4ac58d90; line: 1, column: 82] (through reference chain: com.atlassian.crowd.plugin.rest.entity.directory.DirectoryEntityRestDTO["grantEntities"])

Thanks

0 votes
Nikita May 16, 2022

On this endpoint you need to follow next json schema to post data

{
"grantEntities": [
{
"id": "directoryId-entityName",
"type": "GROUP"
},
{
"id": "directoryId-entityName",
"type": "USER"
}
]
}
curl --location --request POST '{{host}}/crowd/rest/admin/1.0/group-level-admin/{{groupId}}/admins' \
--header 'Authorization: Basic Base64 username:password' \
--header 'Content-Type: application/json' \
--data-raw '{
"grantEntities": [
{
"id": "{directoryId}-{entityName}",
"type": "GROUP"
},
{
"id": "{directoryId}-{entityName}",
"type": "USER"
}
]
}'

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events