Can you get nbn? Qualifications are now easier!

In early July, we released our nbn REST API for service qualifications and management. Since then we’ve processed hundreds of qualifications and used it to solve several complex problems relating to service availability for nbn.

But now we’ve made it even easier for our residential, business and wholesale customers to access the power of this system. We’ve brought our nbn Qualification Endpoint to the Real World website here in a simple, easy-to-use online form.

Try it out!

How did we do it?

Our API server is written in Python (using Django Rest Framework), but the Real World website runs WordPress. So how  did we do? The entire nbn API is documented in Swagger. This means that we can easily implement server-side code to read and parse the API, regardless of the language.

We started by using Swagger CodeGen to generate a PHP client for the API. We used the library from SwaggerHub initially, and then made some minor tweaks to deal with some issues in the returned format. This gave us a PHP client library using GuzzleHTTP that let us qualify addresses.

From here, we were able to write some simple PHP code to wrap the two key features we needed – address autocomplete and service qualification. We used the template examples from the SwaggerHub library to handle this, and used Token authentication to send our requests to the API library.t

For address auto-complete, we essentially proxy the requests through to the nbn API, and return the results. We massage them slightly so our autocomplete widget (a jQuery autocomplete widget) can display the results.

The SQ process is a little more complicated.

The address AutoComplete returns an NBN Location ID which we can use to qualify the service. The SQ result is slightly naive as to whether a site is serviceable – the data is there, but we need to parse it a little to make it useful to a user.

We keep a set of nbn Service Classes in the library, and then based on the service class returned set whether nbn is available at the location. We also loop over the returned Copper Pair IDs (if there are any) to determine the line rate speed attainable according to nbn’s calculations. If the service doesn’t have a line rate speed because of technology type (e.g FTTP, HFC or Wireless), we return the maximum attainable line rate on our network at present (100/40) or a range for Fixed Point Wireless (as performance is varied on this technology).

We use the Geographic details from the address result to display a map using Open Street Maps and the leaflet.js library.

In time, we’ll look at releasing some of this client/server side code to our wholesale customers, but hopefully this overview provides anyone interested enough of an idea as to how we approach this!

What about the website code?

For now, we’ve just embedded the code into our WordPress site. There isn’t any magic rocket-science here, so there isn’t a need to obfuscate this any further. In time, we may factor the code that is currently embedded into the page into a proper WordPress module, which will tidy the code and make it portable between WordPress sites. If you are interested, you can view the source. We’d welcome improvements and feedback on how we can make this better!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.