简体   繁体   中英

How to add roles/group while adding a user in wso2 is 5.9.0 using scim2 apis?

I am trying to create a user using this api- https://localhost:9443/scim2/Users

How do i add this user to a created group? Can you please Provide the payload

My Payload-

{
    "schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"],
    "name": {
        "familyName": "jackson",
        "givenName": "kim"
    },
    "userName": "test2",
    "password": "abc123",
    "postalcode":"56789",
    "profileUrl":"gmail.com",
    "emails": [
        {
            "type":"default",
            "value":"a@gmail.com"
        },
        {
            "value": "kim.jackson@gmail.com",
            "type": "home"
        },
        {
            "value": "kim_j@wso2.com",
            "type": "work"
        }
    ]
}   

Following will add the user "Kris" with SCIM id "81cbba1b-c259-485d-8ba4-79afb03e5bd1" to the group using "Patch" operation.

{
   "schemas":[
      "urn:ietf:params:scim:api:messages:2.0:PatchOp"
   ],
   "Operations":[
      {
         "op":"add",
         "value":{
            "members":[
               {
                  "display":"Kris",
                  "$ref":"https://localhost:9443/scim2/Users/81cbba1b-c259-485d-8ba4-79afb03e5bd1",
                  "value":"81cbba1b-c259-485d-8ba4-79afb03e5bd1"
               }
            ]
         }
      }
   ]
}

Bellow is the full CURL command. You can always refer [1] for API information.

curl -v -k --user admin:admin -X PATCH -d '{"schemas":["urn:ietf:params:scim:api:messages:2.0:PatchOp"],"Operations":[{"op":"add","value":{"members":[{"display": "Kris","$ref":"https://localhost:9443/scim2/Users/81cbba1b-c259-485d-8ba4-79afb03e5bd1","value": "81cbba1b-c259-485d-8ba4-79afb03e5bd1"}]}}]}' --header "Content-Type:application/json" https://localhost:9443/scim2/Groups/a43fe003-d90d-43ca-ae38-d2332ecc0f36

[1] https://docs.wso2.com/display/IS570/apidocs/SCIM2-endpoints/#!/operations#GroupsEndpoint#patchGroup

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM