Login Deutsch

Developers welcome! The mite.api is looking forward to your precious hacking. Have a look at the detailed documentation to kick-start your coding.

Services

Please note: Services can only be read, but not edited by time trackers.

List all active services

List all active services, sorted by name:

GET /services.xml
GET /services.json

Parameters

name Filters the list by name. The given string will match partly and is treated as case-insensitive.
limit Limits the list to the given number of entries.
Default: indefinite
page Allows to access follow-up pages when combined with limit.
Default: 1

Response

Status: 200 OK
[
   {
      "service": {...}
   },
   {
      "service": {...}
   }
]
Status: 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<services type="array">
   <service>
      ...
   </service>
   <service>
      ...
   </service>
</services>

List all archived services

List all archived services, sorted by name:

GET /services/archived.xml
GET /services/archived.json

You can use the same parameters as for the active services.

Get a single service

Get a single service by its id:

GET /services/:id.xml
GET /services/:id.json

Response

Status: 200 OK
{
   "service": {
        "id": 38672,
        "name": "Coding",
        "note": "",
        "hourly_rate": 3300,
        "archived": false,
        "billable": true,
        "created_at": "2009-12-13T12:12:00+01:00",
        "updated_at": "2015-12-13T07:20:04+01:00"
    }
}
Status: 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<service>
   <id type="integer">38672</id>
   <name>Coding</name>
   <note></note>
   <billable type="boolean">true</billable>
   <hourly-rate type="integer">3300</hourly-rate>
   <archived type="boolean">false</archived>
   <updated-at type="datetime">2007-12-13T12:12:00+01:00</updated-at>
   <created-at type="datetime">2007-12-13T12:12:00+01:00</created-at>
</service>

Create a service

Create a new service. All attributes are optional, except the name.

POST /services.xml
POST /services.json

Attributes

name Is required!
note Default: "" (empty string)
hourly_rate In cent (a hundredth of the base unit, irrespective of the currency)
Default: null
billable true or false
Default: true
archived true or false
Default: false

Request

Content-Type: application/json
{
   "service": {
      "name": "Training",
      "billable": false
   }
}
Content-Type: application/xml
<service>
   <name>Training</name>
   <billable>false</billable>
</service>

Response

Status: 201 Created
Location: https://demo.mite.yo.lk/services/524230.json
{
   "service": {
      "id": 524230
      "name": "Training",
      "note": "",
      "hourly_rate": null,
      "archived": false,
      "billable": false,
      "created_at": "2015-10-13T22:12:02+01:00",
      "updated_at": "2015-10-13T22:12:02+01:00"
   }
}
Status: 201 Created
Location: https://demo.mite.yo.lk/services/524230.xml
<?xml version="1.0" encoding="UTF-8"?>
<service>
   <id type="integer">524230</id>
   <name>Training</name>
   <note></note>
   <billable type="boolean">false</billable>
   <hourly-rate type="integer" nil="true"></hourly-rate>
   <archived type="boolean">true</archived>
   <updated-at type="datetime">2008-02-11T22:12:00+01:00</updated-at>
   <created-at type="datetime">2008-02-11T22:12:00+01:00</created-at>
</service>

Edit a service

Update the service with the given attributes:

PATCH /services/:id.xml
PATCH /services/:id.json

Request

Content-Type: application/json
{
   "service": {
      "name": "Layout"
   }
}
Content-Type: application/xml
<service>
   <note>Layout</note>
</service>

Response

Status: 200 OK
{empty}

If you change the hourly rate, it will by default only apply to time entries created from now on. If you want it to apply to all existing time entries, set the additional attribute update_hourly_rate_on_time_entries to true:

Content-Type: application/json
{
   "service": {
      "hourly_rate": 12000,
      "update_hourly_rate_on_time_entries": true
   }
}
Content-Type: application/xml
<service>
   <hourly-rate>12000</hourly-rate>
   <update-hourly-rate-on-time-entries>12000</update-hourly-rate-on-time-entries>
</service>

Delete a service

Delete a service:

DELETE /services/:id.xml
DELETE /services/:id.json

Response

Status: 200 OK
{empty}

You can only delete services without any associated time entries. If there are, you will get back the following error:

Status: 422 Unprocessable Entity
{
   "error": "This service cannot be deleted: There are \
associated time entries. Please archive instead."
}
Status: 422 Unprocessable Entity
<?xml version="1.0" encoding="UTF-8"?>
<errors>
   <error>This service cannot be deleted: There are associated \
time entries. Please archive instead.</error>
</errors>