Please note
Customers can not be edited by time trackers. Time trackers can only read customers of projects they were granted access to.
Show all active customers
GET /customers.xml
Lists all active customers, sorted by name.
Response : 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<customers type="array">
<customer>
...
</customer>
<customer>
...
</customer>
</customers>
You can limit the output by using the parameter name:
GET /customers.xml?name=inc
Lists all active customers with a name containing 'inc'. Upper / lower case will be ignored.
Per default the API returns all matching customers. You can limit the output by using the limit parameter:
GET /customers.xml?limit=100
Returns the first 100 matching customers. To access customers per page, use the page attribute:
GET /customers.xml?limit=100&page=2
Returns customers 101 to 200.
Show all archived customers
GET /customers/archived.xml
Lists all archived customers, sorted by name. You can limit the output by using the parameter name here as well.
Show a single customer
GET /customers/{id}.xml
Returns a single customer.
Response : 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<customer>
<id type="integer">2</id>
<name>Moodster Inc.</name>
<note>Shilly-shally!</note>
<archived type="boolean">false</archived>
<hourly-rate type="integer">0</hourly-rate>
<active-hourly-rate nil="true"></active-hourly-rate>
<hourly-rates-per-service type="array"></hourly-rates-per-service>
<created-at type="datetime">2007-12-13T12:12:00+01:00</created-at>
<updated-at type="datetime">2007-12-13T12:12:00+01:00</updated-at>
</customer>
Create
POST /customers.xml
Creates a new customer. All parameters are optional, except of the name.
- note
- Default: '' (empty string)
- archived
- true or false - default: false
- hourly_rate
- in cent (a hundredth of the base unit, irrespective of the curreny) - default: 0
- hourly_rates_per_service
- List of rates per service - default: [] (empty array)
- active_hourly_rate
- nil, hourly_rate or hourly_rates_per_service - default: nil
Request Body
<customer>
<name>Customer XY</name>
<note>Brand new!</note>
</customer>
Response : 201 Created
<?xml version="1.0" encoding="UTF-8"?>
<customer>
<id type="integer">1234</id>
<name>Customer XY</name>
<note>Brand new!</note>
<archived type="boolean">false</archived>
<hourly-rate type="integer">0</hourly-rate>
<active-hourly-rate nil="true"></active-hourly-rate>
<hourly-rates-per-service type="array"></hourly-rates-per-service>
<created-at type="datetime">2008-02-11T22:12:00+01:00</created-at>
<updated-at type="datetime">2008-02-11T22:12:00+01:00</updated-at>
</customer>
Edit
PUT /customers/{id}.xml
Updates the customer with the given parameters.
Request Body
<customer>
<note>Mission: completed!</note>
</customer>
Response : 200 OK
If you change the hourly rate, it is possible to apply the new rate to all existing time entries by setting the additional parameter update_hourly_rate_on_time_entries to true. By default the new hourly rate does not apply to existing time entries.
Delete
DELETE http://demo.mite.yo.lk/customers/{id}.xml
Deletes the customer. This is only possible if there are no projects attached to this customer.
