Gastus API

Incomes

Show

GET /incomes/#{id}.xml

Returns a single income.

Response

Status: 200 OK

<income>
  <amount type="float">12.52</amount>
  <concept>Salary</concept>
  <created-at type="datetime">2007-08-10T18:38:12Z</created-at>
  <date type="date">2007-08-10</date>
  <description>My first salary</description>
  <id type="integer">793</id>
  <updated-at type="datetime">2007-08-10T18:38:12Z</updated-at>
</income>

List All

GET /incomes.xml

Returns a collection of incomes. Note that this request has no filter applied, so the response could be very long.

Response

Status: 200 OK

<incomes>
  <income>
    ...
  </income>

  <income>
    ...
  </income>
</incomes>

List Within Month

GET /incomes/#{year}/#{month}.xml

Returns a collection of incomes that belongs to month and year (Based on current time in user's timezone).

Response

Status: 200 OK

<incomes>
  <income>
    ...
  </income>

  <income>
    ...
  </income>
</incomes>

List Within Period

GET /incomes.xml?filter=#{period}

Returns a collection of incomes that belongs to period (Based on current time in user's timezone).
possible periods are:

Response

Status: 200 OK

<incomes>
  <income>
    ...
  </income>

  <income>
    ...
  </income>
</incomes>

List By Search Properties

GET /incomes/search.xml?#{search_properties}

Returns a collection of incomes that matchs the search properties. Possible properties are:

Examples:
GET /incomes/search.xml?initial_date=2007-08-01&description=salary - This would find incomes from 2007-08-01 matching description like salary.
GET /incomes/search.xml?final_amount=5000&initial_date=2007-08-01 - This would find incomes from 2007-08-01 below 5000 Euro/Dollar/Whatever.

Response

Status: 200 OK

<incomes>
  <income>
    ...
  </income>

  <income>
    ...
  </income>
</incomes>

Create

POST /incomes.xml

Creates a new income. The XML for the new income is returned on a successful request with the timestamps recorded and ids for the income.

Request

<income>
    <date type="date">2007-08-10</date>
    <concept>Salary</concept>
    <amount type="float">12.52</amount>
    <description>My first salary</description>
  </income>

Response

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

<income>
  ...
</income>

Update

PUT /incomes/#{id}.xml

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

Request

<income>
      <date type="date">2007-08-10</date>
      <concept>Salary</concept>
      <amount type="float">12.52</amount>
      <description>My first salary</description>
    </income>

Response

Status: 200 OK

Destroy

DELETE /incomes/#{id}.xml

Destroys the income at the referenced URL.

Response

Status: 200 OK