event Registrations giving 500 error code
I am tring to create a new event registration. but i am getting 500 error code. Internal server occured.
Not sure if this is how the data has to be passed.
var data = "eventID=2351562&contactID=33494566®istrationTypeID=3201125&Email=bala%40mindlens.com.sg";
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "https://api.wildapricot.org/v2/Accounts/174160/EventRegistrations/3201125");
xhr.setRequestHeader("authorization", "Bearer Qk4XWQ0K4jVW2aOy-ovGW-nAsgQ-");
xhr.setRequestHeader("content-type", "application/x-www-form-urlencoded");
xhr.setRequestHeader("cache-control", "no-cache");
xhr.setRequestHeader("postman-token", "c0e05718-3e04-49ae-a354-0bb540f47dc4");
xhr.send(data);
User found a solution on his own
-
Dmitry Smirnov commented
Hi Bala,
Looks like you found a solution on your own. Just one small comment. Try to avoid sharing tokens on public forums. Although they have a short lifetime (30 min), you still can be hacked during these 30 minutes.
Regards,
Dmitry Smirnov,
API developer at Wild Apricot -
Bala commented
this works..
-
Bala commented
tried this as well
var data = JSON.stringify({
"Event": {
"Id": 235156
},
"RegistrationTypeId": 3201125,
"Contact": {
"Id": 33494566
},
"IscheckedIn": false,
"IsPaid": false,
"RegistrationFields": [
{
"FieldName": "First name",
"Value": "John"
},
{
"FieldName": "Last name",
"Value": "Barrett"
},
{
"FieldName": "Organization",
"Value": "Design Partners"
}
]
});var xhr = new XMLHttpRequest();
xhr.withCredentials = true;xhr.addEventListener("readystatechange", function () {
if (this.readyState === 4) {
console.log(this.responseText);
}
});xhr.open("POST", "https://api.wildapricot.org/v2/Accounts/174160/EventRegistrations");
xhr.setRequestHeader("authorization", "Bearer t1ZbrCqvZZIbWz2rNhgIekgcXzY-");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("cache-control", "no-cache");
xhr.setRequestHeader("postman-token", "fbe0790c-df77-8476-2999-ec04da9e7caa");xhr.send(data);