0

I'm testing WSO2 5.10 user creation via SCIM Rest API using the following curl command

curl -v -k --user admin:admin --data "{"schemas":[],"name":{"familyName":"Smith","givenName":"John"},"userName":"john","password":"password","emails":[{"primary":true,"value":"jsmith@test.com","type":"home"},{"value":"jsmith@test.com","type":"work"},{"value":"jsmith@test.com"}],"EnterpriseUser":{askPassword:"true"}}" --header "Content-Type:application/json" https://localhost:9443/scim2/Users 

It creates a user as expected but doesn't send an email to set up a password. However, when an admin tries to create a user through the management console for the same scenario, the user receives an email to set up a password. But not through this API request.

What am I doing wrong?

Community
  • 1
  • 1
Trinadh venna
  • 475
  • 3
  • 11

1 Answers1

1

You need to set the askPassword attribute under the urn:ietf:params:scim:schemas:extension:enterprise:2.0:User schema as true in the SCIM2 user create request. So try the request as below,

curl -v -k --user admin:admin --data '{"schemas":[],"name":{"familyName":"Smith","givenName":"John"},"userName":"john","password":"password","emails":[{"primary":true,"value":"jsmith@test.com","type":"home"},{"value":"jsmith@test.com","type":"work"},{"value":"jsmith@test.com"}],"urn:ietf:params:scim:schemas:extension:enterprise:2.0:User":{askPassword:"true"}}' --header "Content-Type:application/json" https://localhost:9443/scim2/Users

Please refer the official documentation for more details.

ashensw
  • 613
  • 1
  • 10
  • 17
  • I tried this request but i received the following error. I also tried the example in the documentation exactly but still got the same error {"schemas":["urn:ietf:params:scim:api:messages:2.0:Error"],"scimType":"invalidSyntax","detail":"Request is unparsable, syntactically incorrect, or violates schema.","status":"400"}* Closing connection 0 – Trinadh venna May 27 '20 at 18:08
  • Did you try with single quotes outside? It worked for me ex: curl -v -k --user admin:admin --data '{"xx":"xxxxx"}' --header "Content-Type:application/json" https://localhost:9443/scim2/Users – ashensw May 27 '20 at 19:38
  • 1
    If still not working better to try with a client such as postman. – ashensw May 27 '20 at 20:03
  • 2
    It worked through postman. This seems to be a windows related issue with making curl requests from the command line. – Trinadh venna May 27 '20 at 21:10