1# Upload and Download Subsystem Changelog 2 3 4## cl.request.2 request API Change 5 6Deleted the beta APIs in API version 9: 7 81. function download(context: BaseContext, config: DownloadConfig, callback: AsyncCallback\<DownloadTask>): void; 92. function download(context: BaseContext, config: DownloadConfig): Promise\<DownloadTask>; 103. function upload(context: BaseContext, config: UploadConfig, callback: AsyncCallback\<UploadTask>): void; 114. function upload(context: BaseContext, config: UploadConfig): Promise\<UploadTask>; 12 13**Change Impact** 14 15The application developed based on an earlier version in the stage model needs to be adapted to the new APIs. Otherwise, the original service logic will be affected. 16 17**Key API/Component Changes** 18 19| Module | Class | Method/Attribute/Enum/Constant | Change Type| 20|--------------|--------------|-------------------------------------------------------------------------------------------------------------------|------| 21| ohos.request | request | function download(context: BaseContext, config: DownloadConfig, callback: AsyncCallback\<DownloadTask>): void; | Deleted | 22| ohos.request | request | function download(context: BaseContext, config: DownloadConfig): Promise\<DownloadTask>; | Deleted | 23| ohos.request | request | function upload(context: BaseContext, config: UploadConfig, callback: AsyncCallback\<UploadTask>): void; | Deleted | 24| ohos.request | request | function upload(context: BaseContext, config: UploadConfig): Promise\<UploadTask>; | Deleted | 25 26**Adaptation Guide** 27 28Call the new APIs. The following uses **downloadFile** as an example to show how it is called in the new version: 29 30```ts 31try { 32 request.downloadFile(globalThis.abilityContext, { url: 'https://xxxx/xxxxx.hap', 33 filePath: 'xxx/xxxxx.hap'}, (err, data) => { 34 if (err) { 35 console.error('Failed to request the download. Cause: ' + JSON.stringify(err)); 36 return; 37 } 38 }); 39} catch (err) { 40 console.log("downloadFile callback fail." + "errCode:" + err.code + ",errMessage:" + err.message); 41} 42``` 43