User Agent Parser API
Description
Parse any user agent
string to find out more about its origin. The parser can also identify bot networks if the input contains enough information.
Endpoint
> GET https://api.jsonrepo.com/v1/compute/parser/useragent
Headers
Field | Description |
---|---|
api_key | Required Your API Key |
Parameters
Field | Type | Description |
---|---|---|
ua | String | Required The User Agent string to parse Example: Mozilla/5.0 (iPhone; CPU iPhone OS 8_4_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12H321 Safari/600.1.4 |
Response
A successful request will result in a populated payload
field with the expected output.
Unrecognized Fields:
If the
ua
provided is lacking or contains no information at all, we will obviously not be able to detect its nature or origin. Therefore, the endpoint will simply return emptystring
fields.See the examples section for more information.
A failed request will result in an error output as detailed in Error Rules. If the endpoint validation fails due to missing, badly formatted or invalid parameters, the endpoint will return HTTP code 400
along with a message
detailing the error.
Request
- Curl
// Parse `ua`
curl -G \
https://api.jsonrepo.com/v1/compute/parser/useragent \
-H "api_key: {YOUR_API_KEY_HERE}" \
--data-urlencode "ua=Mozilla/5.0 (iPhone; CPU iPhone OS 8_4_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12H321 Safari/600.1.4"
Success Response
{
"http_code": 200,
"http_message": "Ok",
"message": "Successful execution",
"payload": {
"agent": {
"is_bot": false,
"device": {
"name": "iPhone",
"type": "mobile",
"vendor": "Apple",
"model": "12H321"
},
"os": {
"type": "Linux",
"platform": "iOS",
"version": "8.4.1"
},
"browser": {
"name": "Safari",
"version": "8.0"
},
"engine": {
"name": "WebKit",
"version": "600.1.4"
},
"app": {
"name": "",
"version": "",
"url": ""
}
}
}
}
Error Response Example
// Request with empty `ua` parameter
{
"http_code": 400,
"http_message": "Bad Request",
"message": "Malformed request: `ua` parameter must be provided.",
"payload": []
}