Welcome to the Abraracourcix API.
The verbs used in the API are:
GET
: Used to retrieve resources.POST
: Used to create resources, or perform custom actionsPUT
: Used to replace the resources or collections.DELETE
: Used for deleting resources.
The API supports application/json
, encoded in UTF-8. XML is not on the roadmap.
We use a management system of the versions of the URI. The first element of the URI contains the identifier of the target version, for example :
http://abraracourix:8080/api/num_version
The current version is v1
The API supports Basic Authentication as defined in RFC2617.
To use Basic Authentication, simply send the username and password associated with the account (cURL will prompt you to enter the password) :
$ curl -u <username> http://abraracourix:8080/user
Code | Name | Retry Behavior |
---|---|---|
400 | Bad Request | The body of the request invalid. The request either must be changed before being retried or depends on another request being processed before it. |
404 | Not Found | The requested resource could not be found. The request must be changed before being retried. |
500 | Internal Server Error | The server encountered an error while processing the request. This request should be retried without change. |
Example:
HTTP/1.1 500 Internal Server Error
Content-Length : 28
Content-Type : application/json; charset=utf-8
Date : Tue, 26 Apr 2016 00:42:10 GMT
{
"error": "Can't decode url"
}
Retrieve an URL using the specified short URL.
GET http://localhost:8080/api/v1/urls/8WAAfWwiID
HTTP/1.1 200 OK
Content-Length : 103
Content-Type : application/json; charset=utf-8
Date : Tue, 26 Apr 2016 00:46:04 GMT
{
"key": "8WAAfWwiID",
"url": "http://www.google.com",
"creation_date": "2016-04-25T23:45:49.94186238+02:00"
}
creates a new short URL.
POST http://localhost:8080/api/v1/urls
{
"url": "http://www.google.com"
}
HTTP/1.1 200 OK
Content-Type : application/json; charset=utf-8
Date : Tue, 26 Apr 2016 00:02:49 GMT
Content-Length : 103
{
"key": "8WAAfWwiID",
"url": "http://www.google.com",
"creation_date": "2016-04-26T00:02:49.94186238+02:00"
}
Get analytics for an URL
GET http://localhost:8080/api/v1/stats/8WAAfWwiID
HTTP/1.1 200 OK
Content-Type : application/json; charset=utf-8
Date : Tue, 26 Apr 2016 11:56:18 GMT
Content-Length : 72
{
"longUrlClicks": "1",
"shortUrlClicks": "2",
"user_agents": {
"bat/0.1.0": 2
}
}