The Fastway API requires an api key for all areas except the documentation area and signup area.
To signup for an API key, have a look here
Once you have a key, append "api_key" as a URL parameter to your requests, for example /foo/bar?param=value&api_key=your API key
The Fastway API is a RESTful API that is intended to be invoked by third parties in order to take advantage of and integrate with our internal systems. The latest version of the API can always be found at: api.fastway.org/latest.
The API is intended for use by programmers only. We receive a lot of requests from marketing people or people who run ecommerce websites asking how to make the API magically provide functionality in their system. We do not have the resources to provide plugins for every e-commerce solution on the market, so we instead provide the means for programmers to build such plugins themselves.
The API is divided into areas. Each area has methods that can be called that relate to that area. Each method call is represented by a URI.
These areas are not available to the general public, but access can be requested by emailing firstname.lastname@example.org or email@example.com.
At this time, the API only supports HTTP GET and POST requests. Typically, the method is named in the URL, and the parameters are passed in the same way as a browser would. For example, in a GET request, you pass parameters in the URL (http://some/url?param=value¶m2=value2) and in a POST request you pass parameters in the POST body.
PARAMETER NAMES ARE CASE SENSITIVE.
Additionally, parameters can be passed in order as part of the URL body (not the querystring or post body). In this case, the name does not need to be specified, just the value, which is matched to the name based on the order in the URL. For example, "http://api.fastway.org/latest/tt/render/3a0000253492". Look at the documentation for each method to determine the parameter order if you wish to pass parameters this way.
To figure out the urls to call, have a look at the Areas section above. This will tell you all the methods available in the area. If you click a method, it will tell you a general description of the method and the parameters you can pass it.
Lets say you want to add Fastway track and trace to your website. You know that cross-domain AJAX is blocked by the browser, but you see that in the Response Types section that the Fastway API supports JSONP, which works cross-domain. You then click the "Track & Trace" link in the Areas section above and see there are at least two methods available that deal with Track & Trace: detail and render.
You read the description for each and see that "detail" returns a data structure, and "render" returns formatted HTML. You decide that for now you will use the formatted HTML returned by the render method in your website, as can always generate your own HTML from the data structure returned from the "detail" method later.
From reading the documentation, you see that the "render" method takes two parameters: LabelNo and CountryCode. You also notice that the CountryCode parameter is optional, and decide against specifying it as you want someone to be able to track/trace any label number in the world. You also notice the order of the parameters: LabelNo first, and then CountryCode.
Based on the information you just discovered, you craft the following url (using the test label 3a0000253492):
(obviously you substitute YOUR_API_KEY with your API key). You browse to this URL in your browser to see the JSONP that the server returned. You notice that its calling your callback function "myfunction" with a data structure containing a "result" key, with the value being a whole lot of HTML containing the track/trace data.
Responses are either in HTML, JSON, XML, PLIST or JSONP depending on the request url. The default is JSON. To get another response, append the desired response type to the end of the request URL BEFORE ANY PARAMETERS.
Note: While both XML and PLIST are both technically XML, PLIST is provided for the benefit of MacOS/iOS developers (since there is apparently good library support for it on these platforms) while XML is provided for everyone else who doesnt like the PLIST format and wants XML that makes more sense.
Note: JSONP requests require a "callback=?" parameter. If this is omitted, the callback method name defaults to "callback"
Check the relevant documentation sections to see what parameters are available.
Some API wrappers have been written for various languages that make API calls easier to achieve in the language. These wrappers include facilities for making API calls, and dealing with the responses.
They are not pluggable modules for your website, however they can be used by programmers to build pluggable modules for your website.
Get the PHP API wrapper here. Instructions on using it are written in comments at the top of the file.
Unfortunately, the Java API wrapper is not yet complete. Watch this space!
Unfortunately, the C# API wrapper is not yet complete. Watch this space!
If you need additional functionality added into the API, please feel free to contact Jaden or Erin and we'll see what we can do.