WHAT IS THE API?
The BETDAQ Application Programming Interface is a set of webservice methods that can be called directly by custom software, allowing you to write stable applications that do not have a dependency on the BETDAQ website. It enables you to build your own customised interface. This could be your own front end or your own tool that utilises market information and places orders. The opportunities are endless. The BETDAQ API consists of read-only and secure methods. The read-only methods are generally accessible information while the secure methods are for account specific information.
HOW DO I USE THE API?
You will need to build code that can call the web methods and that can understand the results that are returned. The good news is that most modern languages (.Net and Java for example) provide tools that will automatically build this code for you. We provide standards based files that these tools use.
The most important file is the WSDL file (Web Services Description Language). This file details the SOAP message formats that the web methods use. The BETDAQ WSDL file is here. Your programming environment should provide a tool that can download this file and generate “proxy” classes that can be used to access the web methods on the server. Every time the WSDL changes (which should not be often) you will need to update your web references so that the new proxy classes can be generated.
In the Visual Studio environment, it is easy to add Web references to your project:
- Right click on the project in the solution explorer, and select “Add Web Reference..”
- In the “URL” textbox, paste in the URL of the WSDL file given above and click “Go”. Visual studio will download the WSDL file. The wizard will indicate that it has found a service, and the “Add Reference” box will become active.
- Fill in a sensible name in the “Add reference” text box – Something like “BETDAQAPI” is a good idea as this will be part of the namespace of the generated classes.
- The dialog will close, and the proxy classes are now available for use. However, read on for how to generate security aware proxy classes..
- Anytime the WSDL on the server is updated, you need only select the web reference in the solution explorer and select “Update Web Reference” and the proxy classes will be regenerated
Every request to the server must be accompanied by the Betdaq ExternalAPIHeader SOAP header. This has 4 attributes, and must accompany every request:
This is used to identify the version of the API that you are working against. As we update the API over time, we will increment the version requirements. The server may reject requests that are for versions that it can no longer support. By submitting this field, we can make sure that you are interacting with the correct version of the API.
The external API supports a number of different languages, including Chinese. Use this field to receive translated data. Please refer to the WSDL to see the full list of available languages.
Use this attribute to specify the currency that you want money amounts to be converted to.
Use this attribute to specify your username.