Adding Campaign Contacts

Version 1
    This document was generated from CDN thread

    Created by: Aaron Harrison on 30-01-2013 03:48:18 PM
    I had hoped my first post on this subject was going to be of the 'look at this clever thing I did' variety, but I'm afraid it's going to be the other kind.
    I've played with this API some today, and I'm able to retrieve and add campaigns to the system no problem.
    I've added one, which I can retrieve like so:
    GET http://192.168.0.92:8080/adminapi/campaign/
    Returns:
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?><campaigns><campaign><self>http://192.168.0.92:8080/adminapi/campaign/2</self><campaignId>2</campaignId><campaignName>test</campaignName><enabled>false</enabled><description>tset</description><startTime>02:00</startTime><endTime>23:59</endTime><timeZone>Greenwich Mean Time</timeZone><campaignType>AGENT</campaignType><dialerType>DIRECT_PREVIEW</dialerType><pendingContacts>0</pendingContacts></campaign></campaigns>
    Now... I can't seem to submit any sort of campaignContacts object without it falling over.
    For example, I try to add the sample call from the developer guide, but with 'URL' substituted for the URL of my campaign (presuming that's what I'm supposed to do - it seems to work in other requests):
    POST http://192.168.0.92:8080/adminapi/campaign/2/contacts
    Content:
    <?xml version="1.0" encoding="UTF-8"?>
    <campaignContacts xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="campaignContacts.xsd">
    <campaign name="Campaign1">
    <refURL>http://192.168.0.92:8080/adminapi/campaign/2<refURL>
    </campaign>
    <csvdata>
    Account Number, First Name, Last Name ,Phone1, Phone2, Phone3, Dial Time
    ABCD1234, John , Doe, 1401111, 1402222, 1403333, 12:35
    ABCD1235, Jane , Smith, 1504444, 1505555, 1506666, 12:35
    </csvdata>
    </campaignContacts>
    This returns a HTML error 400:
     
    <!-- custom Cisco error page --><html>    <head>        <title>            Cisco System - Error report        </title>        <style type="text/css">            a {                color: #316984;                text-decoration: none;            }            a:hover {                color: #316984;                text-decoration: underline;            }            a:visted {                color: #316984;                text-decoration: none;            }            body {                background-attachment: fixed;                background-color: #ffffff;                background-repeat: no-repeat;                color: #316984;                font-family: arial,helvetica,sans-serif;            }            #content {                border: 1px solid #d6d7d6;                font-size: 93.5%;                margin: 0px 10% 30px 10%;            }            #content-header {                background-color: #eeeeee;                border-bottom: 1px solid #666666;                color: #666666;                font-size: 124.5%;                padding: 5px 15px 5px 15px;            }            #copyright {                font-size: 75%;                margin: 0px 10% 0px 10%;                padding: 3px 0px 0px 0px;                text-align: right;            }            img {                display: block;                margin: 0px 0px 20px 0px;            }            #logo {                margin: 30px 10% 0px 10%;            }            p {                padding: 5px 15px 5px 15px;            }            pre {                padding: 5px 15px 5px 30px;            }        </style>    </head>    <body>        <div id="logo">            <img src="/ciscologo.gif" alt="Cisco Systems, Inc." />        </div>        <div id="content">            <div id="content-header">HTTP Status 400 - Bad Request            </div>            <p>                <b>                    type:               </b> Status report            </p>            <p>                <b>message:               </b> Bad Request            </p>            <p>                <b>description:               </b> The request sent by the client was syntactically incorrect (Bad Request).            </p>        </div>    </body></html>
     
    If I remove the campaign section like so:
     
    <?xml version="1.0" encoding="UTF-8"?>
    <campaignContacts xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="campaignContacts.xsd">
     
    <csvdata>
    Account Number, First Name, Last Name ,Phone1, Phone2, Phone3, Dial Time
    ABCD1234, John , Doe, 1401111, 1402222, 1403333, 12:35
    ABCD1235, Jane , Smith, 1504444, 1505555, 1506666, 12:35
    </csvdata>
    </campaignContacts>
    I get a parse error which seems reasonable:
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?><apiErrors><apiError><errorData></errorData><errorMessage>cvc-complex-type.2.4.a: Invalid content was found starting with element 'csvdata'. One of '{campaign}' is expected.</errorMessage><errorType>InvalidInput</errorType></apiError></apiErrors>
    But as soon as I enter any campaign info it breaks.
     
    Thanks for any input...
     
    Aaron

    Subject: RE: Adding Campaign Contacts
    Replied by: Aaron Harrison on 30-01-2013 04:39:30 PM
    Right - figured it out, eventually!
    The documentation has an error on the sample input:
    <refURL>URL<refURL>
    Should (of course) be 
    <refURL>URL</refURL>
    I was sure I tried submitting the result of a GET campaign/id/contacts, but I evidently didn't do that properly earlier.
    Happy days!

    Subject: RE: Adding Campaign Contacts
    Replied by: Kavitha Prakash on 01-02-2013 03:28:27 AM
    Hi Aaron,
    The developer guide is updated to correct the refURL. It will be posted to CDN shortly. Thanks!
    Kavitha

    Subject: RE: Adding Campaign Contacts
    Replied by: Aaron Harrison on 01-02-2013 03:39:57 AM
    Hi Kavitha
    Great!
    I'm looking forward to getting a lot of stuff done with this API, it has been wanted for a long time!
    Thanks
    Aaron