Legacy Dev Forum Posts

 View Only

Sign Up

'Malformed syntax' error for ContactList POST request

  • 1.  'Malformed syntax' error for ContactList POST request

    Posted 06-05-2025 18:13

    Duncan_Stewart | 2018-08-10 13:34:44 UTC | #1

    Working on updating my ContactList(s) for an outbound campaign, and getting the dreaded 'malformed syntax' error. Can someone check on your side to see what the specifics of the error are (the details[] node is empty)? The context id is 74b362c8-3c41-4853-82c3-b33fa1ccb860, from this morning.

    My request looks like this: {"phoneNumberStatus":"", "callable":true, "data":"{18 Digit Contact ID=003e000000u65ITAAY, 18 Digit SFDC ID=a19e0000002yqXyAAI, Patient IVR: Patient IVR Id=ivr-08/10/18-557814, Patient: First Name=Joe, Patient: Last Name=Test, Patient: Mailing Zip/Postal Code=80019, Phone=7813545262}", "contactListId":"e287404b-e731-4168-99fe-af1c152037fd", "name":""}


    tim.smith | 2018-08-10 14:07:19 UTC | #2

    The body for POST /api/v2/outbound/contactlists/{contactListId}/contacts is an array of DialerContact, not a single object. In this case, that error is actually correct since the request you're sending, when attempting to parse it as an array, is malformed.


    Duncan_Stewart | 2018-08-10 14:18:52 UTC | #3

    I get the same error if I have multiple records in "data": {"phoneNumberStatus":"","callable":true,"data":"{18 Digit Contact ID=003e000000u65ITAAY, 18 Digit SFDC ID=a19e0000002yqYXAAY, Patient IVR: Patient IVR Id=ivr-08/10/18-557818, Patient: First Name=Joe, Patient: Last Name=Test, Patient: Mailing Zip/Postal Code=80019, Phone=7813545262},{18 Digit Contact ID=003e000000u65J7AAI, 18 Digit SFDC ID=a19e0000002yqYYAAY, Patient IVR: Patient IVR Id=ivr-08/10/18-557819, Patient: First Name=Joe, Patient: Last Name=Test, Patient: Mailing Zip/Postal Code=null, Phone=7813545262}","contactListId":"e287404b-e731-4168-99fe-af1c152037fd","name":""}

    "contextId":"de304e78-1ba9-49be-8aba-25187bb5e7e6"

    Should "data" values be wrapped in '[]'; is that the issue? [ { "name": "", "contactListId": "", "data": {}, "callable": true, "phoneNumberStatus": {} } ]


    tim.smith | 2018-08-10 14:21:52 UTC | #4

    Duncan_Stewart, post:3, topic:3353
    Should "data" values be wrapped in '[]'; is that the issue? [ { "name": "", "contactListId": "", "data": {}, "callable": true, "phoneNumberStatus": {} } ]

    Yes, that's correct.


    Duncan_Stewart | 2018-08-10 14:25:07 UTC | #5

    Hmm ... still not happy:

    {"phoneNumberStatus":"", "callable":true, "data":"[ {18 Digit Contact ID=003e000000u65ITAAY, 18 Digit SFDC ID=a19e0000002yqYhAAI, Patient IVR: Patient IVR Id=ivr-08/10/18-557822, Patient: First Name=Joe, Patient: Last Name=Test, Patient: Mailing Zip/Postal Code=80019, Phone=7813545262}, {18 Digit Contact ID=003e000000u65J7AAI, 18 Digit SFDC ID=a19e0000002yqYiAAI, Patient IVR: Patient IVR Id=ivr-08/10/18-557823, Patient: First Name=Joe, Patient: Last Name=Test, Patient: Mailing Zip/Postal Code=null, Phone=7813545262}]", "contactListId":"e287404b-e731-4168-99fe-af1c152037fd", "name":""}

    Error 400 ... contextId: "a5ebb8c0-4dfe-4308-9ae2-92690d238716"


    tim.smith | 2018-08-10 14:43:48 UTC | #6

    Use the format you posted previously that I quoted. The array brackets go around the full object. I intended to confirm that the format posted was correct; the property data is not an array.

    Additionally, data is an object that contains key value pairs (strings) of contact list column data. Be sure you format the request as such. It looks like you're trying to include info for two contacts. Each contact you're adding must be one object in the root array element.


    Duncan_Stewart | 2018-08-10 17:10:25 UTC | #7

    I'm still missing something - I did (finally) see the lack of name:value pairing in 'data', and fixed the value type returned for phoneNumberStatus, and I'm wrapping each individual entry/contact in []:

    [{"phoneNumberStatus":{},"callable":true,"data":{"Patient: Mailing Zip/Postal Code":"80019","18 Digit SFDC ID":"a19e0000002yqa9AAA","18 Digit Contact ID":"003e000000u65ITAAY","Patient: Last Name":"Test","Patient: First Name":"Joe","Phone":"7813545262","Patient IVR: Patient IVR Id":"ivr-08/10/18-557850"},"contactListId":"e287404b-e731-4168-99fe-af1c152037fd","name":""}],[{"phoneNumberStatus":{},"callable":true,"data":{"Patient: Mailing Zip/Postal Code":null,"18 Digit SFDC ID":"a19e0000002yqaAAAQ","18 Digit Contact ID":"003e000000u65J7AAI","Patient: Last Name":"Test","Patient: First Name":"Joe","Phone":"7813545262","Patient IVR: Patient IVR Id":"ivr-08/10/18-557851"},"contactListId":"e287404b-e731-4168-99fe-af1c152037fd","name":""}]

    contextId : 7cc2f726-3352-41bd-b28c-17843a0fe835


    tim.smith | 2018-08-10 17:12:49 UTC | #8

    This is all you need in the request. The rest of the properties are either defaults or unused (the updated docs for this contract are pending release to prod). Your issue above is that you ended the array and started a new one between each contact. The correct array notation is below.

    [
      {
        "data": {
          "Patient: Mailing Zip/Postal Code": "80019",
          "18 Digit SFDC ID": "a19e0000002yqa4AAA",
          "18 Digit Contact ID": "003e000000u65ITAAY",
          "Patient: Last Name": "Test",
          "Patient: First Name": "Joe",
          "Phone": "7813545262",
          "Patient IVR: Patient IVR Id": "ivr-08/10/18-557848"
        }
      },
      {
        "data": {
          "Patient: Mailing Zip/Postal Code": "",
          "18 Digit SFDC ID": "a19e0000002yqa5AAA",
          "18 Digit Contact ID": "003e000000u65J7AAI",
          "Patient: Last Name": "Test",
          "Patient: First Name": "Joe",
          "Phone": "7813545262",
          "Patient IVR: Patient IVR Id": "ivr-08/10/18-557849"
        }
      }
    ]

    Duncan_Stewart | 2018-08-10 17:55:50 UTC | #9

    Well, it was entertaining to try and build up a valid blob of nested JSON, anyway -- I'm sure it'll come in handy at some point. Still malformed somehow.

    [ { "data":{ "Patient: Mailing Zip/Postal Code":"80019", "18 Digit SFDC ID":"a19e0000002yqadAAA", "18 Digit Contact ID":"003e000000u65ITAAY", "Patient: Last Name":"Test", "Patient: First Name":"Joe", "Phone":"7813545262", "Patient IVR: Patient IVR Id":"ivr-08/10/18-557862" } }, { "data":{ "Patient: Mailing Zip/Postal Code":null, "18 Digit SFDC ID":"a19e0000002yqaeAAA", "18 Digit Contact ID":"003e000000u65J7AAI", "Patient: Last Name":"Test", "Patient: First Name":"Joe", "Phone":"7813545262", "Patient IVR: Patient IVR Id":"ivr-08/10/18-557863" } } ]


    Duncan_Stewart | 2018-08-10 18:05:44 UTC | #10

    Oh, perhaps if the zip code is null that should be an empty string. Might as well deal with that.. Done, though insufficient - same error.


    tim.smith | 2018-08-10 18:06:48 UTC | #11

    Correlation ID?


    Duncan_Stewart | 2018-08-10 18:08:10 UTC | #12

    Sorry: 208ddfe8-d4d5-4040-bf49-55c7cb5eeab6


    tim.smith | 2018-08-10 19:55:56 UTC | #13

    The last request body you posted above works for me (after I add additional columns required for my contact list). I can't see the actual request body, but the error I'm seeing in the API logging is Can not deserialize instance of com.inin.pubapi.server.domain.dialer.DialerContact out of START_ARRAY. It sounds like you have an extra array in the request body.


    Duncan_Stewart | 2018-08-10 20:07:33 UTC | #14

    Curious - those are the columns/values in the file that the ContactList was created from. When I export the list, there are additional columns that IVR generates when it processes. I could include those as empty values..? I'm setting those data elements/request body exactly as indicated, and I don't see how an empty entry / contact might've been included.

    * inin-outbound-id Patient IVR: Patient IVR ID Phone Patient: First Name Patient: Last Name 18 Digit Contact ID 18 Digit SFDC ID Patient: Mailing Zip/Postal Code * ContactCallable * ZipCodeAutomaticTimeZone * CallRecordLastAttempt-Phone * CallRecordLastResult-Phone * CallRecordLastAgentWrapup-Phone * Callable-Phone * AutomaticTimeZone-Phone


    tim.smith | 2018-08-10 20:06:02 UTC | #15

    No, don't include the ones that get added automatically. Those are for use internally. Only include the data properties that you have values for or are required.


    Duncan_Stewart | 2018-08-10 20:16:53 UTC | #16

    Found it -- an extra outer '[' + ']' that was kindly (and quietly) added to the request. And there's still time before 5:00 p.m.!

    My subsequent ContactList export had the new entry in it (I ran it just on the one record, for verification).

    Thanks as always, Tim!


    system | 2018-09-10 20:29:55 UTC | #17

    This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 3353