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.

Projects

Please note: Projects can not be edited by time trackers. Time trackers can only read projects they were granted access to.

List all active projects

List all active projects, sorted by name:

GET /projects.xml
GET /projects.json

Parameters

name Filters the list by name. The given string will match partly and is treated as case-insensitive.
customer_id Filters the list by customer. Can be either a single ID, or multiple comma-separated IDs.
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
[
   {
      "project": {...}
   },
   {
      "project": {...}
   }
]
Status: 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<projects type="array">
   <project>
      ...
   </project>
   <project>
      ...
   </project>
</projects>

List all archived projects

List all archived projects, sorted by name:

GET /projects/archived.xml
GET /projects/archived.json

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

Get a single project

Get a single project by its id:

GET /projects/:id.xml
GET /projects/:id.json

Response

Status: 200 OK
{
   "project": {
      "id": 643,
      "name": "Open-Source",
      "note": "valvat, memento et all.",
      "customer_id": 291,
      "customer_name": "Yolk",
      "budget": 0,
      "budget_type": "minutes",
      "hourly_rate": 6000,
      "archived": false,
      "active_hourly_rate": "hourly_rate",
      "hourly_rates_per_service": [
         {
            "service_id": 31272,
            "hourly_rate": 4500
         },
         {
            "service_id": 149228,
            "hourly_rate": 5500
         }
      ],
      "created_at": "2011-08-17T12:06:57+02:00",
      "updated_at": "2015-02-19T10:53:10+01:00"
   }
}
Status: 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<project>
   <id type="integer">643</id>
   <name>Open-Source</name>
   <note>valvat, memento et all.</note>
   <budget type="integer">0</budget>
   <budget-type>minutes</budget>
   <archived type="boolean">false</archived>
   <customer-id type="integer">219</customer-id>
   <customer-name>Yolk</customer-name>
   <hourly-rate type="integer">6000</hourly-rate>
   <active-hourly-rate>hourly_rate</active-hourly-rate>
   <hourly-rates-per-service type="array">
      <hourly-rate-per-service>
         <service-id type="integer">31272</service-id>
         <hourly-rate type="integer">4500</hourly-rate>
      </hourly-rate-per-service>
      <hourly-rate-per-service>
         <service-id type="integer">149228</service-id>
         <hourly-rate type="integer">5500</hourly-rate>
      </hourly-rate-per-service>
   </hourly-rates-per-service>
   <updated-at type="datetime">2011-08-17T12:06:57+02:00</updated-at>
   <created-at type="datetime">2015-02-19T10:53:10+01:00</created-at>
</project>

Create a project

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

POST /projects.xml
POST /projects.json

Attributes

name Is required!
note Default: "" (empty string)
customer_id Default: null (without a customer)
budget Budget in minutes or cents (depends on budget_type)
Default: 0 (no budget specified)
budget_type "minutes" (Default), "minutes_per_month", "cents" or "cents_per_month"
active_hourly_rate null (Default), "hourly_rate" or "hourly_rates_per_service"
hourly_rate In cent (a hundredth of the base unit, irrespective of the currency). Is used if active_hourly_rate is set to "hourly_rate".
Default: null
hourly_rates_per_service List of rates per service. Is used if active_hourly_rate is set to "hourly_rate".
Default: [] (empty array)
archived true or false
Default: false

Request

Content-Type: application/json
{
   "project": {
      "name": "Website",
      "budget": 45000,
      "budget_type": "cents"
   }
}
Content-Type: application/xml
<project>
   <name>Website</name>
   <budget>45000</budget>
   <budget-type>cents</budget-type>
</project>

Response

Status: 201 Created
Location: https://demo.mite.yo.lk/projects/583241.json
{
   "project": {
      "id": 583241,
      "name": "Website",
      "note": "",
      "customer_id": null,
      "budget": 45000,
      "budget_type": "cents",
      "hourly_rate": null,
      "archived": false,
      "active_hourly_rate": null,
      "hourly_rates_per_service": [],
      "created_at": "2015-10-15T11:40:49+02:00",
      "updated_at": "2015-10-15T11:40:49+02:00"
   }
}
Status: 201 Created
Location: https://demo.mite.yo.lk/projects/583241.xml
<?xml version="1.0" encoding="UTF-8"?>
<project>
   <id type="integer">583241</id>
   <name>Website</name>
   <note></note>
   <budget type="integer">36000</budget>
   <budget-type>cents</budget>
   <archived type="boolean">false</archived>
   <customer-id type="integer" nil="true"/>
   <hourly-rate type="integer" nil="true"/>
   <active-hourly-rate nil="true"/>
   <hourly-rates-per-service type="array"/>
   <updated-at type="datetime">2015-10-15T11:40:49+02:00</updated-at>
   <created-at type="datetime">2015-10-15T11:40:49+02:00</created-at>
</project>

Edit a project

Update the project with the given attributes:

PATCH /projects/:id.xml
PATCH /projects/:id.json

Request

Content-Type: application/json
{
   "project": {
      "archived": true
   }
}
Content-Type: application/xml
<project>
   <archived>true</archived>
</project>

Response

Status: 200 OK
{empty}

If you change any attributes regarding the hourly rate (active_hourly_rate, hourly_rate and/or hourly_rates_per_service), it will by default only apply the changed rate 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
{
   "project": {
      "hourly_rate": 12000,
      "update_hourly_rate_on_time_entries": true
   }
}
Content-Type: application/xml
<project>
   <hourly-rate>12000</hourly-rate>
   <update-hourly-rate-on-time-entries>12000</update-hourly-rate-on-time-entries>
</project>

Delete a project

Delete a project:

DELETE /projects/:id.xml
DELETE /projects/:id.json

Response

Status: 200 OK
{empty}

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

Status: 422 Unprocessable Entity
{
   "error": "This project 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 project cannot be deleted: There are associated \
time entries. Please archive instead.</error>
</errors>