HTTP Verb: POST

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

Object: Tag

Location: available

Formats: XML, JSON

Create a tag and return the body of newly created tag in requested format among with its location in a Location: \_location header. Space should have Tickets tool.

Params

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

XML

<tag>
  <name>tagname</name>
  <state>2</state>
</tag>

JSON

{"tag":{"name":"tagname", "state":1}}

Query string

tag[name]=tagname&tag[state]=1

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

Examples

For example purposes we use a JSON body

{"tag":{"name":"tagname"}}

Request XML, using cURL utility:

curl -i -H "Authorization: Bearer _token" -H "Content-type: application/json" -d '{"tag":{"name":"tagname"}}' https://api.assembla.com/v1/spaces/_space_id/tags.xml

Response

HTTP/1.1 201 Created
Server: nginx/0.8.55
Date: Wed, 20 Jun 2012 12:13:01 GMT
Content-Type: application/xml; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Status: 201
Location: http://api.assembla.com/v1/spaces/test-1/tags/1
...

<?xml version="1.0" encoding="UTF-8"?>
<tag>
  <space-id>bcsn1KfUGr4Pf7XcWdifgZ</space-id>
  <updated-at type="datetime">2013-06-15T18:13:30Z</updated-at>
  <state nil="true"></state>
  <created-at type="datetime">2013-06-15T18:13:30Z</created-at>
  <name>tagname</name>
  <id type="integer">1</id>
</tag>

Request JSON, using cURL utility:

curl -i -H "Authorization: Bearer _token" -H "Content-type: application/json" -d '{"tag":{"name":"tagname2"}}' https://api.assembla.com/v1/spaces/_space_id/tags.json

Response

HTTP/1.1 201 Created
Server: nginx/0.8.55
Date: Wed, 20 Jun 2012 12:05:41 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Status: 201
Location: https://api.assembla.com/v1/spaces/test-1/tags/2
...
{
  "space_id":"bcsn1KfUGr4Pf7XcWdifgZ",
  "updated_at":"2013-06-15T18:16:56Z",
  "state":null,
  "created_at":"2013-06-15T18:16:56Z",
  "name":"tagname2","id":137
}

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: tag object fields reference