Gastus API

Types

Show

GET /types/#{id}.xml

Returns a single type.

Response

Status: 200 OK

<type>
  <id type="integer">1</id>
  <description>Vehicles</description>
</type>

List All

GET /types.xml

Returns a collection of types.

Response

Status: 200 OK

<types>
  <type>
    ...
  </type>

  <type>
    ...
  </type>
</types>

Create

POST /types.xml

Creates a new type. The XML for the new type is returned on a successful request with the timestamps recorded and ids for the type. Atention! Due to a bug in Rails (view the ticket) the XML must be hacked a little bit to create/update types in Gastus. So you must change the standar "type" root node by "ttype" root node, unless you would recieve an ugly 500 Internal Server Error.

Request

<ttype> # Note the ttype instead of type
  <description>Vehicles</description>
</ttype>

Response

Status: 201 Created
Location: http://test.gastus.com/types/#{new-type-id}.xml

<type>
  ...
</type>

Update

PUT /types/#{id}.xml

Updates an existing type with new details from the submitted XML.

Request

<ttype> # Note the ttype instead of type
  <description>Vehicles</description>
</ttype>

Response

Status: 200 OK

Destroy

DELETE /types/#{id}.xml

Destroys the type at the referenced URL.

Response

Status: 200 OK