AnsweredAssumed Answered

Finesse REST API

Question asked by SEC_ContactCenter_Support1 on Jul 24, 2016
Latest reply on Jul 25, 2016 by dekwan

Hi !

I am trying to change agent state using REST API. I am using C# as a programming language.

here is the code that I wrote :

ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(AcceptAllCertifications);

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(new Uri("https://url:8445/finesse/api/User/agent2"));
request.Credentials = new NetworkCredential("agent2", "12345");

 

request.Method = "POST";
request.ContentType = "application/xml";
// request.Accept = "application/xml";

XElement redmineRequestXML =
new XElement("User",
new XElement("state", "READY"),
new XElement("extension", "3010")
);

byte[] bytes = Encoding.UTF8.GetBytes(redmineRequestXML.ToString());

request.ContentLength = bytes.Length;

 

using (Stream putStream = request.GetRequestStream())
{
putStream.Write(bytes, 0, bytes.Length);
}

// Log the response from Redmine RESTful service
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
using (StreamReader reader = new StreamReader(response.GetResponseStream()))
{
MessageBox.Show(reader.ReadToEnd());
}

And I am getting this error :

The remote server returned an error: (405) Method Not

 

so please any idea could help solving this issue ?

Outcomes