HTTP Verb: POST

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

Object: TicketAssociation

Location: available

Formats: XML, JSON

Create a ticket association and return the body of newly created association in requested format among with its location in a Location: \_location header.

Params

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

XML

<ticket_association>
  <ticket2_id>_ticket_id</ticket2_id>
  <relationship>_relationship</relationship>
</ticket_association>

JSON

{"ticket_association":{"ticket2_id":_ticket_id,"relationship":_relationship}}

Query string

ticket_association[ticket2_id]=_ticket_id&ticket_association[relationship]=_relationship

Check the full list of fields on ticket association object fields reference page

Examples

For example purposes we use a JSON body

{ticket_association:{ticket2_id:3,relationship:1}}

Request JSON, using cURL utility:

curl -i -H "Authorization: Bearer _token" -H "Content-Type: application/json" -d '{"ticket_association":{"ticket2_id":2,"relationship":1}}' https://api.assembla.com/v1/spaces/_space_id/tickets/_ticket_number/ticket_associations.json

Response

HTTP/1.1 201 Created
Server: nginx/0.8.55
Date: Mon, 16 Jul 2012 12:42:01 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Location: http://api.assembla.com/v1/spaces/_space_id/tickets/_ticket_number/ticket_associations/_id
Status: 201
...

{
  "relationship":1,
  "created_at":"2012-07-16T12:42:01Z",
  "id":31,
  "ticket1_id":3,
  "ticket2_id":2
}

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

Request XML, using cURL utility:

curl -i -H "Authorization: Bearer _token" -H "Content-Type: application/xml" -d '<ticket-association><ticket2-id>2</ticket2-id><relationship>1</relationship></ticket-association>' https://api.assembla.com/v1/spaces/_space_id/tickets/_ticket_number/ticket_associations.xml

Response

HTTP/1.1 201 Created
Server: nginx/0.8.55
Date: Mon, 16 Jul 2012 13:07:25 GMT
Content-Type: application/xml; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Location: http://api.assembla.com/v1/spaces/_space_id/tickets/_ticket_number/ticket_associations/_id
Status: 201
...

<?xml version="1.0" encoding="UTF-8"?>
<ticket-association>
  <ticket1-id type="integer">3</ticket1-id>
  <created-at type="datetime">2012-07-16T13:07:25Z</created-at>
  <relationship type="integer">1</relationship>
  <id type="integer">33</id>
  <ticket2-id type="integer">2</ticket2-id>
</ticket-association>

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: ticket association object fields reference page