The BFH Stats API provides several endpoints to query the BFHStats.com database from different applications.
The API is not finished yet. There is more to come.
The API can be queried per HTTP GET or POST.
All parameters are supported as URL Query parameters or POST parameters.
If same parameter is given on both ways, POST is preferred.
If the request header Accept-Encoding contains gzip, it returns a compressed response.
POST data can be encoded as application/x-www-form-urlencoded or application/json
We support cross domain requests. The response headers
Access-Control-Allow-Origin, Access-Control-Allow-Headers and Access-Control-Allow-Methods
are configured to allow requests from anywhere. So the API can be queried via. AJAX.
Most endpoints take a plat parameter to specifiy the game platform.
The following platform codes are available:
XBOX 360 console platform
Playstation 3 console platform
XBOX ONE console platform.
Playstation 4 console platform.
The API returns image paths for several items. In bfhstats.com_images.zip
you find all those images. Most images are from Battlelog.
The following parameters can be used as URL query parameters or POST parameters.
Sets the output format. Default is json
Returns all data in JSON format which is usually supported in all programming and script languages.
callback parameter to be set as the function name to be called.
Usually just used for debugging and better human readability.
Returns one value per line in parameter format.
Returns currently in Battlefield 4 logged in players.
The HTTP Status code should always be checked. Only 200 means the request was successful and contains a valid response.
If you provided one of the request headers If-Modified-Since or If-None-Match you could get a
304 back which means also success but nothing changed.
All errors are returned with a HTTP Status code above 400 or above 500.
If you receive such a status code, always check for the Content-Type header, because in some cases
you won't get the desired output format.
The value on your given output parameter is not known.
The URL you called contains an endpoint name which is not supported.
The given plat parameter contains an unknown platform.
An undefined error. The message field should contain further information. This could appear on database failures.
Player data output options
With the playerInfo endpoint you can supply the opt parameter. If the opt
parameter is supplied, it must have a comma separated list of option identifiers. Otherwise it is assumed that
no options are set. If the opt parameter is not set, it is assumed that all options are set.