3 people found this helpful
I had this issue at first as well. You need to create an array of URI's of members you are trying to add. You are missing the opening bracket in your second example and can skip the curly brackets.
Mine looks like this:
curl -H "Content-Type: application/json" -H "Accept: application/json" -X POST --data '["https://*********.com/api/core/v3/people/2004"]' https://*********.com/api/core/v3/securityGroups/1008/members
How are you. I have the same problem with "Add" for ASP.NET and i'm getting 400 bad request error.
here is my code:
string credentials = Convert.ToBase64String(Encoding.ASCII.GetBytes(******* + ":" + **************));
client.Headers[HttpRequestHeader.Authorization] = "Basic " + credentials;
client.Headers[HttpRequestHeader.Accept] = "application/json";
client.Headers[HttpRequestHeader.ContentType] = "application/json";
client.Encoding = System.Text.Encoding.UTF8;
response = client.UploadString("http://*******/api/core/v3/securityGroups/1001/members/", sRestMethodType, http://******/api/core/v3/people/2026 );
I have found the solution. Needs bracket.
thanks, this worked
Hi Gregory Dunn - I had a similar issue and was able to resolve it after going this thread. Thanks.
Would you be kind enough to answer my question -
How would I go about adding large number of users through this method? The question states that the users that need to be inserted are hardcoded.
However, I am trying to add users through a loop I created and Concatenating the UserID to be inserted at runtime with the API URL.
I don't think it supports batch operations. I'd personally write a small controlling webpage which accepts a comma-separated list of UserIDs, and loops over it to call the REST API multiple times. We've done this for a bunch of things, like bulk deleting Groups, moving content, etc. Once you've done one page, it's easier to adapt it for other operations.