Follow us on Twitter...
Stay up to date with the latest news, special offers and advice from CensorNet on Twitter... we are Tweeting regularly!
The CensorNet Hosted Web Security platform provides a web services REST API for developers to integrate the service into their own applications.
The CensorNet Hosted Web Security platform provides a web services REST API for developers to integrate the service into their own applications. It can also be used to create maintenance programs, such as being able to automatically import users into your account from an external source (e.g. LDAP, RADIUS, PostgreSQL, MySQL, etc) or export reporting data for processing elsewhere. As the API is RESTful, it supports the standard HTTP methods of GET, POST, PUT and DELETE. All message payloads use JSON format for lightweight communication. As it is based on HTTP, the API can be used from any programming language that provides access to the HTTP protocol (e.g. Perl, PHP, C#, C, etc).
Any feature or option that you see in the Hosted Web Security web control panel can be accessed via the API. That's powerful!
The following simplified example is given in Perl but the same principal applies to other programming languages. It shows how to authenticate your script with the API which allows you to retrieve a secret key that is then used to securely sign future requests to our API.
#!/usr/bin/perl
use MIME::Base64;
use LWP 5.64;$auth_header = "$username:$password"; // Valid admin user credentials
$base64_auth_header = "Basic " . encode_base64($auth_header);
$url = "https://www.cloudwebfiltering.com/api/auth";my $browser = LWP::UserAgent->new;
my @send_headers = (
'Authorization' => $base64_auth_header,
);print "Authenticating...";
$response = $browser->get($url, @send_headers);if($response->is_success) { # We got a 200 OK from the server
print "Success\n";
}
To access the REST API you will need to obtain the REST API developer documentation from your account manager which is available to all customers at no extra cost.