This documentation is for the v2 (stable) version of the API.

Making API Calls

Making API calls is easy. The Fastway API is based on HTTP GET and POST requests. All you need to do is figure out the URL, and call it via one of those methods.

Note: Internally, the API treats the requests as the same (you can achieve the same result with either type). However, GET requests are limited by the maximum allowed query string length, so POST requests should be used if you are sending a larger amount of data.

The default response type is JSON. We recommend the use of browser extensions such as JSONView (Firefox) or registry hacks (IE) to get JSON to display in the browser without the browser attempting to download it. Chrome already shows json content in the browser, so Chrome users wont have to do anything.

Everything is best displayed with an example:

Get the details for label 3a0000253492 (any country)

http://farmapi.fastway.org/v2/tracktrace/detail/3a0000253492?api_key=YOUR_API_KEY
http://farmapi.fastway.org/v2/tracktrace/detail/?LabelNo=3a0000253492&api_key=YOUR_API_KEY

Get the details for label 3a0000253492 (New Zealand)

http://farmapi.fastway.org/v2/tracktrace/detail/3a0000253492/6
http://farmapi.fastway.org/v2/tracktrace/detail/?LabelNo=3a0000253492&CountryCode=6

Get the details for label 3a0000253492 (New Zealand, sort by type and not date)

http://farmapi.fastway.org/v2/tracktrace/detail/3a0000253492/6/true
http://farmapi.fastway.org/v2/tracktrace/detail/?LabelNo=3a0000253492&CountryCode=6&SortByType=true

As you can see, there are at least two ways of executing API methods.

Note: When specifying parameters by name, please realise that PARAMETER NAMES ARE CASE SENSITIVE. A lot of people get this wrong, and it causes them needless frustration.

Additionally, if you dont like JSON, you can specify the response type. The following response types are supported:

Choosing another response type is easy. Simply append it to the end of the url, before the querystring. Like this:

http://farmapi.fastway.org/v2/tracktrace/detail.xml?LabelNo=3a0000253492
NOT like this:
http://farmapi.fastway.org/v2/tracktrace/detail?LabelNo=3a0000253492.xml

Great! Now you know how to make calls, you can go see what calls are available.