Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Update User: Update the work and home email of the user: hasinitg through the following cURL command:

    Info

    Note: You have to use the correct SCIM ID by taking it either from the "create user" response or from the "list user" response.

    Code Block
    curl -v -k --user admin:admin -X PUT -d "{"schemas":[],"name":{"familyName":"gunasinghe","givenName":"hasinitg"},"userName":"hasinitg","emails":[{"value":"hasini@wso2.com","type":"work"},{"value":"hasi7786@gmail.com","type":"home"}]}" --header "Content-Type:application/json" https://localhost:9443/wso2/scim/Users/48f7cfe5-f0e3-4a67-af7e-d762aa9ab215

    You receive a response with 200 OK response and a payload containing the updated user representation.
     

  • Delete User: Delete the user with userName 'shyama' which was created through Management Console in the Identity Server:

    Code Block
    curl -v -k --user admin:admin -X DELETE https://localhost:9443/wso2/scim/Users/8dd71de9-e2f9-47b7-a5d4-a5f3862950ff -H "Accept: application/json"

    You receive a response with status 200 OK and the user is deleted from the user store. Similarly, you can manage groups by performing CRUD operations on the Group resource endpoint.


  • Filter User: Since CRUD operations have to be performed using SCIM ID which is unique to Service Provider, User REST endpoint also supports the filter operation. You can filter users based on their userNameusername, which is considered the unique user attribute in Carbon servers. You can use one of the following curl commands.

    Code Block
    curl -v -k --user admin:admin https://localhost:9443/wso2/scim/Users?filter=userName+Eq+%22adam%22

    OR

    Code Block
    curl -v -k --user admin:admin https://localhost:9443/wso2/scim/Users?filter=userNameEqadam

    You receive a response similar to the one below from which you can extract the SCIM ID to perform the rest of the operations.

    Code Block
    {"schemas":["urn:scim:schemas:core:1.0"],"totalResults":1,"Resources":[{"id":"6b14c23d-4811-4bbd-b653-04fcda2df266","profileUrl":"adam@blogspot.com","ims":["gmail"],"roles":["everyone"],"name":{"familyName":"adam","givenName":"adam"},"userName":"adam","emails":["adam@gmail.com"],"phoneNumbers":[{"value":"857657","type":"mobile"}],"addresses":[{"value":"Pannipitiya","type":"streetAddress"},{"value":"Sri Lanka","type":"country"}],"meta":{"lastModified":"2012-11-03T18:51:52","created":"2012-11-03T18:50:26"}}]}



  • Create Group: You can create groups either with or without members. The following command creates a group with a user.

    Info

    Note: When creating a group with users, you need to have that user already existing in the user store and provide its unique id. So create a new group named: 'engineer' with user 'adam' as a member.

    Code Block
    curl -v -k --user admin:admin --data "{"displayName": "engineer","members": [{"value":"6b14c23d-4811-4bbd-b653-04fcda2df266","display": "adam"}]}" --header "Content-Type:application/json" https://localhost:9443/wso2/scim/Groups

    You receive a response with the payload as indicated below and a response status 201 CREATED:

    Code Block
    {"id":"e8868723-30b2-4979-ae23-6d1de2e7d841","schemas":["urn:scim:schemas:core:1.0"],"displayName":"engineer","members":[{"value":"6b14c23d-4811-4bbd-b653-04fcda2df266","display":"adam"}],"meta":{"lastModified":"2012-11-03T20:33:16","created":"2012-11-03T20:33:16","location":"https://localhost:9443/wso2/scim/Groups/e8868723-30b2-4979-ae23-6d1de2e7d841"}}

    You can observe in the management console of IS, that the new group is listed under roles and user 'adam' is listed under users of that group.

     

  • List Groups: Now create another role through the Identity Server Management Console and list all the groups. Create a group named: 'manager' without any users added to it. When you list the groups you can see both groups are listed.

    Code Block
    {"schemas":["urn:scim:schemas:core:1.0"],
    "totalResults":2,"Resources":[
    {"id":"e8868723-30b2-4979-ae23-6d1de2e7d841","displayName":"engineer","members":[{"value":"6b14c23d-4811-4bbd-b653-04fcda2df266","display":"adam"}],"meta":{"lastModified":"2012-11-03T20:33:16","created":"2012-11-03T20:33:16","location":"https://localhost:9443/wso2/scim/Groups/e8868723-30b2-4979-ae23-6d1de2e7d841"}},
    {"id":"3f26902e-c22b-48bc-ba0a-c197a5710b70","displayName":"manager","meta":{"lastModified":"2012-11-03T20:39:25","created":"2012-11-03T20:39:25","location":"https://localhost:9443/wso2/scim/Groups3f26902e-c22b-48bc-ba0a-c197a5710b70"}}
    ]}



  • Update Group: Rename the group 'manager' to executive:

    Code Block
    curl -v -k --user admin:admin -X PUT -d "{"displayName": "executive"}" --header "Content-Type:application/json" https://localhost:9443/wso2/scim/Groups/3f26902e-c22b-48bc-ba0a-c197a5710b70

    You receive a response with 200 OK status and full JSON representation of the updated group.

     

  • Delete Group: You can delete the group using the unique SCIM Id of the group. The following command deletes the group: 'executive'.

    Code Block
    curl -v -k --user admin:admin -X DELETE https://localhost:9443/wso2/scim/Groups/3f26902e-c22b-48bc-ba0a-c197a5710b70 -H "Accept: application/json"



  • Filter Group: You can filter groups with the group display name . The following command filters using one of the following commands. These commands filter the group with display name: 'engineer'.

     

    Code Block
    curl -v -k --user admin:admin https://localhost:9443/wso2/scim/Groups?filter=displayName+Eq+%22engineer%22

     

    OR

    Code Block
    curl -v -k --user admin:admin https://localhost:9443/wso2/scim/Groups?filter=displayNameEqengineer

    Response:

    Code Block
    {"schemas":["urn:scim:schemas:core:1.0",null],"totalResults":1,"Resources":[{"id":"e8868723-30b2-4979-ae23-6d1de2e7d841","displayName":"engineer","members":[{"value":"6b14c23d-4811-4bbd-b653-04fcda2df266","display":"adam"}],"meta":{"lastModified":"2012-11-03T20:33:16","created":"2012-11-03T20:33:16","location":"https://localhost:9443/wso2/scim/Groups/e8868723-30b2-4979-ae23-6d1de2e7d841"}}]}

...