Programming with the Web Services API

Posted by Andree Toonk - December 15, 2009 - - 4 Comments
Lately I have received quite some questions with regard to connecting with existing monitoring software. As well as requests for making more data available for developers. I'm happy to announce that these things should now be possible trough the Web Services API. This  API  allows you to access your alert as well as other features from your own program running anywhere on the Internet. I will use the rest of this Blog to briefly explain how the API works and what it can be used for. More  detailed information regarding the API and how to use this, can be found on the  Web Services API page. Web Services The API  provide a number of Web services  for developers. It allows you to query our database and let's you integrate this in your own software. As we are using SOAP  as the web services protocol. All the web services are described in a WSDL file, which can be found here. Currently the following functions are available:
  1. getIPInfo()
  2. GetAlerts()
  3. GetAlertDetails()
  4. GetASname()
  5. GetASPrefixes()
  6. GetCountry()
More information about these function can be found here Integrating with your software SOAP is a programming language independent protocol and is supported by all popular languages.  It allows you to access the BGPmon API over HTTP. Some of the functions are specific for your account and thus allow you to authenticate, others are currently publicly accessible. Let's get started with two examples On the API page you will find two examples of SOAP clients that use the the SOAP API, a perl and a php example. The examples are for users to use, as well as to learn from in case you want to write your own application using our API. Perl Nagios plugin example The nagios plugin is written in perl and allows you to monitor your prefixes in Nagios by utilizing the API. The script expects a number of arguments, these allow you to filter on the type of alerts that will be returned. The source code for this plugin example can be found here. PHP RSS feed example This is an example of utilizing the SOAP API in PHP. The PHP RSS example retrieves all the alarms and represents the results in a RSS feed. You will need to edit the PHP script and change the email and password variable to your own BGPmon email and password. You can then call the php script using your browser or any other RSS reader. Optionally you can change the days, maxalert and active aruguments, An example using the demo account can be found here: The source code can be found here Developing your own programs Should you decide that you want to write your own program and you have any questions please leave a comment on this blog. Also if you have created your own program and are willing to share this, please sent it to me so I can add it the the examples page. Keep in mind that the Web Services API is a new feature, if you find any bugs please let me know and I will try to solve them asap. Happy programming!


Leave a Reply

Your email address will not be published. Required fields are marked *