Archive for May, 2007
You 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.
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.
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.
No commentsShow off your project
Everyone at SoftLayer is excited about the API. But we can’t wait to see what our customers are going to be doing with it. You can go to the implementations page to see some examples of ways to use the API. What we would really like to put on that page is a list of applications developed by our customers. If you create a use for the API that is new and unique, or if you just want to show the world how cool you are - send us an email at sldn@softlayer.com and tell us about it and we will feature your project on the implementation page.
No commentsQuick example
We are ushering in a new era at SoftLayer with the release of the SoftLayer API. The API opens endless possibilities for our customers to integrate SoftLayer specific functionality into their corporate infrastructure and / or software products. With the API, you can provide datacenter specific control for your server or custom management of SoftLayer services to your customer base. For server resellers, this allows unbranded SoftLayer functionality to their customers via integration into their current customer portal. The API utilizes SOAP or XML-RPC for a communication protocol, by using a non-language specific protocol like SOAP or XML-RPC integration can be made with most current programming languages.
With the growing adoption of PHP on the web, I am going to show you a quick example utilizing PHP 5 with SOAP support enabled. For this example, we are going to pull the list of servers associated with an account and format the results into an html table. This should provide a brief overview to how easy integration into a system utilizing PHP could be.
Let start by defining a few variables we will use which are commented below:
<?php
// Enables or disables the WSDL caching feature
ini_set(“soap.wsdl_cache_enabled”, “0″);
// Your API Access key, that you generated in the customer portal
define(‘AUTH_KEY’,
‘000000000000000000000000000000000000000000000000000′);
// Your Customer Portal Username
define(‘AUTH_USER’,‘SL00000′);
// Where our SOAP server is located
define(‘SOAP_SERVER_LOCATION ’,
‘https://api.service.softlayer.com/soap/v1/SL-Service.html’);
?>
Our first step after setting our configuration options is to create the SOAP client connection:
<?php
$client = new SoapClient(null, array(‘location’ => SOAP_SERVER_LOCATION,
‘uri’ => SOAP_SERVER_LOCATION) );
?>
Next we will setup a few variables to be used with a try / catch statement. The try / catch statement will perform the call to the SOAP server:
<?php
# Did our SOAP call complete?
$bolResult = false;
# What was the returned error message
$strErrorMessage = “”;
# Lets store our results in an array
$arrResult = array();
try {
$arrResult = $client->__call(“getServerList”, array() ,null ,
new SoapHeader(‘myUrn’, ‘authenticate’,
array(AUTH_USER, AUTH_KEY) ) );
$bolResult = true
} catch( SoapFault $e ) {
$strErrorMessage = $e->getMessage();
}
?>
You might have noticed that we created a SOAP header that was placed in the call. This was used to pass the login credentials for authentication on the server.
At this point, there should be a response or an error message. Next we will do some basic formatting for the web to show the results.
<?php
if($bolResult){
echo ‘<table cellpadding=”2″>’.“\n”;
if(count($arrResult)){
foreach($arrResult as $arrServer){
echo ‘<tr>’;
echo ‘<td>’.$arrServer['ID'].‘</td>’;
echo ‘<td>’.$arrServer['SERVERNAME'].‘</td>’;
echo ‘<td>’.$arrServer['PUBLIC_IP_ADDRESS'].‘</td>’;
echo ‘<td>’.$arrServer['PRIVATE_IP_ADDRESS'].‘</td>’;
echo ‘<td>’.$arrServer['MGMT_IP_ADDRESS'].‘</td>’;
echo “</tr>\n”;
}
} else {
echo “<tr><td>No Servers Found!</td></tr>”;
}
echo “</table>\n”;
}else{
echo “There was an error with your SOAP call<br>\n”;
echo “Error Response:<br>\n”;
echo $strErrorMessage.“<br>\n”;
}
echo “Done!<br>\n”;
?>
This sums up how to make a request using PHP 5 with SOAP support enabled. Using the SOAP or XML-RPC protocol make the API easy to integrate into most languages, but makes it difficult to cover every language in an example. For that reason, I have included some raw SOAP requests below. If you can send a RAW HTTP POST request to our SOAP server in the format below, chances are your language can integrate into the SoftLayer API.
Example SOAP Request (no parameters)
<?xml version=”1.0″ encoding=”UTF-8″?>
<SOAP-ENV:Envelope
xmlns:xsi=”http://www.w3.org/1999/XMLSchema-instance”
xmlns:SOAP-ENV=”http://schemas.xmlsoap.org/soap/envelope/”
xmlns:ns1=”http://schemas.xmlsoap.org/soap/encoding/”
xmlns:xsd=”http://www.w3.org/1999/XMLSchema”
SOAP-ENV:encodingStyle=”http://schemas.xmlsoap.org/soap/encoding/”>
<SOAP-ENV:Header>
<ns2:authenticate>
<xsd:string>SL00000</xsd:string>
<xsd:string>0000000</xsd:string>
</ns2:authenticate>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<ns1:getServerList/>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Example SOAP Request (with parameters)
<?xml version=”1.0″ encoding=”UTF-8″?>
<SOAP-ENV:Envelope
xmlns:xsi=”http://www.w3.org/1999/XMLSchema-instance”
xmlns:SOAP-ENV=”http://schemas.xmlsoap.org/soap/envelope/”
xmlns:ns1=”http://schemas.xmlsoap.org/soap/encoding/”
xmlns:xsd=”http://www.w3.org/1999/XMLSchema”
SOAP-ENV:encodingStyle=”http://schemas.xmlsoap.org/soap/encoding/”>
<SOAP-ENV:Header>
<ns2:authenticate>
<xsd:string>SL00000</xsd:string>
<xsd:string>0000000</xsd:string>
</ns2:authenticate>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<namesp1:getServerSoftwareDetails xmlns:namesp1=”ns1″>
<param0 xsi:type=”xsd:int”>0000</param0>
</namesp1:getServerSoftwareDetails>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Additional Resources:
http://www.php.net/manual/en/ref.soap.php
http://en.wikipedia.org/wiki/SOAP
http://www.xmlrpc.com/