| Body font | Header font | ||
|---|---|---|---|
![]() |
The Tiktrac API is XML or JSON over HTTP. Simply set the following headers to inform Tiktrac you want to use XML:
Accept: application/xml
Content-Type: application/xml
Accept: application/x-json
Content-Type: application/x-json
The examples in this document use curl, a command line utility.
Basic HTTP authentication is required to access the API. Ensure that you use the URL for your account (Tiktrac accounts have their own subdomain.)
<pre style="overflow: scroll; background-color: #ffc">
curl -X GET -H 'Accept: application/xml' -H 'Content-Type: application/xml' http://helicoid.tiktrac.com/sheets -u alex@example.com:password
</pre>
Provide a sheet ID in the URL to get a list of tasks for that sheet.
<pre style="overflow: scroll; background-color: #ffc">
curl -X GET -H 'Accept: application/xml' -H 'Content-Type: application/xml' http://helicoid.tiktrac.com/sheets/2/tasks -u alex@example.com:password
</pre>
Provide the ID of the task you wish to update in the URL. A list of attributes you wish to update must be provided as an XML string. You can update more than one attribute at once.
<pre style="overflow: scroll; background-color: #ffc">
curl -X PUT -d '<task><duration>3</duration></task>' -H 'Accept: application/xml' -H 'Content-Type: application/xml' http://helicoid.tiktrac.com/tasks/7098 -u alex@example.com:password
</pre>
<pre style="overflow: scroll; background-color: #ffc">
curl -X PUT -d '<task><state>completed</state></task>' -H 'Accept: application/xml' -H 'Content-Type: application/xml' http://helicoid.tiktrac.com/tasks/6834 -u alex@example.com:password
</pre>
Specify the required sheet ID in the XML sent to the server:
<pre style="overflow: scroll; background-color: #ffc">
curl -X POST -d '<task><sheet_id>1</sheet_id><duration>3</duration><description>This is some work I performed</description></task>' -H 'Accept: application/xml' -H 'Content-Type: application/xml' http://helicoid.tiktrac.com/tasks -u alex@example.com:password
</pre>
Task update/create errors are reported like this:
<pre style="background-color: #ffc">
<errors>
<error>Description is too long (maximum is 1000 characters)</error>
<error>Description can't be blank</error>
The following example is a rough JavaScript class showing how to use the API. This could be used to construct a Dashboard widget. It requires Prototype to work correctly.
Download: http://tiktrac.com/tiktrac_api.js