Welcome to the SoftLayer Development Network!
The SoftLayer Development Network is a part of a SoftLayer initiative to increase managability and ease of administration of remote dedicated servers. We started this community to help our customers integrate and use applications in conjuction with the SoftLayer API.More methods, this time for the bean counters.
(This post refers to SoftLayer API version 1. Check out API version 3 for our latest updates.)
We’ve put four new methods into the API. They are:
getInvoiceList()
Return a listing for each account that includes the invoice id, date, starting balance, ending balance, invoice amount, payment amount, and account type.
getAccountBalance()
Return the current balance and next bill date for an account.
getInvoice(intInvoiceId)
Retrieve a copy of an invoice in PDF format.
And by request:
getServerCost(strServerIdentifier)
Return the “Total cost of a single server.”
Keep’em comin’, epratt!
By the way, users running each of these methods must have the “View Account Summary” priviledge. You should not have any problem if you can access the accounting tools in the portal.
Read More No commentsNew API method for searching IP addresses
(This post refers to SoftLayer API version 1. Check out API version 3 for our latest updates.)
We’ve added a new feature to the
Softlayer API: getIPaddressDetails. For a given IP address, this method will retrieve the parent subnet, VLAN identifier, IP address which it is routed to and the name of the server it’s routed to. Instead of using the customer portal and typing in a slew of IP addresses one by one into the public network ip search page, simply call this IP for each IP address, saving you time and typing. It’s incredibly useful for tracking down your secondary IPs.
getIPaddressDetails(strIPaddress)
Retreive subnet and server details for given IP Address
This new method is available via both SOAP and XML-RPC interface.
We’d love to hear your thoughts on this new feature. Feel free to provide any comments and recommendations for improvements on this new API.
Read More No commentsIt pays to ask
(This post refers to SoftLayer API version 1. Check out API version 3 for our latest updates.)
Ask…
And you shall receive…
The newest addition to the API methods has been released and is now available for use. We have improved upon the Portal’s monitoring features by adding just a little more data. In addition to receiving the number of servers that are up, recovering, and down, the new function also returns an array with specific details about the servers that are down. This includes: SERVER_NAME, ID, PUBLIC_IP, PRIVATE_IP, and TIME_FIRST_DOWN, which as requested is “the time that the monitoring system first detected that it was down”.
getServerStatus()
Retreive a server status of UP DOWN or RECOVERING for a given account id.
The new method is available through our SOAP and XML-RPC interfaces. Okay, so we didn’t quite give you exactly what you asked for, we gave you more!
Read More No commentsTime for some morning Java
(This post refers to SoftLayer API version 1. Check out API version 3 for our latest updates.)
We’ve put a Java SOAP example up on our downloads page. This was written in Eclipse 3.2.2, and for your convenience the example package contains our Eclipse project files. The code should run on JVM version 1.4 and above. We’d love to hear your feedback on this example. Reply here or post on our forums and let us know what you think. See ya’ll later!
Read More No commentsAPI Hacking Fun With Python
(This post refers to SoftLayer API version 1. Check out API version 3 for our latest updates.)
Hello! I’m Shawn, one of new “Code Writing Professionals” at SoftLayer. When a call went out for examples using SoftLayer’s new API, I immediately signed up to write the INTERCAL, Prolog, and Apollo Guidance Computer modules. I was told to make those low priority projects, and to perhaps focus on hacking with Python instead. If you just want to see the finished code without all the Python evangelization, skip to the end of the post. For those of you who haven’t hacked with Python yet, follow along for the ride!
In case you don’t know, Python is an incredibly simple and clean looking programming language. Many people have picked it up in just a few minutes! If you already program in another programming language (like C, Java, PHP, SH, or Perl (shiver)), Python may look a bit strange. But it’s not too strange at all. In fact, the only “strange” bits in Python are it’s reliance on whitespace (you have to line up your code) and the lack of braces.
Any good FORTRAN coder will tell you that whitespace is good.
If you run a flavor of UNIX, Linux, or BSD, you most likely have Python already installed. If you are running Windows or if your distribution doesn’t come with a recent Python package installed you will need to install Python. You Linux guys can install it with your favorite package manager (it’s usually named python). Windows users (or UNIX haxxors who prefer tarballs), pick up the latest version of Python from ActiveState. (You will also want to check out ActiveState’s free(!) Komodo Edit)
Install Python and we are ready to go!
Open up a UNIX Terminal or the Windows command line (Start->Run… type CMD {enter}), then type “python”. This boots up the Interactive Python Interpreter. One of the cool things about Python is that you can whip up a Python Interpreter and just start typing in program fragments. It’s like the “immediate” mode in QBASIC for DOS, but neater. You should see something like this:
![]()
The first step is to import the XML-RPC library for Python. In keeping with Python’s “Batteries Included” approach, the most useful libraries come standard with any complete download of the Python interpreter, and this includes the standard XML-RPC library. To do this, type:
import xmlrpclib
Now Python has all the functionality needed to make and receive XML-RPC calls loaded into the interpreter. Let’s set up some variables to make hacking with the library much easier. In the interpreter, type:
url = "http://api.service.softlayer.com/xmlrpc/v1/SL-Service.html"
key = "YOUR SOFTLAYER API KEY"
usr = "YOUR SOFTLAYER API USERNAME"
Now we need to set up a Server Proxy. This is an object that we can make method calls against that does all the dirty work of compiling the XML and parsing the data… all the boring stuff. Using the proxy we get to make XML-RPC calls as if all the work was being done on the local machine. This is easy to do. Type this into the interpreter:
server = xmlrpclib.ServerProxy(url)
Now you have your proxy. If you print out the server variable (print server) you will see that server is an instance of the ServerProxy class made to communicate with the SoftLayer XML-RPC server. Now, let’s actually do something!
serverList = server.getServerList(key, usr)
This invokes the XML-RPC getServerList method, which retrieves your list of servers and stashes it into serverList. Let’s see what you got:
print serverList
The data is returned as a LIST of DICTIONARIES, with one DICTIONARY per server. Let’s loop through this list and display the servername of all your servers:
for thisServer in serverList:
print thisServer["SERVERNAME"]
The two space indentation at the beginning of the second line are required or else the code won’t work. Hit enter twice, and Python will print out the Servername (hostname + domain name) for all servers in your account. You can pull more data out of the dictionary easily:
for thisServer in serverList:
print thisServer["SERVERNAME"], thisServer["PUBLIC_IP_ADDRESS"]
You can make all the method calls listed in the SoftLayer API Documentation by calling them as methods of the server class:
server.getBandwidthList(key, usr, "192.168.1.1")
server.getServerNetworkDetails(key, usr, "192.168.1.1")
server.rebootServer(key, usr, "192.168.1.1", "Soft Reboot")
Python is easy to pick up and play with, and with it’s XML-RPC library, it’s probably the fastest way for people to hack with the SoftLayer API. The complete code listing to display all your servernames is below:
# Quickie Python XML-RPC Demo for the SoftLayer API
# Written by Shawn Boles, SoftLayer Development
# API Connection Details
url = "http://api.service.softlayer.com/xmlrpc/v1/SL-Service.html"
key = "PUT YOUR SOFTLAYER API KEY HERE..."
usr = "PUT YOUR API USERNAME HERE..."
# This is the XML-RPC Library for Python. It comes standard!
import xmlrpclib
# Set up the proxy object for the SoftLayer server. You can make
# calls against this object as if the processing is local.
server = xmlrpclib.ServerProxy(url)
# Make a method call on getServerList from the API.
# Don't forget to pass the key and usr variables as the first
# two parameters, in that order!
serverList = server.getServerList(key, usr)
# Loop through all servers, displaying their servernames.
for myserver in serverList:
print myserver["SERVERNAME"]
Only 8 lines of code, ignoring comments and empty lines. Hacking indeed! When a new API method comes out you can pop open a command line and slap together a test case in a minute or two to try it out!
Extra Credit: Let’s do something a little more useful with our new |33+ Python API Hacking Skilz:
# Display all my servers and IP addresses, using the SoftLayer API
# Written by Shawn Boles, SoftLayer Development
# API Connection Details
url = "http://api.service.softlayer.com/xmlrpc/v1/SL-Service.html"
key = "PUT YOUR SOFTLAYER API KEY HERE..."
usr = "PUT YOUR API USERNAME HERE..."
# This is the XML-RPC Library for Python. It comes standard!
import xmlrpclib
# Set up the proxy object for the SoftLayer server. You can make
# calls against this object as if the processing is local.
server = xmlrpclib.ServerProxy(url)
# Make a method call on getServerList from the API.
# Don't forget to pass the key and usr variables as the first
# two parameters, in that order!
serverList = server.getServerList(key, usr)
# Loop through all servers, displaying their servernames.
for myserver in serverList:
# Get the list of Server Details from the API for each server:
serverDetail = server.getServerDetails(key, usr, myserver["ID"])
# "Unfold" the Server Details data structure and give us access
# to only the IP information...
prettyServerDetail = serverDetail[2][0]
try:
print myserver["SERVERNAME"], \
"\n\tPublic IP:", prettyServerDetail["PRIMARY_PUBLIC_IP"], \
"(", prettyServerDetail["PUBLIC_PORT_SPEED"], "),", \
"\n\tPrivate IP:", prettyServerDetail["PRIMARY_PRIVATE_IP"], \
"(", prettyServerDetail["PRIVATE_PORT_SPEED"], "),", \
"\n\tManage IP:", prettyServerDetail["MGMT_IP"], "\n"
except KeyError:
print "NONE\n"
pass
Here’s a direct link to the sample file for your editing pleasure.
In no time at all you will be hacking apps for your API no sweat! And you aren’t locked down to command line tools, either. Python comes with just about every GUI kit, can be used to make your own Python-powered control panel…
Have fun hacking!
Read More No commentsLet’s get this party started.
(This post refers to SoftLayer API version 1. Check out API version 3 for our latest updates.)
Howdy, everyone. The SoftLayer dev team has been growing a bit lately to handle new portal additions and adding fancy new methods to the API for ya’ll. So far we’ve gotten some great feedback on the API and how to make our application servers work better for you and your businesses. Now that we’ve got the API out and some extra head count what say we kick into high gear?
Here’s our game plan. We know how smart our customers are. We know how they think (we hope). They’re geeks who find perverse joy in taking things apart, reassembling them, and building cool new toys out of the leftover parts. We want you to give that a try with our API. Our Implementations Forum has a good start, but we’re looking for something to really knock our socks off. So far the coolest thing we’ve seen is a Yahoo! widget. Who can top that?
Email us, post to the forum, or leave a comment here with sweet implementation goodness. Surprise us. Show us what wacky stuff you can do with your server and our API. If you don’t code then that’s fine. Send us your ideas. Maybe someone will pick up on it. To get the ball rolling we’ll write an app or two of our own. Even better we’ll release the source of our app to get ya’ll started. Let’s see what kind of cool programs we can write.
Read More 2 commentsAPI Addition - Backbone Graphs
(This post refers to SoftLayer API version 1. Check out API version 3 for our latest updates.)
Due to popular demand, we rolled out a change today which allows querying of our backbone connection graphs. For the uninitiated, backbone graphs show the network usage between the SoftLayer datacenter and the Internet. This functionality was accomplished by adding two new methods to the SoftLayer API.
getBackboneList
Retrieves an array of id and name pairs for all SoftLayer’s Backbone providers
getBackboneImage(intBackboneId)
Retrieves a PNG image for display or local storage
Both of the methods are available via the SOAP and XML-RPC interfaces. We will be updating the documentation and examples for these methods and a few other additions (Top Secret) over the next few weeks.
Read More 1 commentYou ask, we respond
(This post refers to SoftLayer API version 1. Check out API version 3 for our latest updates.)
We have received a lot of positive feedback on the API. Thanks, we appreciate it. We stood around and patted ourselves on the back for five seconds and got back to work.The first few requests were for bandwidth graphs of our network providers and the ability to control the SoftLayer DNS resolvers for forward and reverse lookups just like in the customer portal. These will be the next couple features you see.Another popular suggestion is for an API function to perform OS reloads (like you currently can from the customer portal). Also, some of you have asked for a sandbox. We are scoping out these two projects so we can add these as well.
Keep checking out these pages to watch for new features and more information. Or, you could join the 21st century and subscribe to the RSS feed.
Read More No commentsIntroduction
Welcome to the SoftLayer Developer Network!
SoftLayer has been a leader in giving our customers control over their dedicated server environment through our customer portal. Now we are pushing the envelope and exposing that same level of functionality to our customers through an API. To help you we have created this community - The SoftLayer Developer Network.
Just think of what you could do with an API to the datacenter. You could integrate the API into your custom application, you could write a plug-in to your favorite third party app, you could integrate dedicated server command and control into your corporate intranet, or you could even create your own version of the SoftLayer portal.
This initial (1.0 beta) release of the API is fairly simple. We decided to start with a basic feature set and see what other features the SoftLayer community wanted. This is where our users come in. Let us know what features you would like to see in the API by commenting on blog posts or posting in our forums.
Take a look around, read the FAQs, download the SDK, and post in the forums. We are excited about the SoftLayer API and hope you will be too.
Read More 2 commentsForums
We have launched a new group of forums to provide an area where developers and SoftLayer customers can discuss topics related to the SoftLayer API and receive new features / release announcements for the API. Additionally, you can showcase your newly developed applications that utilize the SoftLayer API.
Section one “Announcements” provide information pertaining to new additions of downloadable content, official add-ons for server control panels and other related software, new features that have been added to the API, and any upgrade windows pertaining to SoftLayer API infrastructure.
Section two “Implementations” is intended to discuss projects you have integrated into the API and projects you would like to see designed and built using the API. From Control Panel integrations to desktop application development, show us what you have got or would like to see.
Section three “General API Discussion” is for all API users. Have a question or issue with your application or the API? This is the forum for all things API.
Whether you need assistance or would like to help other users get up and running, the new API forums is a great place to start your project utilizing the SoftLayer API.
Read More No comments