Header - X-Device-Info
- Topics:
- Authentication
Overview
The X-Device-Info request header contains the client information (device, connection and application) related to the actual streaming device and is used to determine platform-specific rules that MVPDs may enforce.
Syntax
X-Device-Info: <device_information> | |
Header Type | Request header |
Standard | No |
Directives
<device_information>
The Base64-encoded
value of the JSON element containing at least the attributes marked as required by the following table.
Presence | Key | Description | Restricted | Possible Values |
---|---|---|---|---|
primaryHardwareType | The device’s primary hardware type. | ✓ |
The values are restricted:
| |
required | model | The device’s model name. | e.g. iPhone, SM-G930V, AppleTV, etc. | |
required | version | The device’s version. | e.g. 2.0.1, etc. | |
manufacturer | The device’s manufacturing company/organization. | e.g. Samsung, LG, ZTE, Huawei, Motorola, Apple, etc. | ||
vendor | The device’s selling company/organisation. | e.g. Apple, Samsung, LG, Google, etc. | ||
required | osName | The device’s Operating System (OS) name. | ✓ |
The values are restricted:
|
osFamily | The device’s Operating System (OS) group name. | ✓ |
The values are restricted:
| |
osVendor | The device’s Operating System (OS) supplier. | ✓ |
The values are restricted:
| |
required | osVersion | The device’s Operating System (OS) version. | e.g. 10.2, 9.0.1, etc. | |
browserName | The browser’s name. | ✓ |
The values are restricted:
| |
browserVendor | The browser’s building company/organisation. | ✓ |
The values are restricted:
| |
browserVersion | The device’s browser version. | e.g. 60.0.3112 | ||
userAgent | The device’s user agent. | e.g. Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/602.4.8 (KHTML, like Gecko) Version/10.0.3 Safari/602.4.8 | ||
displayWidth | The device’s physical screen width. | |||
displayHeight | The device’s physical screen height. | |||
displayPpi | The device’s physical screen pixel density. | e.g. 294 | ||
diagonalScreenSize | The device’s physical screen diagonal dimension in inches. | e.g. 5.5, 10.1 | ||
connectionIp | The device’s IP used for sending HTTP requests. | e.g. 8.8.4.4 | ||
connectionPort | The device’s port used for sending HTTP requests. | e.g. 53124 | ||
required | connectionType | The network connection type. | e.g. WiFi, LAN, 3G, 4G, 5G | |
connectionSecure | The network connection security status. | ✓ |
The values are restricted:
| |
applicationId | The application’s unique identifier. | e.g. REF30 |
Examples
// Device information
// {
// "primaryHardwareType" : "MobilePhone",
// "model":"SM-S901U",
// "vendor":"samsung",
// "version":"r0q",
// "manufacturer":"samsung",
// "osName":"Android",
// "osVersion":"14"
// }
// BASE64-encoded
// ewogICJwcmltYXJ5SGFyZHdhcmVUeXBlIiA6ICJNb2JpbGVQaG9uZSIsCiAgIm1vZGVsIjoiU00tUzkwMVUiLAogICJ2ZW5kb3I
// iOiJzYW1zdW5nIiwKICAidmVyc2lvbiI6InIwcSIsCiAgIm1hbnVmYWN0dXJlciI6InNhbXN1bmciLAogICJvc05hbWUiOiJBbmRyb
// 2lkIiwKICAib3NWZXJzaW9uIjoiMTQiCn0=
X-Device-Info: ewogICJwcmltYXJ5SGFyZHdhcmVUeXBlIiA6ICJNb2JpbGVQaG9uZSIsCiAgIm1vZGVsIjoiU00tUzkwMVUiLAogICJ2ZW5kb3IiOiJzYW1zdW5nIiwKICAidmVyc2lvbiI6InIwcSIsCiAgIm1hbnVmYWN0dXJlciI6InNhbXN1bmciLAogICJvc05hbWUiOiJBbmRyb2lkIiwKICAib3NWZXJzaW9uIjoiMTQiCn0=
Cookbooks
X-Device-Info
header must contain a value formatted as described in the Directives section.Browsers
For client applications running in a browser, the X-Device-Info
header can be omitted as the browser will automatically send a minimal set of required information in the User-Agent
header.
You can still use the X-Device-Info
header to provide additional information about the device, connection, and application, in case your client application integrates a library or service that provides a device identification mechanism.
Mobile Devices
iOS & iPadOS
To build the X-Device-Info
header for devices running iOS or iPadOS, you may refer to the following documents and below code snippet:
- Apple developer documentation for UIDevice.
- Apple developer documentation for Reachability.
- Linux manual documentation for uname.
+ (NSString *)computeClientInformation {
struct utsname u;
uname(&u);
NSString *hardware = [NSString stringWithCString:u.machine encoding:NSUTF8StringEncoding];
UIDevice *device = [UIDevice currentDevice];
NSString *deviceType;
switch (UI_USER_INTERFACE_IDIOM()) {
case UIUserInterfaceIdiomPhone:
deviceType = @"MobilePhone";
break;
case UIUserInterfaceIdiomPad:
deviceType = @"Tablet";
break;
case UIUserInterfaceIdiomTV:
deviceType = @"TV";
break;
default:
deviceType = @"Unknown";
}
CGRect screenRect = [[UIScreen mainScreen] bounds];
NSNumber *screenWidth = @((float) screenRect.size.width);
NSNumber *screenHeight = @((float) screenRect.size.height);
Reachability *reachability = [Reachability reachabilityForInternetConnection];
[reachability startNotifier];
NetworkStatus status = [reachability currentReachabilityStatus];
NSString *connectionType;
if (status == NotReachable) {
connectionType = @"notConnected";
} else if (status == ReachableViaWiFi) {
connectionType = @"WiFi";
} else if (status == ReachableViaWWAN) {
connectionType = @"cellular";
}
NSMutableDictionary *clientInformation = [@{
@"type": deviceType,
@"model": device.model,
@"vendor": @"Apple",
@"manufacturer": @"Apple",
@"version": [hardware stringByReplacingOccurrencesOfString:device.model withString:@""],
@"osName": device.systemName,
@"osVersion": device.systemVersion,
@"displayWidth": screenWidth,
@"displayHeight": screenHeight,
@"connectionType": connectionType,
@"applicationId": @"REF30"
} mutableCopy];
NSError *error;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:clientInformation options:NSJSONWritingPrettyPrinted error:&error];
NSString *base64Encoded = [jsonData base64EncodedStringWithOptions:0];
return base64Encoded;
}
The device information can be constructed the following way:
The connection information can be constructed the following way:
The application information can be constructed the following way:
Android
To build the X-Device-Info
header for devices running Android, you may refer to the following documents and below code snippet:
- Android developer documentation for Build class.
private JSONObject computeClientInformation() {
String LOGGING_TAG = "DefineClass.class";
JSONObject clientInformation = new JSONObject();
String connectionType;
try {
ConnectivityManager cm = (ConnectivityManager) getContext().getSystemService(CONNECTIVITY_SERVICE);
NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
if (activeNetwork != null && activeNetwork.isConnectedOrConnecting()) {
switch (activeNetwork.getType()) {
case ConnectivityManager.TYPE_WIFI: {
connectionType = "WIFI";
break;
}
case ConnectivityManager.TYPE_BLUETOOTH: {
connectionType = "BLUETOOTH";
break;
}
case ConnectivityManager.TYPE_MOBILE: {
connectionType = "MOBILE";
break;
}
case ConnectivityManager.TYPE_ETHERNET: {
connectionType = "ETHERNET";
break;
}
case ConnectivityManager.TYPE_VPN: {
connectionType = "VPN";
break;
}
case ConnectivityManager.TYPE_DUMMY: {
connectionType = "DUMMY";
break;
}
case ConnectivityManager.TYPE_MOBILE_DUN: {
connectionType = "MOBILE_DUN";
break;
}
case ConnectivityManager.TYPE_WIMAX: {
connectionType = "WIMAX";
break;
}
default:
connectionType = ConnectivityManager.EXTRA_OTHER_NETWORK_INFO;
}
} else {
connectionType = ConnectivityManager.EXTRA_NO_CONNECTIVITY;
}
} catch (Exception e) {
connectionType = "notAccessible";
}
try {
clientInformation.put("model", Build.MODEL);
clientInformation.put("vendor", Build.BRAND);
clientInformation.put("manufacturer", Build.MANUFACTURER);
clientInformation.put("version", Build.DEVICE);
clientInformation.put("osName", "Android");
clientInformation.put("osVersion", Build.VERSION.RELEASE);
clientInformation.put("connectionType", connectionType);
clientInformation.put("applicationId", "REF30");
} catch (JSONException e) {
Log.e(LOGGING_TAG, e.getMessage());
}
return Base64.encodeToString(clientInformation.toString().getBytes(), Base64.NO_WRAP);
}
The device information can be constructed the following way:
The connection information can be constructed the following way:
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
getSystemService(Context.CONNECTIVITY_SERVICE).getActiveNetworkInfo().getType()
"WIFI","BLUETOOTH","MOBILE","ETHERNET","VPN","DUMMY","MOBILE_DUN","WIMAX","notAccessible"
The application information can be constructed the following way:
TV Connected Devices
tvOS
To build the X-Device-Info
header for devices running tvOS, you may refer to the following documents and below code snippet:
- Apple developer documentation for UIDevice.
- Apple developer documentation for Reachability.
- Linux manual documentation for uname.
+ (NSString *)computeClientInformation {
struct utsname u;
uname(&u);
NSString *hardware = [NSString stringWithCString:u.machine encoding:NSUTF8StringEncoding];
UIDevice *device = [UIDevice currentDevice];
NSString *deviceType;
switch (UI_USER_INTERFACE_IDIOM()) {
case UIUserInterfaceIdiomPhone:
deviceType = @"MobilePhone";
break;
case UIUserInterfaceIdiomPad:
deviceType = @"Tablet";
break;
case UIUserInterfaceIdiomTV:
deviceType = @"TV";
break;
default:
deviceType = @"Unknown";
}
CGRect screenRect = [[UIScreen mainScreen] bounds];
NSNumber *screenWidth = @((float) screenRect.size.width);
NSNumber *screenHeight = @((float) screenRect.size.height);
Reachability *reachability = [Reachability reachabilityForInternetConnection];
[reachability startNotifier];
NetworkStatus status = [reachability currentReachabilityStatus];
NSString *connectionType;
if (status == NotReachable) {
connectionType = @"notConnected";
} else if (status == ReachableViaWiFi) {
connectionType = @"WiFi";
} else if (status == ReachableViaWWAN) {
connectionType = @"cellular";
}
NSMutableDictionary *clientInformation = [@{
@"type": deviceType,
@"model": device.model,
@"vendor": @"Apple",
@"manufacturer": @"Apple",
@"version": [hardware stringByReplacingOccurrencesOfString:device.model withString:@""],
@"osName": device.systemName,
@"osVersion": device.systemVersion,
@"displayWidth": screenWidth,
@"displayHeight": screenHeight,
@"connectionType": connectionType,
@"applicationId": @"REF30"
} mutableCopy];
NSError *error;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:clientInformation options:NSJSONWritingPrettyPrinted error:&error];
NSString *base64Encoded = [jsonData base64EncodedStringWithOptions:0];
return base64Encoded;
}
The device information can be constructed the following way:
The connection information can be constructed the following way:
The application information can be constructed the following way:
Fire OS
To build the X-Device-Info
header for devices running Fire OS, you may refer to the following documents:
- Android developer documentation for Build class.
- Amazon developer documentation for Identifying Fire TV Devices.
The device information can be constructed the following way:
The connection information can be constructed the following way:
The application information can be constructed the following way:
Roku OS
To build the X-Device-Info
header for devices running Roku OS, you may refer to the following documents:
- Roku developer documentation for ifDeviceInfo.
The device information can be constructed the following way:
The connection information can be constructed the following way:
The application information can be constructed the following way:
Others
For device platforms not covered in the documentation, the client information (device, connection and application) should be linked to any available hardware and operating system (OS) attributes, typically specified in the device’s hardware and OS manuals.