cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1635
Views
15
Helpful
6
Replies

Agent API to add attributes to agents

chad_meyer
Level 1
Level 1

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.

1 Accepted Solution

Accepted Solutions

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

 

View solution in original post

6 Replies 6

chad_meyer
Level 1
Level 1

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 

<agentAttributesAdded> tag I get a status 200, however nothing updates.

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?

Yeah all attributes have a default value so you don't need to specify one unless you want something specific.

 

david

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

 

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.

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