Note
This API has been available since API level 11.
This API has been available since API level 11.
Manages file upload and download on the device.
The Download Manager service supports downloading and uploading files to and from a webOS device.
API level 11
Name | Required | Type | Description |
---|---|---|---|
value | Required | Boolean | Indicates whether 1x mode is to be enabled. Possible values are:
|
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of operation. Possible values are:
|
value | Optional | Boolean | Indicates whether 1x mode is to be enabled. Possible values are:
|
errorText | Optional | String | Indicates the reason for the failure of the operation. |
Error Code | Error Text | Error Description |
---|---|---|
None | Missing required key is required but it is missing | Missing required key is required but it is missing |
Example code
# luna-send -n 1 -f luna://com.webos.service.downloadmanager/allow1x '{"value" : true}'
Response:
{
"returnValue": true,
"value": true
}
API level 11
None
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of operation. Possible values are:
|
Example code
# luna-send -n 1 -f luna://com.webos.service.downloadmanager/cancelAllDownloads '{}'
Response:
{
"returnValue": true
}
API level 11
Cancel a download that is in progress.
Name | Required | Type | Description |
---|---|---|---|
ticket | Required | Number (int64_t) | Download ID to be canceled. The download ID is returned from the download method. |
Name | Required | Type | Description |
---|---|---|---|
ticket | Required | Number (int64_t) | Canceled download ID. |
returnValue | Required | Boolean | Indicates the status of operation. Possible values are:
|
aborted | Optional | Boolean | If the download was aborted, aborted will contain true. If the download was not aborted, aborted will contain false. |
completed | Optional | Boolean | If the download was completed, completed will contain true. If the download was not completed, completed will contain false. |
completionStatusCode | Optional | Number (int8_t) | Download completion status code.
|
errorText | Optional | String | Indicates the reason for the failure of the operation. See the "Error Codes Reference" section of this method for details. |
Error Code | Error Text | Error Description |
---|---|---|
None | None | Refer to the completionStatusCode parameter above. |
None | Missing required key is required but it is missing | Missing required key is required but it is missing |
Example code
# luna-send -n 1 -f luna://com.webos.service.downloadmanager/cancelDownload '{"ticket" : 1}'
Response:
{
"ticket": 1,
"aborted": true,
"completionStatusCode": 12,
"returnValue": true,
"completed": false
}
API level 11
Cancel an upload that is in progress. See the cancelDownload method for detailed documentation.
Name | Required | Type | Description |
---|---|---|---|
ticket | Required | Number (int64_t) | Upload ID to be canceled. The upload ID is returned from the upload method. |
Name | Required | Type | Description |
---|---|---|---|
ticket | Required | Number (int64_t) | Upload ID to be canceled. The upload ID is returned from the upload method. |
returnValue | Required | Boolean | Indicates the status of operation. Possible values are:
|
aborted | Optional | Boolean | If the upload was aborted, aborted will contain true. If the upload was not aborted, aborted will contain false. |
completed | Optional | Boolean | If the upload was completed, completed will contain true. If the upload was not completed, completed will contain false. |
completionStatusCode | Optional | Number (int8_t) | Completion status code.
|
errorText | Optional | String | Indicates the reason for the failure of the operation. See the "Error Codes Reference" section of this method for details. |
Error Code | Error Text | Error Description |
---|---|---|
None | None | Refer to the completionStatusCode parameter above. |
None | Missing required key is required but it is missing | Missing required key is required but it is missing |
Example code
# luna-send -n 1 -f luna://com.webos.service.downloadmanager/cancelUpload '{"ticket" : 1}'
Response:
{
"ticket": 1,
"aborted": true,
"completionStatusCode": 12,
"returnValue": true,
"completed": false
}
API level 11
Clear the download history for a specific application or for all downloads or uploads.
Name | Required | Type | Description |
---|---|---|---|
owner | Optional | String | ID of owner requesting the download. |
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of operation. Possible values are:
|
errorText | Optional | String | Indicates the reason for the failure of the operation. See the "Error Codes Reference" section of this method for details. |
errorCode | Optional | Number (int8_t) | The error code for the failed operation. |
Error Code | Error Text | Error Description |
---|---|---|
None | None | Can return the following history status code:
|
3 | Fail to find owner | Fail to find owner |
Example code
# luna-send -n 1 -f luna://com.webos.service.downloadmanager/clearHistory '{"owner" : "/var/run/ls2/5Htp9Q"}'
Response:
{
"returnValue": true
}
API level 11
Delete a downloaded file based on the ticket number. The ticket number is a unique ID returned from the download method.
Name | Required | Type | Description |
---|---|---|---|
ticket | Required | Number (int64_t) | Download ID of the file to be deleted. |
Name | Required | Type | Description |
---|---|---|---|
ticket | Required | String | Deleted download ID. |
returnValue | Required | Boolean | Indicates the status of operation. Possible values are:
|
errorText | Optional | String | Indicates the reason for the failure of the operation. See the "Error Codes Reference" section of this method for details. |
Error Code | Error Text | Error Description |
---|---|---|
None | requested download record not found | requested download record not found |
Example code
# luna-send -n 1 -f luna://com.webos.service.downloadmanager/deleteDownloadedFile '{"ticket" : 124}'
Response:
{
"ticket": 124,
"returnValue": true
}
API level 11
Name | Required | Type | Description |
---|---|---|---|
target | Required | String | Target URL to download. |
mime | Optional | String | Mime type of the target. It is not used in curl now, instead "application/x-binary" is set, as described at http://www.webmaster-toolkit.com/mime-types.shtml. |
deviceId | Optional | String | Used for curl in "Device-Id:". |
authToken | Optional | String | Used for curl in "Auth-Token:". |
cookieToken | Optional | String | cookieToken. |
cookieHeader | Optional | String | cookieHeader. |
targetDir | Optional | String | Directory where to save the downloaded file. |
targetFilename | Optional | String | File name to use when saving the downloaded file. If targetFilename is not specified, the file name specified in target is default. If there is the same file name, download manager will internally generate a unique name. |
keepFilenameOnRedirect | Optional | Boolean | To follow redirects until it downloads the actual file, set keepFilenameOnRedirect to true. To not follow redirects, set keepFilenameOnRedirect to false. |
canHandlePause | Optional | Boolean | To enable pause the download, set canHandlePause to true. Otherwise, set canHandlePause to false. Note that only downloads started with canHandlePause:true can be paused; otherwise, calling pauseDownload on a downloading file will act like a "cancel". |
autoResume | Optional | Boolean | If autoResume is set to false, paused task will not be recovered automatically. |
appendTargetFile | Optional | Boolean | If appendTargetFile is set to true and if the target file already exists, download manager appends download data, not creates a new one. |
e_rangeLow | Optional | String | Offset in number of bytes that you want the transfer to start from. Used for curl option (refer curl_easy_setopt(), CURLOPT_RESUME_FROM_LARGE). |
e_rangeHigh | Optional | String | Must be bigger than e_rangeLow. Not used now. |
interface | Optional | String | Can have one of the following values:
|
subscribe | Optional | Boolean | To get informed when download status has been changed, set subscribe to true. Otherwise, set subscribe to false. |
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of operation. Possible values are:
|
subscribed | Required | Boolean | If it is subscribed, subscribed will contain true. |
ticket | Optional | String | Unique download ID. It can be used to get more information about a specific download. |
url | Optional | String | URL of the downloaded file. |
target | Optional | String | Path and name of the downloading file. |
errorCode | Optional | String | The error code for the failed operation. |
errorText | Optional | String | Indicates the reason for the failure of the operation. See the "Error Codes Reference" section of this method for details. |
Name | Required | Type | Description |
---|---|---|---|
ticket | Optional | Number (int64_t) | Unique download ID. It can be used to get more information about a specific download. |
url | Optional | String | If the download is in progress, target url |
sourceUrl | Optional | String | Downloaded target url |
deviceId | Optional | String | used for curl in "Device-Id:" |
authToken | Optional | String | used for curl in "Auth-Token:" |
target | Optional | String | Downloaded directory path + file name |
destTempPrefix | Optional | String | Prefix value for downloading. - (".") |
destFile | Optional | String | Downloaded file name |
destPath | Optional | String | Downloaded directory path |
mimetype | Optional | String | mime type string, not used in curl now, instead "application/x-binary" is set |
amountReceived | Optional | Number (int32_t) | If the download is in progress, amount of received in integer format |
e_amountReceived | Optional | String | If the download is in progress, amount of received in string format(llu) |
amountTotal | Optional | Number (int32_t) | If the download is in progress, amount of total in integer format |
e_amountTotal | Optional | String | If the download is in progress, amount of total in string format(llu) |
initialOffset | Optional | Number (int32_t) | Initial offset byte in integer format |
e_initialOffsetBytes | Optional | String | Initial offset byte in string format(llu) |
e_rangeLow | Optional | String | the offset in number of bytes that you want the transfer to start from. used for curl option (refer curl_easy_setopt(), CURLOPT_RESUME_FROM_LARGE) |
e_rangeHigh | Optional | String | not used now, but must be bigger than e_rangeLow |
canHandlePause | Optional | Boolean | True if it can be paused |
autoResume | Optional | Boolean | If autoTesume is false, paused task will not be recovered automatically |
cookieHeader | Optional | String | cookieHeader |
completed | Optional | Boolean | If the download was completed, completed will contain true. If the download was not completed, completed will contain false. |
interrupted | Optional | Boolean | If the download was interrupted, interrupted will contain true. If the download was not interrupted, interrupted will contain false. |
aborted | Optional | Boolean | If the download was aborted, aborted will contain true. If the download was not aborted, aborted will contain false. |
completionStatusCode | Optional | Number (int8_t) | Completion status code.
|
httpStatus | Optional | Number (int64_t) | HTTP return code, as described at http://www.w3.org/Protocols/HTTP/HTRESP.html. |
errorCode | Optional | Number (int8_t) | CURL error code as described at http://curl.haxx.se/libcurl/c/libcurl-errors.html. |
errorText | Optional | String | CURL error text as described at http://curl.haxx.se/libcurl/c/libcurl-errors.html. |
Error Code | Error Text | Error Description |
---|---|---|
None | None | Start status codes.
|
None | None | Completion status code.
|
Example code
# luna-send -f -i luna://com.webos.service.downloadmanager/download '{"target" : "http://www.google.co.kr"}'
Response:
{
"ticket": 18,
"url": "http://www.google.co.kr",
"target": "/media/internal/downloads/fileeAErBg",
"subscribed": false,
"returnValue": true
}
API level 11
Name | Required | Type | Description |
---|---|---|---|
ticket | Required | Number (int64_t) | Download ID of the file to get the download status. |
subscribe | Optional | Boolean | To get informed when download status has been changed, set subscribe to true. Otherwise, set subscribe to false. |
Name | Required | Type | Description |
---|---|---|---|
ticket | Required | Number (int64_t) | Unique download ID. |
url | Optional | String | URL of the downloaded file. |
amountReceived | Optional | Number (int32_t) | Number of bytes in integer format received so far. |
e_amountReceived | Optional | String | Number of bytes in string format(llu) received so far. |
amountTotal | Optional | Number (int32_t) | Total Number of bytes in integer format downloaded. |
e_amountTotal | Optional | String | Total Number of bytes in string format(llu) downloaded. |
returnValue | Required | Boolean | Indicates the status of operation. Possible values are:
|
subscribed | Optional | Boolean | If it is subscribed, subscribed will contain true. |
errorText | Optional | String | Indicates the reason for the failure of the operation. See the "Error Codes Reference" section of this method for details. |
owner | Optional | String | App ID which requested the download. If the download was completed, owner is returned. |
interface | Optional | String | Can have one of the following values:
|
state | Optional | String | Can have one of the following values:
|
Name | Required | Type | Description |
---|---|---|---|
None | Optional | Object: downloads | Subscription response is returned with the downloads object. Refer to the downloads object for more details. |
Example code
Example response for a successful call :
/ # luna-send -f -i luna://com.webos.service.downloadmanager/downloadStatusQuery '{"ticket" : 125}'
{
"destFile": "www.google.co_1.kr",
"sourceUrl": "www.google.co.kr",
"target": "/media/internal/downloads/www.google.co_1.kr",
"deviceId": "",
"destTempPrefix": ".",
"completed": true,
"completionStatusCode": 200,
"e_amountTotal": "0",
"destPath": "/media/internal/downloads/",
"interrupted": false,
"canHandlePause": false,
"httpStatus": 200,
"mimetype": "text/html; charset=EUC-KR",
"cookieHeader": "",
"e_rangeHigh": "0",
"e_initialOffsetBytes": "0",
"returnValue": true,
"autoResume": false,
"amountReceived": 51907,
"url": "www.google.co.kr",
"aborted": false,
"initialOffset": 0,
"authToken": "",
"state": "completed",
"e_amountReceived": "51907",
"amountTotal": 0,
"ticket": 125,
"interface": "wired",
"owner": "/var/run/ls2/0CVJvQ",
"e_rangeLow": "0"
}
Example response for a failed call : ticket is not in download history
/ # luna-send -f -i luna://com.webos.service.downloadmanager/downloadStatusQuery '{"ticket" : 999}'
{
"ticket": 999,
"subscribed": false,
"errorCode": "ticket_not_found",
"returnValue": false
}
API level 11
Get the download or upload history for a specific application.
Name | Required | Type | Description |
---|---|---|---|
owner | Required | String | ID of owner requesting download or upload. |
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of operation. Possible values are:
|
errorText | Optional | String | Indicates the reason for the failure of the operation. See the "Error Codes Reference" section of this method for details. |
items | Optional | Object: items | Objects describing information of download history. |
Example code
Example response for a successful call :
/ # luna-send -n 1 -f luna://com.webos.service.downloadmanager/getAllHistory '{"owner" : "/var/run/ls2/5Htp9Q"}'
{
"items": [
{
"interface": "wired",
"ticket": 123,
"state": "completed",
"fileSizeOnFilesys": 51861,
"recordString": "{\"destFile\":\"www.google.co.kr\",\"sourceUrl\":\"www.google.co.kr\",\"target\":\"/media/internal/downloads/www.google.co.kr\",\"deviceId\":\"\",\"destTempPrefix\":\".\",\"destPath\":\"/media/internal/downloads/\",\"completionStatusCode\":200,\"autoResume\":false,\"mimetype\":\"text/html; charset=EUC-KR\",\"interrupted\":false,\"canHandlePause\":false,\"cookieHeader\":\"\",\"completed\":true,\"e_rangeHigh\":\"0\",\"url\":\"www.google.co.kr\",\"authToken\":\"\",\"amountReceived\":51861,\"initialOffset\":0,\"aborted\":false,\"e_amountReceived\":\"51861\",\"amountTotal\":0,\"ticket\":123,\"e_rangeLow\":\"0\",\"httpStatus\":200,\"e_amountTotal\":\"0\",\"e_initialOffsetBytes\":\"0\"}",
"fileExistsOnFilesys": true
}
],
"returnValue": true
}
Example response for a failed call : owner is not found
/ # luna-send -n 1 -f luna://com.webos.service.downloadmanager/getAllHistory '{"owner" : "test"}'
{
"subscribed": false,
"errorText": "not_found",
"returnValue": false
}
API level 11
Determine if the network connection is in 1x mode.
None
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | If the is1xMode method succeeds, returnValue will contain true. If the is1xMode method fails, returnValue will contain false. |
1x | Required | Boolean | If the network connection is in 1x mode, 1x will contain true. If the network connection is not in 1x mode, 1x will contain false. |
Example code
Example response for a successful call :
/ # luna-send -n 1 -f luna://com.webos.service.downloadmanager/is1xMode '{}'
{
"1x": false,
"returnValue": true
}
Example response for a failed call : allways return "true".
API level 11
Return the list of all downloads that are currently in progress.
None
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of operation. Possible values are:
|
count | Required | String | Number of downloads in progress. |
downloads | Optional | Object: downloads | Array of objects for each pending download. |
Example code
Example response for a successful call :
/ # luna-send -n 1 -f luna://com.webos.service.downloadmanager/listPending '{}'
{
"count": 0,
"returnValue": true
}
Example response for a failed call : cannot reproduce response for a failed
API level 11
Pause a download.
Note that only downloads started with canHandlePause:true can be paused; otherwise, calling pauseDownload on a downloading file will act like a "cancel".
Name | Required | Type | Description |
---|---|---|---|
ticket | Required | Number (int8_t) | Download ID to pause. |
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of operation. Possible values are:
|
errorCode | Optional | String | The error code for the failed operation. |
errorText | Optional | String | Indicates the reason for the failure of the operation. See the "Error Codes Reference" section of this method for details. |
Error Code | Error Text | Error Description |
---|---|---|
None | None | Can have the following pause status code:
|
Example code
Example response for a successful call :
/# luna-send -n 1 -f luna://com.webos.service.downloadmanager/pauseDownload '{"ticket" : 135}'
{
"returnValue": true
}
Example response for a failed call : ticket is not found.
/ # luna-send -n 1 -f luna://com.webos.service.downloadmanager/pauseDownload '{"ticket" : 999}'
{
"subscribed": false,
"errorCode": "Ticket provided does not correspond to a downloading transfer",
"returnValue": false
}
API level 11
Name | Required | Type | Description |
---|---|---|---|
ticket | Required | Number (int8_t) | Download ID to resume. |
authToken | Optional | String | Used for curl in "Auth-Token". |
deviceId | Optional | String | used for curl in "Device-Id". |
subscribe | Optional | Boolean | To get informed when download status has been changed, set subscribe to true. Otherwise, set subscribe to false. |
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of operation. Possible values are:
|
subscribed | Optional | Boolean | If it is subscribed, subscribed will contain true. |
errorCode | Optional | String | The error code for the failed operation. |
errorText | Optional | String | Indicates the reason for the failure of the operation. See the "Error Codes Reference" section of this method for details. |
Name | Required | Type | Description |
---|---|---|---|
None | Optional | Object: downloads | Subscription response is returned with the downloads object. Refer to the downloads object for more details. |
Error Code | Error Text | Error Description |
---|---|---|
None | None | Resume status codes.
|
Example code
Example response for a successful call :
/ # luna-send -f -i luna://com.webos.service.downloadmanager/resumeDownload '{"ticket" : 135}'
{
"subscribed": false,
"returnValue": true
}
Example response for a failed call : ticket is not found.
/ # luna-send -f -i luna://com.webos.service.downloadmanager/resumeDownload '{"ticket" : 999}'
{
"subscribed": false,
"errorCode": "-1",
"errorText": "Ticket provided does not correspond to an interrupted transfer in history",
"returnValue": false
}
API level 11
Upload a file to the target URI.
If subscribe is set to false, the onSuccess handler is called only once after the initial request. To be notified when the upload is complete, set subscribe to true and onSuccess will be called periodically with progress updates. The upload is complete when the handler receives a response with completed:true.
Name | Required | Type | Description |
---|---|---|---|
url | Required | String | URL where to upload the file. |
fileName | Required | String | Path to the local file to be uploaded. |
fileLabel | Optional | String | The label portion of the file name (as opposed to the file extension). |
contentType | Optional | String | The MIME type of the file, as described at http://www.webmaster-toolkit.com/mime-types.shtml. |
postParameters | Optional | Object: postParameters | An object containing key/data/content triplets to support parameters required by the server to which the file is uploaded. |
subscribe | Optional | Boolean | To get informed when upload status has been changed, set subscribe to true. Otherwise, set subscribe to false. |
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of operation. Possible values are:
|
ticket | Optional | Number (int64_t) | Unique upload ID. It can be used to get more information about a specific upload. |
subscribed | Optional | Boolean | If it is subscribed, subscribed will contain true. |
errorText | Optional | String | Indicates the reason for the failure of the operation. See the "Error Codes Reference" section of this method for details. |
errorCode | Optional | Number (int8_t) | The error code for the failed operation. |
Name | Required | Type | Description |
---|---|---|---|
location | Optional | String | Uploaded file location. |
completed | Optional | Boolean | If the upload is complete, completed will contain true. Otherwise, completed will contain false. |
completionCode | Optional | Number (int8_t) | Completion Status Code, as described at http://curl.haxx.se/libcurl/c/libcurl-errors.html. |
httpCode | Optional | Number (int64_t) | HTTP return code, as described at http://www.w3.org/Protocols/HTTP/HTRESP.html. |
sourceFile | Optional | String | Path to the local file uploaded. |
url | Optional | String | Uploaded file URL. |
responseString | Optional | String | Server response to the POST request. |
Error Code | Error Text | Error Description |
---|---|---|
None | None | Upload status codes.
|
Example code
Example response for a successful call :
/ # luna-send -i -f luna://com.webos.service.downloadmanager/upload '{"url":"http://www.google.co.kr","fileName":"/media/internal/downloads/test.txt"}'
{
"ticket": 126,
"subscribed": false,
"returnValue": true
}
Example response for a failed call : missing parameter
/ # luna-send -i -f luna://com.webos.service.downloadmanager/upload '{}'
{
"errorCode": "Missing required key is required but it is missing",
"returnValue": false
}
Array containing downloads
Name | Required | Type | Description |
---|---|---|---|
ticket | Optional | Number (int64_t) | Unique download ID. It can be used to get more information about a specific download. |
url | Optional | String | If the download is in progress, target url |
sourceUrl | Optional | String | Downloaded target url |
deviceId | Optional | String | used for curl in "Device-Id:" |
authToken | Optional | String | used for curl in "Auth-Token:" |
target | Optional | String | Downloaded directory path + file name |
destTempPrefix | Optional | String | Prefix value for downloading. - (".") |
destFile | Optional | String | Downloaded file name |
destPath | Optional | String | Downloaded directory path |
mimetype | Optional | String | mime type string, not used in curl now, instead "application/x-binary" is set |
amountReceived | Optional | Number (int32_t) | If the download is in progress, amount of received in integer format |
e_amountReceived | Optional | String | If the download is in progress, amount of received in string format(llu) |
amountTotal | Optional | Number (int32_t) | If the download is in progress, amount of total in integer format |
e_amountTotal | Optional | String | If the download is in progress, amount of total in string format(llu) |
initialOffset | Optional | Number (int32_t) | Initial offset byte in integer format |
e_initialOffsetBytes | Optional | String | Initial offset byte in string format(llu) |
e_rangeLow | Optional | String | the offset in number of bytes that you want the transfer to start from. used for curl option (refer curl_easy_setopt(), CURLOPT_RESUME_FROM_LARGE) |
e_rangeHigh | Optional | String | not used now, but must be bigger than e_rangeLow |
canHandlePause | Optional | Boolean | True if it can be paused |
autoResume | Optional | Boolean | If autoTesume is false, paused task will not be recovered automatically |
cookieHeader | Optional | String | cookieHeader |
lastUpdateAt | Optional | Number (int64_t) | last updated bytes |
queued | Optional | Boolean | True if queued |
owner | Optional | String | Owner ID which requested the download |
connectionName | Optional | String | Interface state. Possible values are:
|
Objects of items which describe information of download history.
Name | Required | Type | Description |
---|---|---|---|
ticket | Optional | Number (int64_t) | Unique download ID. It can be used to get more information about a specific download. |
interface | Optional | String | Interface state. Possible values are:
|
state | Optional | String | Download state. Possible values are:
|
recordString | Optional | String | Download history. |
fileExistsOnFilesys | Optional | Boolean | If the file exists on the file system, fileExistsOnFilesys will contain true. |
fileSizeOnFilesys | Optional | Number (int8_t) | File size on the file system. |
An object containing key/data/content triplets to support parameters required by the server to which the file is uploaded.
Name | Required | Type | Description |
---|---|---|---|
key | Optional | String | Key. |
data | Optional | String | Literal data. |
contentType | Optional | String | Mime type of part. |
Contents