UNPKG

alfresco-js-api

Version:

JavaScript client library for the Alfresco REST API

149 lines (99 loc) 6.59 kB
# AlfrescoCoreRestApi.DownloadsApi All URIs are relative to *https://localhost/alfresco/api/-default-/public/alfresco/versions/1* Method | HTTP request | Description ------------- | ------------- | ------------- [**cancelDownload**](DownloadsApi.md#cancelDownload) | **DELETE** /downloads/{downloadId} | Cancel a download [**createDownload**](DownloadsApi.md#createDownload) | **POST** /downloads | Create a new download [**getDownload**](DownloadsApi.md#getDownload) | **GET** /downloads/{downloadId} | Get a download <a name="cancelDownload"></a> # **cancelDownload** > cancelDownload(downloadId) Cancel a download **Note:** this endpoint is available in Alfresco 5.2.1 and newer versions. Cancels the creation of a download request. **Note:** The download node can be deleted using the **DELETE /nodes/{downloadId}** endpoint By default, if the download node is not deleted it will be picked up by a cleaner job which removes download nodes older than a configurable amount of time (default is 1 hour) Information about the existing progress at the time of cancelling can be retrieved by calling the **GET /downloads/{downloadId}** endpoint The cancel operation is done asynchronously. ### Example ```javascript var downloadId = "downloadId_example"; // String | The identifier of a download node. var callback = function(error, data, response) { if (error) { console.error(error); } else { console.log('API called successfully.'); } }; this.alfrescoJsApi.core.downloadsApi.cancelDownload(downloadId, callback); ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **downloadId** | **String**| The identifier of a download node. | ### Return type null (empty response body) ### Authorization [basicAuth](../README.md#basicAuth) ### HTTP request headers - **Content-Type**: application/json - **Accept**: application/json <a name="createDownload"></a> # **createDownload** > DownloadEntry createDownload(downloadBodyCreate, opts) Create a new download **Note:** this endpoint is available in Alfresco 5.2.1 and newer versions. Creates a new download node asynchronously, the content of which will be the zipped content of the **nodeIds** specified in the JSON body like this: &#x60;&#x60;&#x60;JSON { \&quot;nodeIds\&quot;: [ \&quot;c8bb482a-ff3c-4704-a3a3-de1c83ccd84c\&quot;, \&quot;cffa62db-aa01-493d-9594-058bc058eeb1\&quot; ] } &#x60;&#x60;&#x60; **Note:** The content of the download node can be obtained using the **GET /nodes/{downloadId}/content** endpoint ### Example ```javascript var downloadBodyCreate = new AlfrescoCoreRestApi.DownloadBodyCreate(); // DownloadBodyCreate | The nodeIds the content of which will be zipped, which zip will be set as the content of our download node. var opts = { 'fields': ["fields_example"] // [String] | A list of field names. You can use this parameter to restrict the fields returned within a response if, for example, you want to save on overall bandwidth. The list applies to a returned individual entity or entries within a collection. If the API method also supports the **include** parameter, then the fields specified in the **include** parameter are returned in addition to those specified in the **fields** parameter. }; var callback = function(error, data, response) { if (error) { console.error(error); } else { console.log('API called successfully. Returned data: ' + data); } }; this.alfrescoJsApi.core.downloadsApi.createDownload(downloadBodyCreate, opts, callback); ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **downloadBodyCreate** | [**DownloadBodyCreate**](DownloadBodyCreate.md)| The nodeIds the content of which will be zipped, which zip will be set as the content of our download node. | **fields** | [**[String]**](String.md)| A list of field names. You can use this parameter to restrict the fields returned within a response if, for example, you want to save on overall bandwidth. The list applies to a returned individual entity or entries within a collection. If the API method also supports the **include** parameter, then the fields specified in the **include** parameter are returned in addition to those specified in the **fields** parameter. | [optional] ### Return type [**DownloadEntry**](DownloadEntry.md) ### Authorization [basicAuth](../README.md#basicAuth) ### HTTP request headers - **Content-Type**: application/json - **Accept**: application/json <a name="getDownload"></a> # **getDownload** > DownloadEntry getDownload(downloadId, opts) Get a download **Note:** this endpoint is available in Alfresco 5.2.1 and newer versions. Retrieve status information for download node **downloadId** ### Example ```javascript var downloadId = "downloadId_example"; // String | The identifier of a download node. var opts = { 'fields': ["fields_example"] // [String] | A list of field names. You can use this parameter to restrict the fields returned within a response if, for example, you want to save on overall bandwidth. The list applies to a returned individual entity or entries within a collection. If the API method also supports the **include** parameter, then the fields specified in the **include** parameter are returned in addition to those specified in the **fields** parameter. }; var callback = function(error, data, response) { if (error) { console.error(error); } else { console.log('API called successfully. Returned data: ' + data); } }; this.alfrescoJsApi.core.downloadsApi.getDownload(downloadId, opts, callback); ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **downloadId** | **String**| The identifier of a download node. | **fields** | [**[String]**](String.md)| A list of field names. You can use this parameter to restrict the fields returned within a response if, for example, you want to save on overall bandwidth. The list applies to a returned individual entity or entries within a collection. If the API method also supports the **include** parameter, then the fields specified in the **include** parameter are returned in addition to those specified in the **fields** parameter. | [optional] ### Return type [**DownloadEntry**](DownloadEntry.md) ### Authorization [basicAuth](../README.md#basicAuth) ### HTTP request headers - **Content-Type**: application/json - **Accept**: application/json