The Tickspot API and command-line cUrl
Sometimes you want to pull some basic data without writing a bunch of code and that’s where command-line cUrl is super handy.
Let’s try it out!
Currently at VIA, we use Tickspot for time-tracking. Since we do most of our billing hourly, accurate time-keeping is pretty important to our process and Tickspot is a good solution (Note: they didn’t give us anything for writing this post).
As a bonus, they have a nice API which enables us to build things on top of Tickspot (like a custom reporting engine or an estimation tool).
Accessing the Tickspot API from command-line goes like this:
curl -u "firstname.lastname@example.org:password" \
-H "User-Agent: TickTesting (email@example.com)" \
Let’s break the above down a little bit.
-u "firstname.lastname@example.org:password" authenticates you with the API using *Basic Authentication*. You should use your Tickspot email address and password.
-H "User-Agent: TickTesting (email@example.com)" adds an HTML header with the *User Agent* for your request. This header is required with every request and should always be in the form
The above call will return a JSON array containing all Tickspot subscriptions for the specified user and an *Authorization Token* for future requests.
"company": "My Company",
In most situations, you’ll only get back a single company but be aware that it’s possible to get multiple results back.
Call an API endpoint
To call the other API endpoints, you need the *subscription_id* and the *api_token* from above.
For example, to get the list of projects for the company:
curl -H "Authorization: Token token=nDRE9v2SwkEE6PLfyJhmk3BrnDRE9v2S" \
-H "User-Agent TickTesting (firstname.lastname@example.org)" \
Notice that we send two separate HTML headers. One with the same *User Agent* stuff we had in the authentication request, plus an additional header containing the *api_token* value.
The API endpoint url also contains the *subscription_id* for the company we’re querying.
Most endpoints only return the first 100 results. You can request more data by appending a page= (
page=3, etc) query string parameter to the endpoint url. The API will return an empty response when there is no more data to retrieve.
That’s it, now take a look at some of the other endpoints
It’s that simple.
There are lots of other endpoints for retrieving and adding data and they all work the same way.
We Made You an Open Source Salesforce Command-line Tool, You're Welcome
By: Mark Biek on 5/7/2018
Easily explore the Salesforce REST API with our new command-line tool.Read More »