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();
Are you calling Jira or calling Crowd? Your URL endpoint is for Crowd but you tagged this question as Jira.
This is the Crowd API:
This is the Jira API:
It is for JIRA and it didn't work for JIRA either. I have used the reference you pointed to but wouldn't work so I started to google and try all different codes.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is the code from Postman and it works for me:
var client = new RestClient("http://localhost:8080/jira/rest/api/2/group/user?groupname=test&username=admin");
var request = new RestRequest(Method.DELETE);
request.AddHeader("Cache-Control", "no-cache");
request.AddHeader("Authorization", "Basic YWRtaW46YWRtaW4=");
IRestResponse response = client.Execute(request);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It keeps returning "403 - Forbidden" Error message. The id that I am using is an admin account. I have tried every variation that I can think of and it simply returns 403 Error. The same code that uses "GET" or "POST" methods works fine, just the "DELETE" method does not work. I am going crazy here.
string url = "https://jira-ta-test.allstate.com/jira/rest/api/2/group/user?groupname=JS-Admins&username=xxxx";
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
var request = (HttpWebRequest)WebRequest.Create(url);
request.ContentType = "application/json";
request.Accept = "application/json";
request.Method = "DELETE";
request.Headers.Add("Cache-Control", "no-cache");
string ttt = Convert.ToBase64String(ASCIIEncoding.ASCII.GetBytes("xxx" + ":" + "xxx"));
request.Headers["Authorization"] = "Basic" + " " + ttt;
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.