1# UIServiceHostProxy (System API)
2
3UIServiceHostProxy functions as a proxy to send data from the [UIServiceExtensionAbility](js-apis-app-ability-uiServiceExtensionAbility-sys.md) server to the client.
4
5
6> **NOTE**
7>
8>  - 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.
9>  - The APIs of this module can be used only in the stage model.
10>  - The APIs of this module must be used in the main thread, but not in sub-threads such as Worker and TaskPool.
11>  - The APIs provided by this module are system APIs.
12
13## Modules to Import
14
15```ts
16import { common } from '@kit.AbilityKit';
17```
18
19
20## UIServiceHostProxy.sendData
21
22sendData(data: Record\<string, Object>): void
23
24Sends data from the [UIServiceExtensionAbility](js-apis-app-ability-uiServiceExtensionAbility-sys.md) server to the client.
25
26
27**System capability**: SystemCapability.Ability.AbilityRuntime.Core
28
29**System API**: This is a system API.
30
31**Parameters**
32
33| Name| Type| Read Only| Optional| Description|
34| -------- | -------- | -------- | -------- | -------- |
35| data | Record\<string, Object> | Yes| No| Data to be sent to the [UIServiceExtensionAbility](js-apis-app-ability-uiServiceExtensionAbility-sys.md) client.|
36
37**Error codes**
38
39For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Ability Error Codes](errorcode-ability.md).
40
41| ID| Error Message|
42| ------- | -------------------------------- |
43| 202 | Not System App. Interface caller is not a system app .                                                       |
44| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
45| 16000050 | Internal error. |
46
47**Example**
48
49```ts
50import { common, UIServiceExtensionAbility } from '@kit.AbilityKit';
51
52const TAG: string = '[UiServiceExtensionAbility] ';
53
54export default class MyUiServiceExtensionAbility extends UIServiceExtensionAbility {
55
56  // Process data sending.
57  onData(proxy: common.UIServiceHostProxy, data: Record<string, Object>) {
58    console.log(TAG + `onData ${JSON.stringify(data)}`);
59    // Define the data to be sent.
60    let formData: Record<string, string> = {
61      'proxyData': 'proxyData'
62    };
63    try {
64      // Send data to the UIServiceExtensionAbility client.
65      proxy.sendData(formData);
66    } catch (err) {
67      console.log(TAG + `sendData failed ${JSON.stringify(err.message)}`);
68    }
69  }
70}
71```
72