07-20-2020 06:58 AM
Hey everyone,
I am new to APIs so bear with me. I am trying to create an API via Agent API that will add attributes to an agents, ultimately a pool of agents determined by SQL query, however I cannot get a single user updated. Here is the string which is producing a 405 error when I try to POST:
<agent> <refURL>/unifiedconfig/config/agent/5124</refURL> <agentAttributes> <agentAttribute> <attributeValue>5</attributeValue> <attribute> <refURL>/unifiedconfig/config/attribute/5430</refURL> <name>ECE_Email_Test</name> <dataType>4</dataType> <description>Test queue</description> </attribute> </agentAttribute> </agentAttributes> </agent>
Any assistance would be greatly appreciated.
Solved! Go to Solution.
07-20-2020 06:02 PM - edited 07-20-2020 06:04 PM
Here's an a PCCE request to add an attribute to an agent.
Method: PUT
Authorization: Basic using a supervisor of that team for credentials.
Headers: Content-Type application/xml
Body: raw/XML
First you need to GET your agent information and find out the change stamp and use it below.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<agent>
<changeStamp>6</changeStamp> ###Current change stamp.
<agentAttributes>
<agentAttribute>
<attribute>
<refURL>/unifiedconfig/config/attribute/5045</refURL>
</attribute>
</agentAttribute>
</agentAttributes>
</agent>
david
07-20-2020 12:40 PM
Update: I did some more digging and found I had a couple of things wrong. I updated to the following code:
<operation> <operationType>update</operationType> <refURLs> <refURL>/unifiedconfig/config/agent/5124</refURL> </refURLs> <changeSet> <agent> <agentAttributesAdded> <agentAttribute> <attribute> <refURL>/unifiedconfig/config/attribute/5430</refURL> </attribute> </agentAttribute> </agentAttributesAdded> </agent> </changeSet> </operation>
and am receiving the following error:
<errorDetail xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="resourceErrorDetail"> <refURL>/unifiedconfig/config/agent/5124</refURL> <apiErrors> <apiError> <errorData>attributesAdded</errorData> <errorMessage>This field is not supported for this operation.</errorMessage> <errorType>invalidInput.mustBeBlank</errorType> </apiError> </apiErrors> </errorDetail> <errorMessage>There were one or more errors processing the following request: update /unifiedconfig/config/agent/5124</errorMessage> <errorType>operation.resourceErrors</errorType>
Per the operation API this should work, however am not sure why. If I remove the
07-20-2020 04:18 PM - edited 07-20-2020 04:21 PM
I think there must be more missing, as you don't list the attribute proficiency you're adding.
So assuming your attributes are based on proficiency of 1-10 vs boolean for instance, I'd think you'd need to add the level in there, not just that you're adding the attribute itself. In other words, you're adding English_Sales level 3 or whatever to the agent.
It looked like you had that in your original post but not this one? Or are you just going with the default value, since it looks like that might be allowed?
07-20-2020 06:05 PM
Yeah all attributes have a default value so you don't need to specify one unless you want something specific.
david
07-20-2020 06:02 PM - edited 07-20-2020 06:04 PM
Here's an a PCCE request to add an attribute to an agent.
Method: PUT
Authorization: Basic using a supervisor of that team for credentials.
Headers: Content-Type application/xml
Body: raw/XML
First you need to GET your agent information and find out the change stamp and use it below.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<agent>
<changeStamp>6</changeStamp> ###Current change stamp.
<agentAttributes>
<agentAttribute>
<attribute>
<refURL>/unifiedconfig/config/attribute/5045</refURL>
</attribute>
</agentAttribute>
</agentAttributes>
</agent>
david
07-21-2020 04:56 AM
Thanks David. That worked for me but you have to specify the agent URL in its entirety. I also missed that this used supervisor authentication and that the user needed to be specified as a supervisor for the team. This is a good start but from the documentation I should be able to use the operation API along with the <agentAttributesAdded> tag and specify all agents in a single call. That way also eliminates the need for the <changeStamp> tag. I just found there is a developer forum for contact center so will try over there. Thank you for all of your assistance.
07-27-2020 09:35 AM
For everyone out there it looks like there is a known bug with the "<agentAttributesAdded>" tag in UCCE 11.6. The workaround is to upgrade to v12.0. Link to bug:
https://bst.cloudapps.cisco.com/bugsearch/bug/CSCvk31127/?rfs=iqvred
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