0

I'm trying to figure out whether I'm misunderstanding the patch/contacts endpoint. Here is sample json that I am passing via PostMan, which appears to function correctly.

{
    "contactKey": "1002",
    "attributeSets": 
    [{ 
        "name": "MobileConnect Demographics", 
            "items": 
            [{
                "values": 
                [{
                        "name": "Mobile Number",
                        "value": "123-555-5555"
                },
                {
                        "name": "Sandwich",
                        "value": "stromboli"
                },
                {
                        "name": "Whatever",
                        "value": "1"
                }
                ]
            }]
    }]
}

Note: Sandwich and Whatever are both MobileConnect attributes.

I've used a Contact Key of a Contact that did already exist in the system (i.e. attempting to update that record), but did not succeed, even though there was a positive response. Here is the response from the above json submission.

{
    "operationStatus": "OK",
    "rowsAffected": 1,
    "contactKey": "1002",
    "contactID": 12472888,
    "contactTypeID": 0,
    "isNewContactKey": false,
    "hasErrors": false,
    "requestServiceMessageID": "0d7a6fa0-779b-47b9-9a0d-b1292fcf0960",
    "resultMessages": [],
    "serviceMessageID": "68efeacb-8836-47c8-ab36-ede40e375abb"
}

When using an unused Contact Key, I received a positive response, but no new contact was added. Response:

{
    "operationStatus": "OK",
    "rowsAffected": 1,
    "contactKey": "1060",
    "contactID": 78825616,
    "contactTypeID": 0,
    "isNewContactKey": true,
    "hasErrors": false,
    "requestServiceMessageID": "9aa00b05-97e8-4762-bb3b-23af896b4aa7",
    "resultMessages": [],
    "serviceMessageID": "96edf839-f6cb-4456-aa57-6312c221548a"
}

https://code.exacttarget.com/apis-sdks/rest-api/v1/contacts/updateContacts.html

In the end, I'm trying to figure out the best way to update / create a contact in MobileConnect (via the api), so that when an SMS is sent to a contact, I can utilize a particular attribute to control what displays in the message.

1

I think I ended up figuring this out. The keys to get this to work were...

  • Use PATCH when making an Update to a Contact
  • Use POST when creating a new Contact
  • Even though Update looks like it does an Upsert, it does not.

Otherwise, I believe I had the correct json code.

  • Do you know a way to add a new phone number to the same contact. I use POST request and the result I got back is "operationStatus": "OK", "rowsAffected": 0 – tkhuynh Mar 17 '18 at 0:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.