The API to post the attendance is not working

I’m trying to use the API that posts the attendance and testing it out on your swagger page:!/events/POST_version_events_event_id_attendance
When using your API here, I plug in the eventId retrieved from GET /v1/events/. For event_trackers[user_id], I tried plugging in both the user_id from GET /v1/users list and the invitees[].event_tracker_id from the GET /v1/events/<event_id> call. Both of those return 400 with the error: “event_trackers is invalid”. Here’s a pic from the webpage:

What am I doing wrong here?


Just to add to it, I opened the Firefox debugger and see this as the parameters being sent:

Is this the correct way the form data should be sent?

I had a dialog with on a help ticket a few months ago. I think the conclusion was to POST json like:

{` "event_trackers": [ 
   		"user_id": "12345", 
		"attendance_status_cd": 'yes', 
		"number_of_adult_guests": 10, 
		"number_of_youth_guests": 50 
]  }`
1 Like

Thank Eric!
I finally got it to work by doing this:

  1. Set the “Content-Type” in the Request Header to “application/json”.
  2. Send the data as a json string:
\#2 is the same as what you had except: * Removed spaces and newlines * user_id parameter is an integer and attendance_status_cd is a string, but with "0","1","2" in it.

After this worked, I checked the status and it did not seem to update. So, even though I got a 201 back from the API, I wonder if this is actually working or not on the backend.

Also I did this all from the Firefox debugger on the swagger site. So, next, I need to try this from javascript. I’ll post here with my details.

So, I just tried it again and for “attendance_status_cd”, if I sent “yes” (like you suggested), then I do see the update on the actual Troop Meeting page. So, the values are “yes”, “no” and “tbd” for “Attended”, “Did Not Attend” and “Not Recorded”.

Very cool! Thanks Eric!!

I got it all working inside Javascript as well now. Thanks Eric!!