Device Detection API - Accurately Identify User Devices
"Get the information about browser, operating system, device brand name, model name and other related details."
The Device Detection API is a software interface that allows web applications to detect and identify the characteristics of the device being used to access the application. This API can provide information about the device's operating system, browser, screen resolution, and other relevant parameters.
The Device Detection API is typically used by web developers to optimize the user experience based on the specific capabilities of the device. For example, a website might use the API to adjust the layout and content of its pages for small screens, or to detect whether a mobile device is being used to access the site and serve a mobile-optimized version of the site.
The Device Detection API works by analyzing the user agent string sent by the device's web browser when it connects to a website. This string contains information about the device, such as its manufacturer, model, operating system, and browser. The API uses this information to identify the device and provide the appropriate content.
Your API Authentication Key
We use API keys to authenticate all the requests. You can view and manage your API keys in the My Account -> My APIs Center page. Your API keys can be used to access our all the APIs, So be sure to keep them secure. Do not share your secret API keys in publicly accessible areas such as GitHub, client-side code, and so forth.
XXXX-XXXX-XXXX-XXXX (login to see your free API Key)
API Base URL and Endpoints
The API Base URL serves as the foundation or root of the API's endpoints. It represents the common prefix shared by all API endpoints. An Endpoint URL represents a specific operation or resource provided by the API. It is appended to the API Base URL to form a complete URL for a particular API call.
Base URL:
https://zerosack.org/marketplace/apis/v1
Endpoint to Get Device Info
GET /device_info
API Request Method GET
This API use GET HTTP method to get data from our server. All API requests must be made over HTTPS ("S" stands for secure). Calls made over plain HTTP or without authentication key will not allowed.
Request Parameters
An API endpoint is a URL (Uniform Resource Locator) that is used to access a specific resource on a web server. API endpoints are the URLs that clients use to interact with a web API, and they typically consist of a base URL followed by a path that identifies a specific resource or action.
For device info data
Parameter | Description |
---|---|
key required |
This is your authentication api key to get requested data from our servers. This is mandatory parameter otherwise data request will be failed. Go to API Key. |
user_agent optional |
You can optically provide device user agent info to this api to get accurate device information.
Eg: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3 . Please note: Please use urlencode method to encode this string and pass into the url to using |
Example Request URL
https://zerosack.org/marketplace/apis/v1/device_info?key=XXXX-XXXX-XXXX-XXXX (login to see your free API Key)
Response Format
API response format refers to the format in which data is returned from an API endpoint after a request is made. We use JSON format for API response data. JSON (JavaScript Object Notation): JSON is a lightweight data interchange format that is easy to read and write. It is widely used for API response data because it is easy to parse and manipulate in many programming languages.
Example Response
Device detection response data in JSON format
{
"status": 1,
"status_message": "success",
"body": {
"isBot": false,
"botInfo": null,
"clientInfo": {
"type": "browser",
"name": "Chrome",
"short_name": "CH",
"version": "110.0.0.0",
"engine": "Blink",
"engine_version": "110.0.0.0",
"family": "Chrome"
},
"osInfo": {
"name": "Windows",
"short_name": "WIN",
"version": "10",
"platform": "x64",
"family": "Windows"
},
"device": "desktop",
"brand": "",
"model": "",
"isBrowser": true,
"isSmartphone": false,
"isFeaturePhone": false,
"isTablet": false,
"isPhablet": false,
"isConsole": false,
"isPortableMediaPlayer": false,
"isCarBrowser": false,
"isTV": false,
"isSmartDisplay": false,
"isSmartSpeaker": false,
"isCamera": false,
"isWearable": false,
"isPeripheral": false,
"isFeedReader": false,
"isMobileApp": false,
"isPIM": false,
"isLibrary": false,
"isMediaPlayer": false
}
}
In this response "status": 1
means data request response received successfully. In this case your APIs credit call/request count as 1,
Otherwise in fail condition or any other condition you will receive "status": 0
,
In this case API credit calls/request count as 0.
Sample Code
You can use our api with any programming language as well which can handle http GET requests. Here are some sample code snippets for making a GET request to an API endpoint in multiple programming languages:
fetch('YOUR API REQUEST URL WITH REQUIRED PARAMETERS')
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error(error));
$response = file_get_contents("YOUR API REQUEST URL WITH REQUIRED PARAMETERS");
if ($response !== false) {
$data = json_decode($response, true);
var_dump($data);
} else {
echo "Error: Request failed";
}
import requests
url = 'YOUR API REQUEST URL WITH REQUIRED PARAMETERS'
response = requests.get(url)
if response.status_code == requests.codes.ok:
data = response.json()
print(data)
else:
print('Error: Request failed with status code ' + str(response.status_code))
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "YOUR API REQUEST URL WITH REQUIRED PARAMETERS");
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
Also you can use Postman platform which enables you to create mock servers to assist with API development and testing. A mock server simulates the behavior of a real API server by accepting requests and returning responses. By adding a mock server to your collection and adding examples to your requests, you can simulate the behavior of a real API.
Do you Need Help? Contact us.
Disclaimers: This APIs is provided "as is" without warranty of any kind. If you have issue / feedback / bug report regarding the same, You can reach out to us.