UCCX 10 script REST Call

Version 1
    This document was generated from CDN thread

    Created by: Finnur Eiriksson on 15-01-2014 02:46:20 AM
    I need help with this new step in UCCX scripts. I'm new to rest api calls and the instructions I have found so far are little help.

    I'm trying to add contacts to an outbound campaign. I have been able to get information about the campaign using the REST call, but Posting a new contact is not working. How does the contact information need to be formatted and where do I attach it to the call?

    The developer guide says this is the sample XML input
     1<?xml version="1.0" encoding="UTF-8"?>
     2<campaignContacts xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:noNamespaceSchemaLocation="campaignContacts.xsd">
     3<campaign name="Campaign1">
     4<refURL>https://uccx-server/adminapi/campaign/200</refURL>
     5</campaign>
     6  <csvdata>Account Number, First Name, Last Name ,Phone1, Phone2, Phone3, Dial Time
     7           ABCD1234, John , Doe, 1401111, 1402222, 1403333, 12:35
     8           ABCD1235, Jane , Smith, 1504444, 1505555, 1506666, 12:35
     9  </csvdata>
    10</campaignContacts>
    I tried putting this in the Body, did format it a few different ways but nothing worked. Did get error 415 as a response.
    One of the formats I used is here:
    1U"<?xml version=\"1.0\" encoding=\"UTF-8\"?><campaignContacts xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"campaignContacts.xsd\"><campaign name=\"Callback\"><refURL>http://10.180.62.102/adminapi/campaign/2</refURL></campaign><csvdata>Account Number, First Name, Last Name ,Phone1, Phone2, Phone3, Dial Time\nABCD1234, John , Doe, 1401111, 1402222, 1403333, 12:35\nABCD1235, Jane , Smith, 1504444, 1505555, 1506666, 12:35</csvdata></campaignContacts>"

    Can someone please help?

    Finnur

    Subject: RE: UCCX 10 script REST Call
    Replied by: Ishita Das on 15-01-2014 04:27:58 AM
    Finnur Eiriksson:
    I need help with this new step in UCCX scripts. I'm new to rest api calls and the instructions I have found so far are little help.

    I'm trying to add contacts to an outbound campaign. I have been able to get information about the campaign using the REST call, but Posting a new contact is not working. How does the contact information need to be formatted and where do I attach it to the call?

    The developer guide says this is the sample XML input
     1<?xml version="1.0" encoding="UTF-8"?>
     2<campaignContacts xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:noNamespaceSchemaLocation="campaignContacts.xsd">
     3<campaign name="Campaign1">
     4<refURL>https://uccx-server/adminapi/campaign/200</refURL>
     5</campaign>
     6  <csvdata>Account Number, First Name, Last Name ,Phone1, Phone2, Phone3, Dial Time
     7           ABCD1234, John , Doe, 1401111, 1402222, 1403333, 12:35
     8           ABCD1235, Jane , Smith, 1504444, 1505555, 1506666, 12:35
     9  </csvdata>
    10</campaignContacts>
    I tried putting this in the Body, did format it a few different ways but nothing worked. Did get error 415 as a response.
    One of the formats I used is here:
    1U"<?xml version=\"1.0\" encoding=\"UTF-8\"?><campaignContacts xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"campaignContacts.xsd\"><campaign name=\"Callback\"><refURL>http://10.180.62.102/adminapi/campaign/2</refURL></campaign><csvdata>Account Number, First Name, Last Name ,Phone1, Phone2, Phone3, Dial Time\nABCD1234, John , Doe, 1401111, 1402222, 1403333, 12:35\nABCD1235, Jane , Smith, 1504444, 1505555, 1506666, 12:35</csvdata></campaignContacts>"

    Can someone please help?

    Finnur

    HI Finnur,
    Can you please try to make the rest call using any standard rest clients like poster provided by Firefox before making use of the rest step ?
    In the format you had copy pasted I saw there is "U" in the begining. Is it copy paste error or the same input was provided in the Rest step.
    I had changed your input only and gave the following as input with rest url : "https://10.78.95.167/adminapi/campaign/2/contacts" for POST.
     1
     2<campaignContacts>
     3<campaign name="test">
     4<refURL>https://10.78.95.167/adminapi/campaign/2</refURL>
     5</campaign>
     6  <csvdata>Account Number, First Name, Last Name ,Phone1, Phone2, Phone3, Dial Time
     7           ABCD1234, John , Doe, 1401111, 1402222, 1403333, 12:35
     8           ABCD1235, Jane , Smith, 1504444, 1505555, 1506666, 12:35
     9  </csvdata>
    10</campaignContacts>
    and it got created and the campaign is showing 2 remaining contacts.
    Please let me know if you have any other queries on this.

    Thanks,
    Ishita

    Subject: RE: UCCX 10 script REST Call
    Replied by: Finnur Eiriksson on 15-01-2014 07:00:10 AM
    Hi Ishita

    I did try using Poster before and got the same errors there as in the script. I did try changing a few more parameters now and found out that I was using the wrong content type. Application/XML gave me error 415, text/xml works fine.

    Thank you for your help.

    Finnur

    Subject: RE: UCCX 10 script REST Call
    Replied by: Ravi Kiran Vadlamani on 15-01-2014 11:33:09 PM
    HI Finnur,
    We found this issue in a seperate test as well. There are 3 REST APIs in contact managament which support only text/xml and not application/xml.
    We will be fixing this in the next release. text/xml will continue to work even after the fix.

    Thanks,
    -ravi.