Clients
- Get all clients
- Get a client
- Create a new client
- Update client
- (De)Activate an existing client
- Delete a client
Get all clients
GET /clients
HTTP Response: 200 Success
<clients type="array"> <client> <name>SuprCorp</name> <created-at type="datetime">2008-04-09T12:07:56Z</created-at> <updated-at type="datetime">2008-04-09T12:07:56Z</updated-at> <highrise-id type="integer">568902</highrise-id> <id type="integer">11072</id> <cache-version type="integer">0</cache-version> <currency>United States Dollars - USD</currency> <active type="boolean">true</active> <currency-symbol>$</currency-symbol> <details>123 Main St. Third Floor New York, NY 10011 USA 212-555-1212 212-555-1213 (fax) http://www.company.com</details> <default-invoice-timeframe>20110101,20111231</default-invoice-timeframe> <last-invoice-kind>task</last-invoice-kind> </client> <client> ... </client> </clients>
You can filter by updated_since. To show only the clients that have been updated since "2010-09-25 18:30", pass the UTC date time value (URL encoded).
GET /clients?updated_since=2010-09-25+18%3A30
HTTP Response: 200 Success
Get a client
GET /clients/#{client_id}
HTTP Response: 200 Success
<client> <name>SuprCorp</name> <created-at type="datetime">2008-04-09T12:07:56Z</created-at> <updated-at type="datetime">2008-04-09T12:07:56Z</updated-at> <highrise-id type="integer">110011</highrise-id> <id type="integer">11072</id> <cache-version type="integer">0</cache-version> <currency>United States Dollars - USD</currency> <currency-symbol>$</currency-symbol> <active type="boolean">true</active> <details>123 Main St. Third Floor New York, NY 10011 USA 212-555-1212 212-555-1213 (fax) http://www.company.com</details> <default-invoice-timeframe>20110101,20111231</default-invoice-timeframe> <last-invoice-kind>task</last-invoice-kind> </client>
Create a new client
POST /clients
HTTP Response: 201 Created
Location: /clients/#{new_client_id}
You need to post the following:
<client> <name>Company LLC</name> <highrise-id type="integer">110011</highrise-id> <currency>United States Dollars - USD</currency> <currency-symbol>$</currency-symbol> <active type="boolean">true</active> <details>123 Main St. Third Floor New York, NY 10011 USA 212-555-1212 212-555-1213 (fax) http://www.company.com</details> </client>Note: Only NAME is required.
Update client
PUT /clients/#{client_id}
HTTP Response: 200 OK
Location: /clients/#{client_id}
You may update selected attributes for a client.
<client> <name>Company LLC</name> <details>123 Main St. Third Floor New York, NY 10011 USA 212-555-1212 212-555-1213 (fax) http://www.company.com</details> </client>
(De)Activate an existing client
POST /clients/#{client_id}/toggle
HTTP Response: 200 Success
Location: /clients/#{client_id}
Note that if the client has active projects, Harvest will return
HTTP Response: 400 Bad Request, with a Hint header.
Delete a client
DELETE /clients/#{client_id}
If client does not have associated projects or invoices Harvest deletes it and returnsHTTP Response: 200 OK
otherwise client is not deleted and you'll get a HTTP Response: 400 Bad Request .