HTTP Verb: POST

Available statuses: 201 Created, 404 Not Found, 422 Unprocessable Entity

Object: Space

Location: available

Formats: XML, JSON

Create a space.

Params

To create a space, 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 space namespace, e.g.:

XML

<space>
  <summary>dsa</summary>
  ...
</space>

JSON

{"space":{"name":"dsa",...}}

Query string

space[name]=dsa&...

Check the full list of available params on space object fields reference

Examples

Request XML, using cURL utility:

curl -i -H "Authorization: Bearer _token" -d "space[name]=dsa" https://api.assembla.com/v1/spaces.xml

Response:

HTTP/1.1 201 Created
Server: nginx/0.8.55
Date: Fri, 07 Sep 2012 13:40:10 GMT
Content-Type: application/xml; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Status: 201
Location: https://api.assembla.com/v1/spaces/ck61ce-per4yFfadbNA33N

<?xml version="1.0" encoding="UTF-8"?>
<space>
  <banner-height nil="true"></banner-height>
  <status type="integer">1</status>
  <updated-at type="datetime">2012-09-07T13:40:09Z</updated-at>
  <banner nil="true"></banner>
  <team-tab-role type="integer">0</team-tab-role>
  <last-payer-changed-at nil="true"></last-payer-changed-at>
  <created-at type="datetime">2012-09-07T13:40:09Z</created-at>
  <approved type="boolean">false</approved>
  <tabs-order nil="true"></tabs-order>
  <team-permissions type="integer">2</team-permissions>
  <is-manager type="boolean">true</is-manager>
  <is-commercial type="boolean">true</is-commercial>
  <share-permissions type="boolean">true</share-permissions>
  <restricted type="boolean">false</restricted>
  <banner-text nil="true"></banner-text>
  <can-join type="boolean">false</can-join>
  <wiki-format nil="true"></wiki-format>
  <name>dsa</name>
  <wiki-name>ck61ce-per4yFfadbNA33N</wiki-name>
  <public-permissions type="integer">1</public-permissions>
  <is-volunteer type="boolean">false</is-volunteer>
  <can-apply type="boolean">true</can-apply>
  <id>ck61ce-per4yFfadbNA33N</id>
  <description nil="true"></description>
  <default-showpage>Wiki</default-showpage>
  <parent-id>brlpYIz2Sr4zBIadbNA33N</parent-id>
  <style nil="true"></style>
  <watcher-permissions type="integer">1</watcher-permissions>
  <restricted-date nil="true"></restricted-date>
  <commercial-from type="datetime">2012-09-07T13:40:09Z</commercial-from>
  <banner-link nil="true"></banner-link>
</space>

Request JSON, using cURL utility:

curl -i -H "Authorization: Bearer _token" -d "space[name]=dsa" https://api.assembla.com/v1/spaces.json

Response:

HTTP/1.1 201 Created
Server: nginx/0.8.55
Date: Fri, 07 Sep 2012 13:36:36 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Status: 201
Location: https://api.assembla.com/v1/spaces/ak-3c2-per4yFfadbNA33N
...

{
  "banner_height":null,
  "status":1,
  "updated_at":"2012-09-07T13:36:35Z",
  "banner":null,
  "team_tab_role":0,
  "last_payer_changed_at":null,
  "created_at":"2012-09-07T13:36:35Z",
  "approved":false,
  "tabs_order":null,
  "team_permissions":2,
  "is_manager":true,
  "is_commercial":true,
  "share_permissions":true,
  "restricted":false,
  "banner_text":null,
  "can_join":false,
  "wiki_format":null,
  "name":"dsa",
  "wiki_name":"ak-3c2-per4yFfadbNA33N",
  "public_permissions":1,
  "is_volunteer":false,
  "can_apply":true,
  "id":"ak-3c2-per4yFfadbNA33N",
  "description":null,
  "default_showpage":"Wiki",
  "parent_id":"brlpYIz2Sr4zBIadbNA33N",
  "style":null,
  "watcher_permissions":1,
  "restricted_date":null,
  "commercial_from":"2012-09-07T13:36:35Z",
  "banner_link":null
}

JSON is formatted here for readability, in a real response JSON body is inline with no indentation.

Note: pay attention to Location header, this is the URL where newly created resource is located, you can GET on this URL to access this resource.

Description for each field: space object fields reference