POST /v1/groups
HTTP Verb: POST
Available statuses: 201 Created, 404 Not Found, 422 Unprocessable Entity
Object: Group
Location: available
Formats: XML, JSON
Creates a group.
Params
To create a group, a data body must be provided. Data can be provided in three formats: XML, JSON and query string. To specify data type of XML or JSON add the Content-type: application/(json|xml) header to request headers. If you want to provide query string simply skip the Content-type header.
All params should be sent in the group namespace, e.g.:
XML
<group>
<name>Group Name</name>
<type>space</type>
<items type="array">
<item>d6_muWDNyr4PMj5bfBjDYC</item>
<item>dCDf9QDNyr4PMj5bfBjDYC</item>
...
</items>
</group>
JSON
{"name":"Group Name","type":"space","items":["d6_muWDNyr4PMj5bfBjDYC", "dCDf9QDNyr4PMj5bfBjDYC", ...]}
Query string
group[name]=Group Name&group[type]=space&group[items]=...
Check the full list of available params on Group object fields reference
Examples
For example purposes we use a JSON body
{"name":"Group Name","type":"space","items":["dCDf9QDNyr4PMj5bfBjDYC", "deug5QDNyr4PMj5bfBjDYC"]}
Request XML, using cURL utility:
curl -i -H "Authorization: Bearer _token" -H "Content-type: application/json" -d '{"name":"Group Name","type":"space","items":["dCDf9QDNyr4PMj5bfBjDYC", "deug5QDNyr4PMj5bfBjDYC"]}' https://api.assembla.com/v1/groups.xml?portfolio=_portfolio_subdomain
Response:
HTTP/1.1 201 Created
Server: nginx/0.8.55
Date: Fri, 07 Sep 2012 13:08:42 GMT
Content-Type: application/xml; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Status: 201
Location: http://_portfolio_subdomain.breakout.tld:3000/v1/groups/24
...
<?xml version="1.0" encoding="UTF-8"?>
<group>
<id type="integer">24</id>
<name>New Group</name>
<portfolio-id>cJiq3KDNyr4PMj5bfBjDYC</portfolio-id>
<type>space</type>
<items type="array">
<item>dCDf9QDNyr4PMj5bfBjDYC</item>
<item>deug5QDNyr4PMj5bfBjDYC</item>
</items>
</group>
Request JSON, using cURL utility:
curl -i -H "Authorization: Bearer _token" -H "Content-type: application/json" -d '{"name":"Group Name","type":"space","items":["dCDf9QDNyr4PMj5bfBjDYC", "deug5QDNyr4PMj5bfBjDYC"]}' https://api.assembla.com/v1/groups.json?portfolio=_portfolio_subdomain
Response:
HTTP/1.1 201 Created
Server: nginx/0.8.55
Date: Fri, 07 Sep 2012 13:12:30 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Status: 201
Location: http://_portfolio_subdomain.breakout.tld:3000/v1/groups/24
...
{
"id": 24,
"name": "New Group",
"portfolio_id": "cJiq3KDNyr4PMj5bfBjDYC",
"type": "space",
"items": [
"dCDf9QDNyr4PMj5bfBjDYC",
"deug5QDNyr4PMj5bfBjDYC"
]
}
JSON is formatted here for readability, in a real response JSON body is inline with no indentation.
Description for each field: Group object fields reference