These docs are for v20.3.44. Click to read the latest docs for v20.3.186.

Discussions

Ask a Question
Back to All

Difficulty with api/EventRegistration/_execute

Hi,

I am new to Angular and iMIS REST API. We are using iMIS version 20.2.64.8405, and we plan to migrate to the cloud in the near future. This post is long and there are several questions all to do with Event Registration.

I am attempting to register a member to an event by POSTing to the api/EventRegistration/_execute endpoint. But I'm a little confused with the documentation about data properties to be passed in the body of the POST. On this page (https://developer.imis.com/reference/eventregistration), it describes the property RegistrationType as an object, but I can find no definition of that object. On this page (https://developer.imis.com/docs/paying-an-event-registration) is an example of the body of the POST, passing RegistrationType as the number 3. Which is correct?

I've been trying to do a registration using RegistrationType = 3, but I keep getting the HTTP error 400 message: "Http failure response for https://yourorgsite.com/api/EventRegistration/_execute: 400 OK".

I am also uncertain of the purpose of the property RegistrationOptionFunctionId is. Is it the ID of another function that can be offered if the requested one is unavailable? In my application, there can be no substitutions. I've tried using the same ID as the requested function, passing an empty string and omitting it altogether, but all give the same error result. Could this be the source of my 400 error?

The body of my POST is as follows:

{"$type":"Asi.Soa.Events.DataContracts.EventRegistrationRequest, Asi.Contracts","BillTo":"8223105","EntityTypeName":"EventRegistration","EventId":"MBSECT1920","FunctionId":"MBSECT1920/ABO","OperationName":"RegisterEvent","RegisteredBy":"8223105","RegistrantId":"8223105","RegistrationOptionFunctionId":"MBSECT1920/ABO","RegistrationType":3}

The body of the POST broken up for readability:

{
"$type":"Asi.Soa.Events.DataContracts.EventRegistrationRequest, Asi.Contracts",
"BillTo":"8223105",
"EntityTypeName":"EventRegistration",
"EventId":"MBSECT1920",
"FunctionId":"MBSECT1920/ABO",
"OperationName":"RegisterEvent",
"RegisteredBy":"8223105",
"RegistrantId":"8223105",
"RegistrationOptionFunctionId":"MBSECT1920/ABO",
"RegistrationType":3
}

The POST code is:

let addressurl = environment.imisapiurl + '/api/EventRegistration/_execute';
this.http.post(addressurl, JSON.stringify(body),
{
headers: new HttpHeaders({
"Content-Type": "application/json",
"RequestVerificationToken": (document.getElementById("__RequestVerificationToken") as HTMLInputElement).value
})
}
).subscribe(
data => {
console.log(data);
},
error => {
if (error.status == 400) {
console.log(error);
} else {
console.log(error);
}
alert(error.message);
}
);

I've been trying for several days to get this to work. Can you provide some assistance?

Thanks and regards,
Terry Thiel