X.NU allows developers to interact with the website via an Application Programming Interface (API).
If you are planning to use X.NU to create short or customized URLs, do it for free through simple HTTP GET requests.
Let's start with an example, maybe the best way to explain the API usage.
First of all you've to build the request URL.
Please be careful: remember to url-encode all the values of the GET parameters; all the no url-encoded parameters will be ignored or misinterpreted.
The X.NU server will return a JSON formatted response:
The result field of the JSON data structure will indicate the operation outcome. In this case the requested operation was accomplished and the desired short URL is http://x.nu/aDb
The client application has to be authenticated before the request processing. The apikey parameter represents the assigned application ID. You must send us (firstname.lastname@example.org) an apikey request before you can start, explaining the purpose, the estimated requests' rate, the host name and the public IP address of the application is going to use the API.
Every client application has a limited request rate per second. Additional requests will be ignored.
All the HTTP requests must be directed to http://api.x.nu with the following GET parameters:
* apikey (mandatory): the reserved client application ID.
* op (mandatory): the operation to be executed. The permitted values are cc to create short URL and ca to create customized URL. ca operation must be used together with alias parameter, see below.
* url (mandatory): the url to shorten.
* alias: the alias you want to be assigned to the specific url parameter. It will be considered only for ca operations.
The XNU application server use JSON to communicate the result of the request processing. In case of positive outcome the response will be something like this:
If something goes wrong, the response will contain the error message:
Register your application
Request an API-key access by email.