Service API reference
Overview
Favicon Grabber API is simple and has the one endpoint. The API does not require authentication but has the following restrictions: 100 requests per minute from one IP address and each API request should specify a valid User-Agent header.
The root endpoint for the API is http://favicongrabber.com/api and all responses are returned as JSON(P) over HTTP.
The API supports requests and responses using Cross-Origin Resource Sharing so you can send XHR requests from browsers using a client-side web application served from any domain.
Grab favicons
In order to grab favicons for a website send a GET request to the API endpoint /api/grab/:domain, where :domain is a required parameter that should be equal to the valid domain name syntax.
For instance, to grab favicons from github.com domain open http://favicongrabber.com/api/grab/github.com in your favorite browser and you must see next JSON response:
{
"domain": "github.com",
"icons": [
{
"src": "https://assets-cdn.github.com/favicon.ico",
"type": "image/x-icon"
},
{
"src": "https://assets-cdn.github.com/pinned-octocat.svg"
},
{
"src": "https://github.com/fluidicon.png"
}
]
}
Property domain contains the value of :domain parameter. The property icons contains an array of icon objects and may be empty. Any icon object can have three properties, the values of which are strings.
Description properties of icon object:
- property
srccontains an absolute URL for a favicon image and is required and unique; - property
typeequals an MIME-type's favicon image; - property
sizescontains size's favicon image and in a simple case has the following format:HEIGHTxWIDTHin pixels (for a full description, see HTML5 Links).
Optional parameters
There are two optional parameters for the API:
pretty=truefor formatting JSON response;callback=donefor JSONP response, wheredoneis a variant of the name of the JSONP function.
Error handling
The API uses HTTP response codes to indicate API errors. All error messages have the following format:
{
"error": "Unresolved domain name."
}