11-01-2017 07:39 AM
Hey All.
When i try to update skills on an agent thru the API (on a c# code) on a ucce 10.5 I keep getting error 415 (unsupported media type).
This failure is only comming on my post calls - so i can without problem get the skills on my agent, but i cannot change them (Via Post).
If I try to change them thrue PostMan it works fine (Same username/password and same XML).
I am using the c# extension RestSharp
Here is my cSharp code:
System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate (object obj, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; };
System.Net.ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls;
var client = new RestClient();
client.BaseUrl = new Uri(adminUrl);
client.Authenticator = new HttpBasicAuthenticator(adminUid, adminPwd);
var request = new RestRequest();
request.Resource = "/unifiedconfig/config/operation";
request.Method = Method.POST;
request.AddHeader("Content-Type", "application/xml");
request.AddHeader("Cache-Control", "no-cache");
request.AddHeader("Accept", "application/xml");
request.Parameters.Clear();
request.RequestFormat = RestSharp.DataFormat.Xml;
request.AddBody(xml);
IRestResponse response = client.Execute(request);
And here is the XML
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<operation>
<operationType>update</operationType>
<refURLs>
<refURL>/unifiedconfig/config/agent/9017</refURL>
</refURLs>
<changeSet>
<agent>
<skillGroupsRemoved>
<skillGroup>
<refURL>/unifiedconfig/config/skillgroup/5738</refURL>
</skillGroup>
</skillGroupsRemoved>
</agent>
</changeSet>
</operation>
The username and password is an Supervisor and the agent is in the team.
Has anyone had this problem ?
01-18-2018 02:08 PM
Hi Thomas,
At present you have:
request.AddHeader("Content-Type", "application/xml");
My understanding is that you should replace this with:
request.ContentType = "application/xml";
C.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide