This week we added another code sample to the API library. This script will pull the link history for the last day and append it to a file on your local server.
If you want to automatically retrieve your history and keep a copy for your own records this is a great place to start. Run it at the same time every day (we recommend a cron job or schedulded job) and retrieve up to 1,000 records at a time.
Get the code sample here.
This week we introduced a cool new method to download link data via the Linktrack API. This kind of thing is useful if you want to integrate our site’s tracking data with another web site or application.
The new API method is called “getLinkHistory” and it’s documented on our API documentation page. There you’ll find a code sample or two and everything you need to get started.
We get a lot of requests to white label our service, so this tool is designed with that in mind. The API is available to anyone with an account – just look for it under your “Account” tab.
A quick update for those users using the API:
We’ve noticed a serious decline in the use of XML for APIs for online applications. This is followed by an increase in the JSON format. Personally, I’m not partial to either but there’s no denying the trend.
Going forward our API will default to XML as usual, but will also include a JSON format parameter as standard practice going forward. The current API (1.0) implements this with the [format] parameter. Just append &format=json to your request to get JSON format.
Let me know what you think and if you have any questions.
A customer contacted me the other day and asked if he could plug in to the API to pull certain links out of his account and sort them by the number of clicks they had received.
He wanted to publish the links and their totals on a web page. He went on to explain that he’s running a contest and would like the entrants to be able to check on their stats and compare them with other contestants to see who’s collecting the most links.
There was a workaround with the existing system, but it was cludgy so I went ahead and added a search/sort/order method for multiple links to the API. This will let you pull data on multiple links, either by the link ID or by the group they’re in. You can sort and order them as needed.
You can find details on your API credentials page at https://linktrack.info/api/getCredentials. There’s a real-world opens source code sample here.
This method can also return data in either XML (our soon-to-be-replaced-default) or JSON. We’ve expanded the API system to output both formats and will continue with that as a standard going forward. More on that in another post.