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