1# @ohos.enterprise.deviceInfo (Device Information Management)
2
3The **deviceInfo** module provides APIs for enterprise device information management, including the API for obtaining device serial numbers.
4
5> **NOTE**
6>
7> The initial APIs of this module are supported since API version 12. Newly added APIs will be marked with a superscript to indicate their earliest API version.
8>
9> The APIs of this module can be used only in the stage model.
10>
11> The APIs of this module can be called only by a [device administrator application](../../mdm/mdm-kit-guide.md#introduction) that is enabled.
12
13## Modules to Import
14
15```ts
16import { deviceInfo } from '@kit.MDMKit';
17```
18
19## deviceInfo.getDeviceInfo
20
21getDeviceInfo(admin: Want, label: string): string
22
23Obtains device information.
24
25**Required permissions**: ohos.permission.ENTERPRISE_GET_DEVICE_INFO
26
27**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
28
29**Parameters**
30
31| Name| Type                                                   | Mandatory| Description                                                        |
32| ------ | ------------------------------------------------------- | ---- | ------------------------------------------------------------ |
33| admin  | [Want](../apis-ability-kit/js-apis-app-ability-want.md) | Yes  | Device administrator application.                                              |
34| label  | string                                                  | Yes  | Device information to obtain.<br>- **deviceName**: device name.<br>- **deviceSerial**: device serial number.<br>- **simInfo**: SIM card information.<!--RP1--><!--RP1End-->|
35
36**Return value**
37
38| Type  | Description                                                        |
39| ------ | ------------------------------------------------------------ |
40| string | Device information obtained.<br>If **label** is **simInfo**, the return value is the SIM card information in a JSON string.<br/>Example:<br/>[{"slotId": 0, "MEID": "", "IMSI": "", "ICCID": "", "IMEI": ""}, {"slotId": 1, "MEID": "", "IMSI": "", "ICCID": "", "IMEI": ""}] <br>In this example, **slotId:0** indicates slot 1, and **slotId:1** indicates slot 2. |
41
42**Error codes**
43
44For details about the error codes, see [Enterprise Device Management Error Codes](errorcode-enterpriseDeviceManager.md) and [Universal Error Codes](../errorcode-universal.md).
45
46| ID| Error Message                                                    |
47| -------- | ------------------------------------------------------------ |
48| 9200001  | The application is not an administrator application of the device. |
49| 9200002  | The administrator application does not have permission to manage the device. |
50| 201      | Permission verification failed. The application does not have the permission required to call the API. |
51| 401      | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
52
53**Example**
54
55```ts
56import { Want } from '@kit.AbilityKit';
57let wantTemp: Want = {
58  bundleName: 'com.example.myapplication',
59  abilityName: 'EntryAbility',
60};
61
62try {
63  let result: string = deviceInfo.getDeviceInfo(wantTemp, 'deviceName');
64  console.info(`Succeeded in getting device name, result : ${result}`);
65} catch (err) {
66  console.error(`Failed to get device name. Code: ${err.code}, message: ${err.message}`);
67}
68```
69