Service API reference
Overview
Favicon Grabber API is simple and has the one endpoint. The API doesn't require authentication but has 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 GET request to API endpoint /api/grab/:domain, where :domain is a required parameter that should be equal the valid domain name syntax.
For instance, to grab favicons from GitHub's index page 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 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 (for a full description, see W3C page):HEIGHTxWIDTHin pixels.
Optional API parameters
There are two optional parameters for the API:
pretty=truefor formatting JSON response;callback=donefor JSONP-response, wheredoneis a variant of name 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 \"example.test\""
}