DeviceAtlas Data File
The DeviceAtlas Enterprise APIs rely on a device data file to function, it is therefore recommended to update the data file on a regular basis to ensure that the most up-to-date device data is used.
The data file contains a highly optimized JSON structure that offers very fast lookups with minimal footprint. It can either be downloaded manually or fetched with an automated script.
Data file types
The data file comes in three forms:
- Community - contains all of the base data.
- Personal - contains the base data with any of your opinions over-riding the base properties. Opinions can be added on the device pages at http://deviceatlas.com/devices .
- Private - contains the base data, personal data and any private data that you have added to your account. Private data is an option with the Enterprise Licence and allows you to specify your own User-Agents and properties.
All data files have a corresponding MD5 hash file to verify the main data files integrity.
Manual Updates
The data file can be downloaded from your account page or from the simple JSON download page
Automatic Updates
It is strongly recommended to setup a regular automated data download. The data file can be downloaded from the simple download page by passing the correct parameters in the URL. Either HTTP or HTTPs can be used to fetch the JSON data.
URL: http://deviceatlas.com/getJSON.php
The following query parameters can be used:
Required
licencekey=YOUR_LICENCE_KEY (The licence key for your account)
format=[zip|gzip] (The compression format - "zip" or "gzip")
Optional
data=[my|community|priv] (The JSON type to download, defaults to personal "my")
md5=[1|0] (Set to "1" to download the MD5 file for the JSON)
date=yyyy-mm-dd (Specify to download a previously generated data file)
Examples:
Download the latest community data file in zip format:
http://deviceatlas.com/getJSON.php?licencekey=aabbccddeeff&format=zip&data=community
Download the MD5 file for the latest community JSON file:
http://deviceatlas.com/getJSON.php?licencekey=aabbccddeeff&format=zip&data=community&md5=1
Download a past JSON file:
http://deviceatlas.com/getJSON.php?licencekey=aabbccddeeff&format=zip&data=community&date=2011-08-09
Sample shell script
A sample shell script to download the latest JSON file and verify it with the MD5 file can be found here: Sample shell script
Download verification
Verification of a downloaded JSON file is very important to ensure the whole file was received and it is not corrupted. Setting the MD5 parameter to "1" will download a text file containing the MD5 hash of the main data file which can then be compared against the full data file.
Downloading past files
Past data files can be requested by setting the date parameter. If a personal data file is requested for a particular date it is required that you have already downloaded that file in the past. Community data files do not have this restriction.
Installing the data file
Once the data file is downloaded the DeviceAtlas API needs to be told to reload it. This is a simple process and can be done as follows and typically takes a fraction of a second. Device recognition is not affected during a data file reload.
Examples:
Java: HashMap tree = Api.getTreeFromFile("path/to/DeviceAtlas.json", true);
.NET: Hashtable tree = Api.GetTreeFromFile("path/to/DeviceAtlas.json", true);
PHP: $tree = Mobi_Mtld_DA_Api::getTreeFromFile("path/to/DeviceAtlas.json");