CDN API
06 Sep 2018

CDNsun Releases a Client for its CDN REST API

As much as content delivery networks are essential for running a successful business by ensuring 100% website uptime, fast page loading speed and satisfying user experience, they also need to fit your case in terms of value and usability. While many industry-leading vendors offer flexible pricing plans and charge clients on a pay-as-you-go model, there are instances where users simply aren’t able to define just how much GBs and/or data centers – PoPs – they need to pay for.

Moreover, while on a global scale these metrics shouldn’t fluctuate too much, the number of visits that your website receives from various geolocations is subject to change on an hourly basis. If you’re really serious about optimizing costs and making the most out of your investment, you’ll need to pay close attention to these metrics.

In terms of value, the CDN you’re using provides you with the following informtion:

  1. Usage data – how many users are accessing your website in a given time period, which geolocations are the most active during various hours of the day, which pages receive most visits, etc.
  2. The amount of GBs you spend per PoP and how much it costs you exactly.

While these metrics can be accessed via reporting and analytics features, it’s very hard to manually keep track and make use of all this information.

Enter CDN API.

An API integration allows you to automate certain CDN actions directly from your website and apps while receiving real-time reports and updates on the above-mentioned metrics.

What is API?

Put simply, API (Application Programming Interface) is a way for the user’s browser, also known as the client, to easily interact with a server and load a website or page, while also being able to complete additional actions, if needed.

To put things into perspective, look at it this way. The global web represents a large network of connected servers, which means that every page is located on a remote server, somewhere. When a user types in www.Twitter.com in their browser, it sends a request to one of Twitter’s remote servers and after receiving a response, displays the site. Now for the browser, Twitter’s server is an API.

Note: The API isn’t a server itself: it’s more like the part of the server that receives requests and sends responses.

REST API

At CDNsun, we provide RESTful API to offer maximum flexibility to our clients. When comparing different API protocols, namely SOAP (Simple Object Access Protocol) and REST (Representational State Transfer) – the two most widely used web service communication protocols – REST provides a number of benefits over SOAP in the case of CDN. Namely, REST:

  • Uses HTTP for communication, which is by far the simplest method nowadays.
  • Allows a much bigger variety of data formats compared to SOAP, which only allows XML.
  • Is much easier to work with and offers better support for browser clients.
  • Delivers better performance thanks to caching for non-altered and non-dynamic information.
  • Is used for major services including Yahoo, eBay, Amazon and Google.
  • Uses less bandwidth and is faster.
  • Is much easier to integrate with any website due to not altering site infrastructure. Just add the additional functionality and you’re good to go.
  • Is much better suited for mobile thanks to the overhead of additional parameters being less (headers, footers, etc.)

CDNsun API Client

Our API client is designed to be the part of your apps’ source code and help you easily access the CDN API through your apps. The client helps you save loads of time since there is no need to develop one on your own and it also enables functionality like getting CDN service reports, purging and prefetching CDN service content directly to your app’s programming language.

  • CDN service reports will help understand how many GBs you spend per PoP and geolocation, how much money you pay for each GB and enable you to use this information to adjust your strategy accordingly. Also, this functionality can be effectively used in conjunction with purging and prefetching to maximize the effectiveness of the content delivery and page loading speed.
  • Purging is directly correlated to improving customer experience and allows you to remove/update stale, outdated and/or unwanted content quickly and effortlessly. While this is important for any website, some businesses like social media, e-commerce, news portals, trading platforms, gaming and advertising will suffer severely without it.
  • Prefetching allows the browser to silently fetch all the resources needed to display content that a user may access in the near future, ahead of time. These resources are stored in its cache enabling it to deliver the requested data faster, resulting in exceptional user experience. This trick is particularly useful for heavy websites that have a lot of content to display, which can be accomplished without negatively affecting page loading time. Moreover, when paired with the CDN service reports feature, you can define the most and least visited website pages, allowing you to configure prefetching as close to perfect as possible.

We support quite a wide range of programming languages – PHP, Ruby, Python, Node.js, Java, .NET, Golang – to make sure that any customer will be able to make use of our client easily. Finally, our code is open source and publicly available on GitHub – a renounced software development platform – and anybody is welcome to contribute to it. To access the code, simply download it via git clone and make any changes/additions you find necessary. All your contributions are much appreciated!

Guided by the mission to provide affordable, reliable, highly secure and lightning-fast CDN services, CDNsun has been assisting clients to dramatically accelerate their content delivery since 2012. Our network consists of 50 points of presence scattered all over the globe. Each PoP is equipped with the latest SSD drives, maximizing your website’s performance. We offer some of the lowest prices on the market – $0.04 per GB of data spent – and use the pay-as-you-go pricing model. Finally, all users including trial accounts get access to 24/7 support via email, phone and live chat.