Device API service

Device API service / documentation for device detection - documentation

 

Basic information

This service detects devices and restores data on them. Works according to "User Agent".
* The service is in BETA version and errors are possible especially with the data for devices that are not on Android OS.

 

Token and service authentication

You need to be logged in user before you can use the service.

We simplified the login / registration in the easiest way possible. Only you need to sign in with your Google / Gmail account to continue. After logging into the token field (below) you will be able to use your personal token on PHP.mk services.

Personal Token

Login to show token!

 

Using the Service v1.0

Version ({version}): v1.0

Browser User Agent ({userAgent}): ?userAgent= e.g. "Mozilla/5.0 (Linux; Android 5.1.1; SM-J320FN) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Mobile Safari/537.36"

service end-point

HTTP/GET

https://api.php.mk/device/{version}?token={token}&userAgent={userAgent}

Example HTTP/GET request

https://api.php.mk/device/v1.0?token=&userAgent=Mozilla%2F5.0%20%28Linux%3B%20Android%205.1.1%3B%20SM-J320FN%29%20AppleWebKit%2F537.36%20%28KHTML%2C%20like%20Gecko%29%20Chrome%2F84.0.4147.125%20Mobile%20Safari%2F537.36

Example PHP

$url='https://api.php.mk/device/v1.0?token=&userAgent='.urlencode($_SERVER['HTTP_USER_AGENT']);
$jsonResponse=file_get_contents($url);
$response= json_decode($jsonResponse,true);
            
echo '<pre>';
print_r($response['data']);
exit();

Example cUrl

curl -X GET  'https://api.php.mk/device/v1.0?token=&userAgent=Mozilla%2F5.0%20%28Linux%3B%20Android%205.1.1%3B%20SM-J320FN%29%20AppleWebKit%2F537.36%20%28KHTML%2C%20like%20Gecko%29%20Chrome%2F84.0.4147.125%20Mobile%20Safari%2F537.36';

Example Javascript

var xhr = new XMLHttpRequest();
xhr.addEventListener("readystatechange", function () {
  if (this.readyState === 4) {
    var response_data=JSON.parse(this.responseText).data;
    console.log(response_data);
  }
});
xhr.open("GET", "https://api.php.mk/device/v1.0?token=&userAgent="+escape(navigator.userAgent));
xhr.send();

Example jQuery / JavaScript

$.getJSON('https://api.php.mk/device/v1.0?token=&userAgent='+escape(navigator.userAgent),function(r){

    console.log(r.data);

}).error(function(error){

    console.log(error.responseJSON.msg);

});

 

Service response

The answer is always in JSON format

The answer from the service is the data for the requested device in JSON format.

Example response

{
    "error": false,
    "status_text": "OK",
    "status_code": 200,
    "data": {
        "user_agent_id": "10e666b54535190485e740ac8f338b67",
        "user_agent": "Mozilla\/5.0 (Linux; Android 4.2.2; GT-P3113 Build\/JDQ39) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/42.0.2311.111 Safari\/537.36",
        "platform": "Android",
        "platform_details": "Linux; Android 4.2.2; GT-P3113 Build\/JDQ39",
        "browser": "Chrome",
        "browser_version": "42.0.2311.111",
        "mobile": "Android",
        "robot": "",
        "languages": "",
        "device_name": "Samsung Galaxy Tab 2 7.0 P3110",
        "device_image": "data:image\/jpeg;base64,\/9j\/4QAYRXhpZgAASUkqAAgAA...",
        "device_released": "Released 2012, May",
        "device_body": "344g, 10.5mm thickness",
        "device_os": "Android 4.0.3, up to 4.2.2, TouchWiz UX UI",
        "device_storage": "8GB\/16GB\/32GB storage, microSDXC",
        "device_display_size": "7.0\"",
        "device_camera_pixels": "3 Mega Pixels",
        "device_ram_memory": "1 GB",
        "device_battery": "4000 mAh",
        "device_comment": "Tablet with no support for GSM voice communication, SMS, and MMS  Also known as Samsung Galaxy Tab 2 (7.0)",
        "device_details_network": [
            {
                "property": "Technology",
                "value": "No cellular connectivity"
            },
            {
                "property": "2G bands",
                "value": "N\/A"
            },
            {
                "property": "GPRS",
                "value": "No"
            },
            {
                "property": "EDGE",
                "value": "No"
            }
        ],
        "device_details_launch": [
            {
                "property": "Announced",
                "value": "2012, February. Released 2012, May"
            },
            {
                "property": "Status",
                "value": "Discontinued"
            }
        ],
        "device_details_body": [
            {
                "property": "Dimensions",
                "value": "193.7 x 122.4 x 10.5 mm (7.63 x 4.82 x 0.41 in)"
            },
            {
                "property": "Weight",
                "value": "344 g (12.13 oz)"
            },
            {
                "property": "SIM",
                "value": "No"
            }
        ],
        "device_details_display": [
            {
                "property": "Type",
                "value": "PLS LCD capacitive touchscreen, 16M colors"
            },
            {
                "property": "Size",
                "value": "(~58.2% screen-to-body ratio)"
            },
            {
                "property": "Resolution",
                "value": "600 x 1024 pixels, 16:9 ratio (~170 ppi density)"
            }
        ],
        "device_details_platform": [
            {
                "property": "OS",
                "value": "Android 4.0.3 (Ice Cream Sandwich), upgradable to 4.2.2 (Jelly Bean), TouchWiz UX UI"
            },
            {
                "property": "Chipset",
                "value": "TI OMAP 4430"
            },
            {
                "property": "CPU",
                "value": "Dual-core 1.0 GHz"
            },
            {
                "property": "GPU",
                "value": "PowerVR SGX540"
            }
        ],
        "device_details_memory": [
            {
                "property": "Card slot",
                "value": "microSDXC (dedicated slot)"
            },
            {
                "property": "Internal",
                "value": "8GB 1GB RAM, 16GB 1GB RAM, 32GB 1GB RAM"
            }
        ],
        "device_details_main_camera": [
            {
                "property": "Single",
                "value": "3.15 MP"
            },
            {
                "property": "Video",
                "value": "[email protected]"
            }
        ],
        "device_details_selfie_camera": [
            {
                "property": "Single",
                "value": "VGA"
            }
        ],
        "device_details_sound": [
            {
                "property": "Loudspeaker",
                "value": "Yes, with stereo speakers"
            },
            {
                "property": "3.5mm jack",
                "value": "Yes"
            }
        ],
        "device_details_comms": [
            {
                "property": "WLAN",
                "value": "Wi-Fi 802.11 b\/g\/n, Wi-Fi Direct"
            },
            {
                "property": "Bluetooth",
                "value": "3.0, A2DP"
            },
            {
                "property": "GPS",
                "value": "Yes; GLONASS"
            },
            {
                "property": "Radio",
                "value": "No"
            },
            {
                "property": "USB",
                "value": "2.0, USB On-The-Go"
            }
        ],
        "device_details_features": [
            {
                "property": "Sensors",
                "value": "Accelerometer, gyro, compass"
            }
        ],
        "device_details_battery": [
            {
                "property": "Type",
                "value": "Non-removable Li-Ion 4000 mAh battery"
            },
            {
                "property": "Stand-by",
                "value": "Up to 1070 h"
            },
            {
                "property": "Talk time",
                "value": "93 h (media player)"
            }
        ],
        "device_details_misc": [
            {
                "property": "Colors",
                "value": "Black, White, Red"
            },
            {
                "property": "SAR EU",
                "value": "0.63 W\/kg (head)"
            },
            {
                "property": "Price",
                "value": "About 150 EUR"
            }
        ]
    }
}