Community
Showing results for 
Search instead for 
Do you mean 
Reply

Web API create/update not showing address

New Member
Posts: 4
Country: USA

Web API create/update not showing address

I am using the Web API in Act! to synchronize a Google Sheet with the contacts database. Every time I do a create or an update no addresses show up. I am passing the address as an embedded JSON object in a larger JSON.

I am sending the post request with the following code:

 

UrlFetchApp.fetch(url + contactId, {
        'muteHttpExceptions': true,
        'method': 'put',
        'payload': contactData,
        'headers': {
            'Authorization': 'Bearer ' + bearerToken,
            'Content-Type': 'application/json'
        }
    });

where contactId is a string of the contact ID and contactData is a JSON object that looks like this:

 

 

contactData = {
    "lastName": "Admin",
    "pronunciation guide": null,
    "jobTitle": "",
    "emailAddress": "",
    "altEmailAddress": "",
    "businessAddress": {
        "line1": 1234,
        "line2": 1234,
        "line3": null,
        "city": 1234,
        "state": 1234,
        "postalCode": 1234,
        "country": 1234
    },
    "homePhone": "",
    "mobilePhone": "098-765-4123",
    "businessPhone": "(123) 456-7890",
    "": "undefined",
    "id": "73984959-a7b6-4cea-a382-71f0aa1c2aa6"
}

Am I doing something wrong? All of the fields in the root JSON object update fine, it is the businessAddress that doesn't update.

 

Thanks!

Jonathan

 

Employee
Posts: 236
Country: USA

Re: Web API create/update not showing address

Hi,

 

Your json model looks problematic for the address blocks - should be strings values.  

 

You have:

 

"businessAddress": {
        "line1": 1234,
        "line2": 1234,
        "line3": null,
        "city": 1234,
        "state": 1234,
        "postalCode": 1234,
        "country": 1234
    },

 

Should be:

 

"businessAddress": {
        "line1": "1234",
        "line2": "1234",
        "line3": null,
        "city": "1234",
        "state": "1234",
        "postalCode": "1234",
        "country": "1234"
    },

 

 

HTH

 

New Member
Posts: 4
Country: USA

Re: Web API create/update not showing address

Thank you, I stumbled on that as well. My real problem was that Google Apps Script was converting the JSON object to a set of HTTP key value pairs with the embedded objects being simple strings themselves. Act! didn't like the combination of formats. When I tried sending it as application/json I would get a stack trace error back saying that a string is not a valid date. I removed all the date fields from what I sent the server (which were null anyways, waste of bandwidth) and everything worked.

 

The dates are now the problem. Do you know the format they should be in? Milliseconds since epoch?

 

Thanks for your help. It is really nice knowing there are people willing to share their knowledge. This is what makes the Internet great. (Cheesy, I know, but the sentiment is genuine.)

New Member
Posts: 4
Country: USA

Re: Web API create/update not showing address

I found the solution to this as well. The database is expecting dates in the Simple Date Format yyyy-MM-dd'T'HH:mm:ss'Z' and passed as a string. Anything else (as far as I have been able to determine) causes an unhandled exeption that gets passed back to the web client (so I guess it is handled in some way, it didn't go back to the OS and crash the whole application).