1# @ohos.bundle.appDomainVerify (Application Domain Name Verification) (System API)
2
3The appDomainVerify module provides APIs to query the mappings between applications and domain names for the purposes of application domain name verification.
4
5> **NOTE**
6>
7> The initial APIs of this module are supported since API version 13. Newly added APIs will be marked with a superscript to indicate their earliest API version.
8
9## Modules to Import
10
11```ts
12import { appDomainVerify } from '@kit.AbilityKit';
13```
14
15## Required Permissions
16
17| Permission                                   | APL   | Description            |
18| --------------------------------------- | ----------- | ---------------- |
19| ohos.permission.GET_APP_DOMAIN_BUNDLE_INFO | system_basic | Allows an application to access the mappings between applications and domain names.|
20
21For details about the APL, see [Basic Concepts in the Permission Mechanism](../../security/AccessToken/app-permission-mgmt-overview.md#basic-concepts-in-the-permission-mechanism).
22
23## appDomainVerify.queryAssociatedDomains
24
25queryAssociatedDomains(bundleName: string): string[]
26
27Queries the list of domain names associated with an application based on its bundle name.
28
29**Required permissions**: ohos.permission.GET_APP_DOMAIN_BUNDLE_INFO
30
31**System capability**: SystemCapability.BundleManager.AppDomainVerify
32
33**System API**: This is a system API.
34
35**Parameters**
36
37| Name        | Type    | Mandatory  | Description                                     |
38| ----------- | ------ | ---- | --------------------------------------- |
39| bundleName  | string | Yes   | Bundle name of the application.      |
40
41**Returns**
42
43| Type                       | Description                |
44| ------------------------- | ------------------ |
45| string[] | List of domain names associated with the bundle name. If no domain name is associated, an empty array is returned.|
46
47**Error codes**
48
49For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Application Domain Name Verification Error Codes](errorcode-appDomainVerify.md.md).
50
51| ID| Error Message                                 |
52| -------- | ----------------------------------------- |
53| 201 | Permission denied. |
54| 202 | Permission denied, non-system app called system api. |
55| 401 | Parameter error.|
56| 29900001 | System internal error. |
57
58**Example**
59
60```ts
61import { appDomainVerify } from '@kit.AbilityKit';
62
63// Obtain the list of domain names associated with the bundle name "com.example.app1".
64let bundleName = "com.example.app1";
65let domains = appDomainVerify.queryAssociatedDomains(bundleName);
66domains.forEach(domain => {
67  console.log(`app:${bundleName} associate with domain:${domain}`);
68});
69```
70
71## appDomainVerify.queryAssociatedBundleNames
72
73queryAssociatedBundleNames(domain: string): string[]
74
75Obtains the list of bundle names associated with a domain name.
76
77**Required permissions**: ohos.permission.GET_APP_DOMAIN_BUNDLE_INFO
78
79**System capability**: SystemCapability.BundleManager.AppDomainVerify
80
81**System API**: This is a system API.
82
83**Parameters**
84
85| Name        | Type    | Mandatory  | Description                                     |
86| ----------- | ------ | ---- | --------------------------------------- |
87| domain  | string | Yes   | Domain name.      |
88
89**Returns**
90
91| Type                       | Description                |
92| ------------------------- | ------------------ |
93| string[] | List of bundle names associated with the domain name. If no application is associated, an empty array is returned.|
94
95**Error codes**
96
97For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Application Domain Name Verification Error Codes](errorcode-appDomainVerify.md.md).
98
99| ID| Error Message                                 |
100| -------- | ----------------------------------------- |
101| 201 | Permission denied. |
102| 202 | Permission denied, non-system app called system api. |
103| 401 | Parameter error.|
104| 29900001 | System internal error. |
105
106**Example**
107
108```ts
109import { appDomainVerify } from '@kit.AbilityKit';
110
111// Obtain the list of bundle names associated with the domain name "example.com".
112let domain = "example.com";
113let bundleNames = appDomainVerify.queryAssociatedBundleNames(domain);
114bundleNames.forEach(bundleName => {
115  console.log(`domain:${domain} associate with app:${bundleName}`);
116});
117```
118