# Can't create events inviting many built-in groups

**URL:** <https://community.trooptrack.com/t/cant-create-events-inviting-many-built-in-groups/3422>\
**Category:** The TroopTrack Developer Program\
**Created:** [October 8, 2016, 3:20am UTC](https://community.trooptrack.com/t/cant-create-events-inviting-many-built-in-groups/3422 "2016-10-08T03:20:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eoin](https://avatars.discourse-cdn.com/v4/letter/e/f14d63/32.png) [@Eoin](https://community.trooptrack.com/u/Eoin)\
**Post date:** [October 8, 2016, 3:20am UTC](https://community.trooptrack.com/t/cant-create-events-inviting-many-built-in-groups/3422/1 "2016-10-08T03:20:39Z")

</div>

Seems the only option for invitees are: “Everyone” (Troop-nnnn), patrols (Patrol-nnnn), or users (User-nnnn).

This is quite limiting since a number of the built-in groups are not represented in this set, such as: PLC, leaders, or parents.

Nor are any of the customized groups that are available normally (eg. our troop has Scoutmaster, SPL, ASMs, Quartermaster, etc, etc…)

It would be great to have these additional groups available in the API so that we could fully automate our yearly calendar!!!

Thanks for the support!

-Eoin

---

<div class="post-metadata">

**Author:** ![Eoin](https://avatars.discourse-cdn.com/v4/letter/e/f14d63/32.png) [@Eoin](https://community.trooptrack.com/u/Eoin)\
**Post date:** [October 8, 2016, 4:14pm UTC](https://community.trooptrack.com/t/cant-create-events-inviting-many-built-in-groups/3422/2 "2016-10-08T16:14:56Z")

</div>

Ah ha! I found that you CAN do built-in groups – by using MailingLists!

First enumerate the mailing lists from the API, then, when creating events, use ‘MailingLists-nnn’ using the mailing list ID.

Works like a charm! Sweeeet!

---

<div class="post-metadata">

**Author:** ![srogers](https://avatars.discourse-cdn.com/v4/letter/s/cab0a1/32.png) [@srogers](https://community.trooptrack.com/u/srogers)\
**Post date:** [November 14, 2016, 10:57pm UTC](https://community.trooptrack.com/t/cant-create-events-inviting-many-built-in-groups/3422/3 "2016-11-14T22:57:15Z")

</div>

Eoin - I’m not able to even get the event creation to work. Do you have some code that you can share? I’m using Python right now, I’m doing something like this:

```
    postdata = {"event":{"title":"Troop Meeting"}}
    # Meeting event type
    postdata["event"]["event_type_id"] = "52183"
    postdata["event"]["location"] = "Church"
    postdata["event"]["start_at"] = str(startdate) + "T18:00-0600"
    postdata["event"]["end_at"] = str(startdate) + "T19:30-0600"
    postdata["event"]["description"] = "Test"
    postdata["event"]["inviteable_tokens"] = scList
    # ourtroop is just a placeholder for this example
    eventsURL = "https://ourtroop.trooptrack.com:443/api/v1/events"

    headers = {"Content-type" : "application/json",
               "X-Partner-Token" : XPartnerToken,
               "X-User-Token": XUserToken}

    response = requests.post(eventsURL, headers=headers, data=postdata)

```

I’ve tried removing the inviteable\_tokens line completely as well as just setting it to an empty string and nothing works. Current, scList is an array of ‘User-’ values like it mentions in the spec. In all cases, I get Error 400 and I’m not sure what I’m doing incorrectly here.

Thanks!

Any ideas?

---

<div class="post-metadata">

**Author:** ![Eoin](https://avatars.discourse-cdn.com/v4/letter/e/f14d63/32.png) [@Eoin](https://community.trooptrack.com/u/Eoin)\
**Post date:** [November 15, 2016, 12:41am UTC](https://community.trooptrack.com/t/cant-create-events-inviting-many-built-in-groups/3422/4 "2016-11-15T00:41:49Z")

</div>

I’ve posted some code here:

> [@The API documentation needs to show POST data](https://community.trooptrack.com/t/the-api-documentation-needs-to-show-post-data/3421):
>
> On the API documentation page ([https://troop466.trooptrack.com/api/swagger](https://troop466.trooptrack.com/api/swagger)) it would be very helpful to show any POST data for those APIs using POST. For example, /v1/events uses POST to create the e…

Let me know if that doesn’t help!

---

<div class="post-metadata">

**Author:** ![srogers](https://avatars.discourse-cdn.com/v4/letter/s/cab0a1/32.png) [@srogers](https://community.trooptrack.com/u/srogers)\
**Post date:** [November 15, 2016, 3:56pm UTC](https://community.trooptrack.com/t/cant-create-events-inviting-many-built-in-groups/3422/5 "2016-11-15T15:56:47Z")

</div>

Thanks Eoin!

The only change that was needed was to switch the output from a regular dictionary to a string via this one line

```
    postdata = json.dumps(postdata)

```

I had to wade through your code a bit, but once I saw that, I realized that was probably my issue. I didn’t have to do this when getting the tokens though. So, it’s weird that it’s needed for the events, but not the tokens. Or maybe it’s only needed when you have a dictionary of dictionaries. i.e. the token is just 3 entries in one dictionary. The event request is a dictionary with multiple entries inside the one entry (‘event’) dictionary.

It’s too bad we can’t disable RSVP from the API as well. After creating my events, I’ll have to go back and disable the RSVP by hand.

Thanks for the pointer!

---

<div class="post-metadata">

**Author:** ![srogers](https://avatars.discourse-cdn.com/v4/letter/s/cab0a1/32.png) [@srogers](https://community.trooptrack.com/u/srogers)\
**Post date:** [November 15, 2016, 4:30pm UTC](https://community.trooptrack.com/t/cant-create-events-inviting-many-built-in-groups/3422/6 "2016-11-15T16:30:09Z")

</div>

Update here: I just found out how to create an event without an RSVP:

```
    postdata["event"]["rsvp_required"] = 0

```

Just set that in your post data and the event no longer needs and RSVP. Hope it helps!
