API calls to update contacts suddenly failing
We have a Google Apps script that is used to update a custom contact field. This code has been working and unchanged for the past year, and has suddenly lost the ability to update contacts. Other API calls to get contacts, update event registrations, etc. are still working fine, but can't update any contact fields through the API. Attempts to do so result in an HTTP 500 error. We are still able to update contacts through the web interface.
Relevant information pasted after the break.
Error:
[17-09-16 07:31:21:841 CDT] Exception: Request failed for https://api.wildapricot.org/v2/accounts/84576/Contacts/40772038 returned code 500. Truncated server response: {"Message":"An internal error has occured. Please contact Wild Apricot support.\r\n Request ID:b95421e2-dfb0-4318-8c3b-b52bcf2a4e58."} (use muteHttpExceptions option to examine full response)
Relevant code:
this.updateContact = function(id, field, value){
var data = {
"Id" : id,
"FieldValues" : [{
"FieldName" : field,
"Value" : value
}]
};
return this.put('Contacts/' + id, data);
};
this.put = function(url, data){ return this.send(url, 'PUT', data); };
this.send = function(url, method, data){
if (typeof method === 'undefined') { method = 'GET'; }
var requestParams = {
'method': method,
'headers': {
'Authorization': 'Bearer ' + this.token,
'accept': 'application/json',
},
}
this.apiURL = "https://api.wildapricot.org/v2/accounts/" + accountID + "/";
if(data){
requestParams.payload = JSON.stringify(data);
requestParams.contentType = 'application/json';
}
if(url.indexOf('http') != 0){
url = this.apiURL + url;
}
var responseJson = UrlFetchApp.fetch(url, requestParams);
return JSON.parse(responseJson);
};
We fixed this issue, so it should work now.
Feel free to reopen this topic if the issue remains.
-
Christian Kindel commented
Yep, looks like it's working again.
-
Ghostbuster Apricot commented
Hello! We hope this problem has been fixed today