pingidentity / scim2

The UnboundID SCIM 2.0 SDK for Java
175 stars 72 forks source link

Unable to Create Group Status Code 400 When Name Is Provided #193

Closed ninhtranc42 closed 1 year ago

ninhtranc42 commented 1 year ago

Describe the bug Hi there, I'm having issues with communicating with the api to create a group. I provided the json body with the key "name" and the name of the group but it keeps returning 400 saying I did not provide a group name. I have gotten create user to work so it is not an issue with connecting with the api.

To Reproduce // group would be a string variable I pass in final JsonObject jsonObject = new JsonObject(); jsonObject.addProperty("name", groupName); jsonObject.addProperty("description", "This is a test group");

final JsonObject customData = new JsonObject(); customData.addProperty("groupOwner", "Tom Jones"); customData.addProperty("securityGroup", true); jsonObject.add("customData", customData);

jsonObject.addProperty("userFilter", "title eq \"Manager\"");

Expected behavior Return 200 status with the json of the group that was created.

Additional context I have been using both of these documentation: https://directory-api.pingone.com/api/docs/#!/group/createGroup https://apidocs.pingidentity.com/pingone/platform/v1/api/#post-create-group

kqarryzada commented 1 year ago

The documentation links that you've provided are references for the PingOne REST API, which is not a SCIM API. Are you trying to communicate with the PingOne API? If so, the logic you've provided above will not work if you send it as a POST request to a URL like https://api.pingone.com/v1/environments/{envID}/groups.

You mention that you've been successful with making requests for users. It's worth noting that PingOne has support for managing users via SCIM on the https://scim-api.pingone.com/environments/{envID}/v2/Users endpoint, but there is not support for group management via SCIM yet.

If this information is not relevant (for example, if you are not sending requests to PingOne), can you give some more detail about where you are sending this request? It would be helpful to know what SCIM server or service this is being sent to. If you are making requests to PingOne, you can replace the environment ID in the URL with {envID} to avoid placing your environment ID here.

kqarryzada commented 1 year ago

I realize now that the code above is using a generic JsonObject class, and is not using a SCIM SDK class like UserResource or GroupResource. If you are trying to work with the PingOne API on https://api.pingone.com/v1, then this question doesn't appear to be related to the SCIM SDK.

From the code above, it's not clear what the value of groupName is, but I would make sure that it is not null. It would also be worth trying to make that exact same request via curl or Postman. This would help indicate whether the issue is with the code and is not due to another problem. If the group name has a well-defined value and works when it is run manually, then I would encourage reaching out to Ping Identity Support about this.