cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements
1169
Views
0
Helpful
11
Replies
Highlighted
Contributor

UCCE 10.5 API - AgentSkill Change

Hey.

 

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 i PostMan it works fine (Same username/password  and same XML).

 

Here is my cSharp code where im using RestSharp:

 

                    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 my XML in sending;

<?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 ?

 

Best regards

Thomas

11 REPLIES 11
Highlighted

Hi NICNGUYEN,

 

Did you ever try to use the agent API to change agent's attributes or password? I am trying to change the agent's password using the agent API.

 

When I query the agent's changeStamp I used the admin login credential (FQDN). No issues as I was able to get the latest changeStamp. I switch over to supervisor login credential when I want to change the password. The web request returns "401 Unauthorized". Any idea how to setup supervisor login name? 

 

Thanks.

 

danny

 

 

 

 

Highlighted
Beginner

Hi Thomas,

 

I am trying to used Agent API to change agent's password. How did you set up the supervisor login name and credential?

 

I am getting 401 Not Authorized when I use the supervisor login credential to change agent's password.

 

First, I used the administrator FQDN to get the changeStamp and that works fine. But switch to supervisor login credential when trying to update the agent's password. That is when I get the 401 back.

 

Thanks in advance.

 

Danny

 

 

 

Highlighted

Hey Danny.

Which version are you using ?

 

In version 10.x you have to use a supervisor login (and the supervisor has to be a supervisor for the user you are trying to change) username is "supervisorname"

In version 11.x you have to use an administrator login to do the task

 

From the documentation

 

Agent API:

  • Supervisors can only see and update agents who are on their teams.
  • When updating an agent, supervisors can only change the following parameters:
    • skillGroups
    • defaultSkillGroup
    • skillGroupsAdded
    • skillGroupsRemoved
    • agentAttributes
    • password

 

Best regards Thomas

Highlighted

Thomas,


Thanks for the fast response.


I am using UCCE 10.5.


How did you set-up the supervisor login credential? My UCCE admin, setup it for me to use and I am getting 401 Unauthorized.


Thanks.
Highlighted

Hey
The login has to be a supervisor (not admin)

This is from the documentation - But I think im using supervisorname@domain for the supervisor login
Authentication
To authenticate:
* Administrators must provide a fully qualified user name (for example, user@cisco.com) and password.
* Supervisors must provide their agent username and password.

Highlighted

I used a lot of time with this (version 10.5 has not the best API) before I got it to work
Test it with Postman - and try either with "supervisorname@domain" or with "normal" login (supervisor's agent login/password)
Highlighted

Our client does not allow third-party/open-source software on their laptop. So, I basically wrote a C# console app and test it on my company's laptop got it to work using UCCE 11.5. UCCE 11.5 is more stable and I am using admin (FQDN). Don't need supervisor login name as compare to UCCE 10.5.

 

Thanks.

 

danny

 

 

 

 

Highlighted

Hi Thomas,

 

I intentionally gave it the wrong login id or password. I am getting a 401 "Not Authorized".  Any idea what could be the issues?

 

Thanks.

 

Danny

Highlighted

Admin login credential (FQDN) is fine as I am able to use it to query back agent's information and scrap for "changeStamp".



The supervisor login name that I am using does not have @domain. That is what my UCCE administrator created reading the doc.


"But I think im using supervisorname@domain for the supervisor login
Authentication". So you have a domain in your supervisor name? That is one difference between your and my.


I will let my UCCE admin know about this and test it out.


Thanks.


Highlighted

For changing agents password you have to use a supervisor login. Admin login will not work. And the supervisor has to be a supervisor for the agents team