# Discourse Add Group API

**URL:** <https://meta.discourse.org/t/discourse-add-group-api/25571>\
**Category:** Bug\
**Created:** [23 Febbraio 2015, 3:28pm UTC](https://meta.discourse.org/t/discourse-add-group-api/25571 "2015-02-23T15:28:29Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![dansingerman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dansingerman/32/115687_2.png) [@dansingerman](https://meta.discourse.org/u/dansingerman)\
**Post date:** [23 Febbraio 2015, 3:28pm UTC](https://meta.discourse.org/t/discourse-add-group-api/25571/1 "2015-02-23T15:28:29Z")

</div>

I am using the discourse\_api gem, and adding a group fails as follows:

```
client = DiscourseApi::Client.new
client.create_group(name: "some_group")
DiscourseApi::Error: {"errors"=>["Name must be at least 3 characters"]}

```

This is because of a mismatch between what the gem posts, and what the API expects.

The gem posts

```
{
    "group": {
        "name": "some_group",
        "visible": "true"
    }
}

```

But the controller method does not expect the root ‘group’ key:

```
 group = Group.new

 group.name = (params[:name] || '').strip

```

The discourse api documentation does not seem to mention groups: [Discourse REST API Documentation](https://meta.discourse.org/t/discourse-api-documentation/22706)

I am happy to fix this bug, but wanted to ask what we think the correct API design here is - should we fix it by removing the root element from the packet posted by the gem, or should the controller method be changed to deal with the root element?

---

_[View the full topic](https://meta.discourse.org/t/discourse-add-group-api/25571)._
