Intervals API Examples
Resource Operations
As mentioned in the intro, resources follow RESTful principles. Each resource has two parts: a collection (e.g. a task list) and a member (e.g. an individual task). How you interact with these resources depends on which HTTP method you use and whether you are addressing a member or a collection.
The API root URL is located at https://api.myintervals.com/
Here are some examples of accessing resources:
Accessing information about a task
GET https://api.myintervals.com/task/13/
Getting a full task list
GET https://api.myintervals.com/task/
Getting a filtered task list
GET https://api.myintervals.com/task/?clientid=5443&personid=2344
Creating a task
POST https://api.myintervals.com/task/
<task>...</task>
Editing a task
PUT https://api.myintervals.com/task/13/
<task>...</task>
Deleting a task
DELETE https://api.myintervals.com/task/13/
PUT/POST Interchangeability
Though RESTful principles describe separate HTTP methods for creating and updating resources, we understand that there is limited support for PUT in certain development platforms. Consequently, you may use PUT and POST interchangeably; the system will determine whether a member is being created or updated based on whether or not a resource id is passed in the parameters.
Sample Requests
A simple example of how to request a task list using a formed HTTP request:
GET https://api.myintervals.com/task/
Accept: application/xml
Authorization: Basic MTIzNDU6QUJDREU=
For more complicated requests post your XML or JSON directly.
The Content-type Header
The Intervals API supports both XML and JSON as forms of input for PUT and POST requests, but you must specify which type you are using by including either application/xml or application/json in a Content-Type HTTP header sent with your request.
An example of updating the description on a timer using XML.
PUT https://api.myintervals.com/timer/9282/
Accept: application/xml
Content-type: application/xml
Authorization: Basic MTIzNDU6QUJDREU=
<?xml version="1.0" encoding="UTF-8"?> <timer> <name>Client X homepage redesign</name> </timer>
An example of creating a new timer JSON.
POST https://api.myintervals.com/timer/
Accept: application/json
Content-type: application/json
Authorization: Basic MTIzNDU6QUJDREU=
{ "personid":2051, "starttime":"2024-11-21 10:30:03", "name":"Meeting with Client Y" }
A note on PUT/POSTs
Any HTTP library should be able to generate and issue the above request with a minimum of difficulty. However, the above request is considered invalid, since there is no way of knowing the Content-Length. If you are including a message in the body of the request the Content-Length header is required.
A more detailed description of each type of request, including required fields and the expected response, can be found in each individual resource page.
Sample Response
An example of a XML response. Please note that values containing reserved XML characters are embedded with CDATA tags to allow for proper XML parsing.
<?xml version="1.0" encoding="UTF-8"?> <intervals status="OK" code="200"> <client> <id>4561</id> <name>My Italian client</name> <datecreated>2007-09-04</datecreated> <description/> <firstname>Molto</firstname> <lastname>Bene</lastname> <email>whatever@blah.com</email> <website/> <phone>+44 01223 123456</phone> <cell>+44 01223 123456</cell> <fax>+44 01223 123456</fax> <address>3905 State Street Ste 7-385</address> <aptsuite></aptsuite> <city>Santa Barbara</city> <state>CA</state> <zip>93105</zip> <country>US</country> <active>t</active> </client> </intervals>
An example of a JSON response:
{ "status":"OK", "code":200, "client":{ "id":"4561", "name":"My Italian client", "datecreated":"2007-09-04", "description":null, "firstname":"Molto", "lastname":"Bene", "email":"info@myintervals.com", "website":null, "phone":"+44 01223 123456", "cell":"+44 01223 123456", "fax":"+44 01223 123456", "address":"3905 State Street Ste 7-385", "aptsuite":"", "city":"Santa Barbara", "state":"CA", "zip":"93105", "country":"US", "active":"t" } }
Note: These example responses have been formatted for easy viewing. The actual response returns with whitespace stripped.
Intervals API
This documentation is meant to serve as an introduction to getting started with the API.
Documentation
Resources
- client
- contactdescriptor
- contacttype
- document
- expense
- group
- invoice
- invoiceitem
- invoicenote
- invoiceterm
- me
- milestone
- milestonenote
- module
- payment
- paymenttype
- person
- personcontact
- project
- projectlabel
- projectmodule
- projectnote
- projectteam
- projectworktype
- quota
- request
- task
- tasklistfilter
- tasknote
- taskpriority
- taskstatus
- time
- timer
- worktype
API Support
Looking for help?
» Contact our support team.