How can we make it easier for you to develop on top of Wild Apricot?

API - HTTP POST Error 500, an internal error has occured

Hi - I've spent hours trying to figure why the POST below (in Swift) fails. Status code is HTTP 500 which according to the doc means "Wild Apricot's server has encountered an error and cannot fulfill the request." API Key and authentication are all good since GET requests to the same API work fine.

The event is very simple defined to have only fields first and last name and email. The event is public. I've triple checked all the Id's - event, contact, reg type id etc.

Any ideas much appreciated..


Post URL is{acctid}/EventRegistrations/

Post Body is - {"RegistrationTypeId":2394243,"Event":{"Id":1805601},"RegistrationFields":[{"Value":"John","FieldName":"First name"},{"Value":"Barrett","FieldName":"Last name"},{"Value":"","FieldName":"e-Mail"}],"Contact":{"Id":26450615}}

Response is -
Status 500
{"Message":"An internal error has occured. Please contact Wild Apricot support.\\r\\n Request ID:8bc7b4458b4c47b784f9c45dcf3f34ce."}

Swift Code
println("\nPOST Url ----------->\(url!)\n")
let request = NSMutableURLRequest(URL: url!)
request.HTTPMethod = "POST"
let auth = NSString(format: "Bearer %@", accessToken)
request.setValue(auth, forHTTPHeaderField: "Authorization")
request.addValue("application/json", forHTTPHeaderField: "Accept")

let params /*: [AnyObject]*/ = [

"Event": ["Id": 1805601], //ev 4

"RegistrationTypeId": 2394243, // for ev 4

"Contact": ["Id": 26450615], //mem2

"RegistrationFields": [

["FieldName": "First name", "Value": "John"],

["FieldName": "Last name", "Value": "Barrett"],

["FieldName": "e-Mail", "Value": ""],

] /*,

"IscheckedIn": false,

"IsPaid": false,

"ShowToPublicIsPaid": true,

"Memo":"Important member",

"GuestRegistrationsSummary": ["NumberOfGuests": 1] */

] as Dictionary

var err: NSError?

var bodyData = NSJSONSerialization.dataWithJSONObject(params, options: nil, error: &err)

var bodyStr = NSString(data: bodyData!, encoding: NSUTF8StringEncoding)!

println("body ----------->\(bodyStr)")

request.HTTPBody = NSJSONSerialization.dataWithJSONObject(params, options: nil, error: &err)

var response: NSURLResponse?

var error: NSErrorPointer = nil

var data = NSURLConnection.sendSynchronousRequest(request, returningResponse: &response, error: error)

var reply = NSString(data: data!, encoding: NSUTF8StringEncoding)

//println("\n\nerror ----------->\(error)")

println("\nresponse ----------->\(response!)")


0 votes
Sign in
Password icon
Signed in as (Sign out)

We’ll send you updates on this idea

DavidM shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

1 comment

Sign in
Password icon
Signed in as (Sign out)

Feedback and Knowledge Base