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

Here are some examples of accessing resources:

Accessing information about a task

Getting a full task list

Getting a filtered task list

Creating a task

Editing a task

Deleting a task

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:

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.

Accept: application/xml
Content-type: application/xml
Authorization: Basic MTIzNDU6QUJDREU=
<?xml version="1.0" encoding="UTF-8"?>
    <name>Client X homepage redesign</name>

An example of creating a new timer JSON.

Accept: application/json
Content-type: application/json
Authorization: Basic MTIzNDU6QUJDREU=
    "starttime":"2024-04-24 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">
        <name>My Italian client</name>
        <phone>+44 01223 123456</phone>
        <cell>+44 01223 123456</cell>
        <fax>+44 01223 123456</fax>
        <address>3905 State Street Ste 7-385</address>
        <city>Santa Barbara</city>

An example of a JSON response:

        "name":"My Italian client",
        "phone":"+44 01223 123456",
        "cell":"+44 01223 123456",
        "fax":"+44 01223 123456",
        "address":"3905 State Street Ste 7-385",
        "city":"Santa Barbara",

Note: These example responses have been formatted for easy viewing. The actual response returns with whitespace stripped.

Don’t have an Intervals account? Start your own unlimited trial.

No credit card required. No software to install. Cancel any time.

Try it Free