I see many references online to use:
curl -X POST -d {"name":"groupname"} -ik -u application:password -H 'Content-Type: application/json' -H 'Accept: application/json' https://localhost/crowd/rest/usermanagement/1/user/group/direct?username=username --cookie cookies.txt
curl -i -u application_name:application_password --data '{"value": "my_password"}' http://localhost:8095/crowd/rest/usermanagement/1/authentication?username=my_username --header 'Content-Type: application/json' --header 'Accept: application/json' --cookie-jar cookies.txt
However, when I try to access the same REST using C# code it does not work. I have tried many variation of the code including changing it from "Post" to "DELETE". Any assistance would be greatly appreciated.
string url = "https://jira-ta-test.allstate.com/crowd/rest/usermanagement/1/user/group/direct?username=bashi";
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
var request = (HttpWebRequest)WebRequest.Create(url);
request.ContentType = "application/json";
request.Method = WebRequestMethods.Http.Post;
string ttt = Convert.ToBase64String(ASCIIEncoding.ASCII.GetBytes("xxxx" + ":" + "xxxx"));
request.Headers["Authorization"] = "Basic" + " " + ttt;
using (var streamWriter = new StreamWriter(request.GetRequestStream()))
{
//string json = "{\"key\":\"value\"}";
string json = "{\"name\":\"jira-testers\"}";
streamWriter.Write(json);
streamWriter.Flush();
streamWriter.Close();
}
var httpResponse = (HttpWebResponse)request.GetResponse();