10-25-2019 10:07 AM
Title pretty much says it all. The CCX campaign contact API documentation (among other sections) is inaccurate and incomplete. The section I'm speaking to is here: https://developer.cisco.com/docs/contact-center-express/#!campaign-contacts
The latest issue I found the other day has to do with the campaign contacts GET requests ("Get List of Pending Contacts for Campaign"). When sending an Accept header of "application/xml", this is the response I receive (with response code 406):
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<apiErrors>
<apiError>
<errorData>Not Acceptable</errorData>
<errorMessage>The resource identified by the request is only capable of generating response entities which have content characteristics not acceptable according to the accept headers sent in the request</errorMessage>
<errorType>Not Acceptable</errorType>
</apiError>
</apiErrors>
When making the same exact call with an Accept header of "application/json", this is what is returned:
{
"campaign": {
"@name": "campaignname",
"refURL": "https://<ccxserverfqdn>/adminapi/campaign/2"
},
"csvdata": "account number, first name, last name, phone1, phone2, phone3, dial time, call result, callback number, call status, call result 01, call result 02, call result 03, last number dialled, calls made to phone 01, calls made to phone 02, calls made to phone 03, retry, num missed call back, calls made to callback number\n\nABC123, John, Smith, 5555551234, 5555551235, , 7:0, 14, 5555551234, 6, 0, 0, 0, 0, 0, 0, 0, false, 0, 0\n"
}
The Developer reference documentation here: https://developer.cisco.com/docs/contact-center-express/#!get-list-of-pending-contacts-for-campaign/get-list-of-pending-contacts-for-campaign ...states that both Accept headers (xml and json) are supported. This is apparently not the case. This also means that XML based application integrations won’t work without also integrating with JSON (and must already integrate with CSV). Not a great API design in my opinion.
The fields returned from UCCX in the campaign contacts list are also incomplete. In short, the list of fields on the API Reference guide (which is treated as the authoritative source) is not representing the different fields across versions. For example, UCCX version 11.0 and higher include a field “calls made to callback number”. How would I know this? I would hope the API/Developer Reference Guide includes this information for Reference.
Another, the campaign contacts data for results and status is returned as integers in many of the status and result fields, but no representation is in the API Reference Guide on how those integers tie to actual meaningful representations. See fields above in the json output, value 14 and value 6 (both result fields). The API reference documentation should include what those values (and all other possible values) represent. I had to use the DB Schema Guide for a close version of UCCX to get the meaning of each value (and even that is assuming...not a great idea during API integration). I would have hoped that this page, specifically designed for the data structure of campaign contacts, would include that information, but it did not. https://developer.cisco.com/docs/contact-center-express/#!data-structure-for-campaign-contacts/data-structure-for-campaign-contacts
Could someone please update the API references to be accurate and more complete?
11-02-2021 12:35 PM
I had success using JSON instead of XML and using an "Accept" header of "*/*"
I used this site to convert my XML to JSON: https://www.freeformatter.com/xml-to-json-converter.html#ad-output
I then used Postman to create the correct request structure.
I selected Java - Unirest in the code snippet section to get the correct escape character sequence.
I copied the text from the body section of the code snippet and put that into a String within the CCX Editor in the format:
U"{\r\n \"@noNamespaceSchemaLocation\": \"campaignContacts.xsd\",\r\n \"campaign\": {\r\n \"@name\": \"CAMPAIGN\",\r\n \"refURL\": \"https://uccx-server/adminapi/campaign/111\"\r\n },\r\n \"allowDuplicateContacts\": \"true\",\r\n \"csvdata\": \"Phone1\\n4153214321\"\r\n}"
I then added an "Accept" header to the Make REST step with a value of "*/*"
02-07-2022 12:56 PM - edited 02-07-2022 12:58 PM
@coryalbert wrote:
I had success using JSON instead of XML and using an "Accept" header of "*/*"
I suspect Cory accidentally flipped JSON and XML in this sentence. For anyone else that finds this, I had the same issue and was able to get XML working by adding the "Accept: */*" header (which Postman adds by default, thus why it worked but the CCX Make REST Call step got a 406 response). This was in addition to "Content Type: application/xml" (which is actually the Accept-Encoding HTTP header.)
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