com.webos.service.downloadmanager

API Summary

Manages file upload and download on the device.

Overview of the API

(click to expand)

  The Download Manager service supports downloading and uploading files to and from a webOS device.


Open All


allow1x

Description

Enable or disable 1x mode for downloads/uploads.

Parameters

Name

Required

Type

Description

value Required Boolean

Indicates whether 1x mode is to be enabled. Possible values are:

  • true -  Enable 1x mode
  • false - Disable 1x mode

Call Returns

Name

Required

Type

Description

returnValue Required Boolean

Indicates the status of operation. Possible values are:

  • true - Indicates that the operation was successful.
  • false - Indicates that the operation failed. Check the "errorText" field for details.
value Optional Boolean

Indicates whether 1x mode is to be enabled. Possible values are:

  • true -  Enable 1x mode
  • false - Disable 1x mode
errorText Optional String

Indicates the reason for the failure of the operation. 

Example

Example response for a successful call :

/ # luna-send -n 1 -f luna://com.webos.service.downloadmanager/allow1x '{"value" : true}'

{
"returnValue": true,
"value": true
}



Example response for a failed call : parameter missing

/ # luna-send -n 1 -f luna://com.webos.service.downloadmanager/allow1x '{}'

{
"returnValue": false,
"errorText": "Missing required key is required but it is missing"
}


cancelAllDownloads

Description

Cancel all downloads that are in progress.

Parameters

None

Call Returns

Name

Required

Type

Description

returnValue Required Boolean

Indicates the status of operation. Possible values are:

  • true - Indicates that the operation was successful.
  • false - Indicates that the operation failed.

Example

Example response for a successful call :

/ # luna-send -n 1 -f luna://com.webos.service.downloadmanager/cancelAllDownloads '{}'

{
"returnValue": true
}
 


cancelDownload

Description

Cancel a download that is in progress.

Parameters

Name

Required

Type

Description

ticket Required Number (int64_t)

Download ID to be canceled. The download ID is returned from the download method.

Call Returns

Name

Required

Type

Description

ticket Required Number (int64_t)

Canceled download ID.

returnValue Required Boolean

Indicates the status of operation. Possible values are:

  • true - Indicates that the operation was successful.
  • false - Indicates that the operation failed. Check the "errorText" field for details.
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. 

  • -1 - General Error
  • -2 - Connection Timeout
  • -3 - File Corrupt
  • -4 - File System Error
  • -5 - HTTP Error
  • -6 - Write Error
  • 11 - Interrupted
  • 12 - Canceled
errorText Optional String

Indicates the reason for the failure of the operation. See the "Error Codes Reference" section of this method for details.

Error References

Error Code

Error Text

Error Description

None None

Refer to the completionStatusCode parameter above.

Example

Example response for  successful call :

/ # luna-send -n 1 -f luna://com.webos.service.downloadmanager/cancelDownload '{"ticket" : 1}'

{
"ticket": 1,
"aborted": true,
"completionStatusCode": 12,
"returnValue": true,
"completed": false
}



Example response for a failed call : missing parameter

/ # luna-send -n 1 -f luna://com.webos.service.downloadmanager/cancelDownload '{}'

{
"ticket": 0,
"returnValue": false,
"errorText": "Missing required key is required but it is missing"
}


cancelUpload

Description

Cancel an upload that is in progress. See the cancelDownload method for detailed documentation.

Parameters

Name

Required

Type

Description

ticket Required Number (int64_t)

Upload ID to be canceled. The upload ID is returned from the upload method.

Call Returns

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:

  • true - Indicates that the operation was successful.
  • false - Indicates that the operation failed. Check the "errorText" field for details.
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. 

  • -1 - General Error
  • -2 - Connection Timeout
  • -3 - File Corrupt
  • -4 - File System Error
  • -5 - HTTP Error
  • -6 - Write Error
  • 11 - Interrupted
  • 12 - Canceled
errorText Optional String

Indicates the reason for the failure of the operation. See the "Error Codes Reference" section of this method for details.

Error References

Error Code

Error Text

Error Description

None None

Refer to the completionStatusCode parameter above.

Example

Example response for a successful call :

/ # luna-send -n 1 -f luna://com.webos.service.downloadmanager/cancelUpload '{"ticket" : 1}'

{
"ticket": 1,
"aborted": true,
"completionStatusCode": 12,
"returnValue": true,
"completed": false
}



Example response for a failed call : missing parameter

/ # luna-send -n 1 -f luna://com.webos.service.downloadmanager/cancelUpload '{}'

{
"ticket": 0,
"returnValue": false,
"errorText": "Missing required key is required but it is missing"
}


clearHistory

Description

Clear the download history for a specific application or for all downloads or uploads.

Parameters

Name

Required

Type

Description

owner Optional String

ID of owner requesting the download.

Call Returns

Name

Required

Type

Description

returnValue Required Boolean

Indicates the status of operation. Possible values are:

  • true - Indicates that the operation was successful.
  • false - Indicates that the operation failed. Check the "errorCode" and "errorText" fields for details.
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 References

Error Code

Error Text

Error Description

None None

Can return the following history status code:

  • 0 - OK
  • 1 - General Error
  • 2 - History Error
  • 3 - No such history

Example

Example response for a successful call :

/ # luna-send -n 1 -f luna://com.webos.service.downloadmanager/clearHistory '{"owner" : "/var/run/ls2/5Htp9Q"}'

{
"returnValue": true
}



Example response for a failed call :

/ # luna-send -n 1 -f luna://com.webos.service.downloadmanager/clearHistory '{"owner" : "invalid"}'

{
"errorCode": 3,
"returnValue": false,
"errorText": "Fail to find owner"
}


deleteDownloadedFile

Description

Delete a downloaded file based on the ticket number. The ticket number is a unique ID returned from the download method.

Parameters

Name

Required

Type

Description

ticket Required Number (int64_t)

Download ID of the file to be deleted.

Call Returns

Name

Required

Type

Description

ticket Required String

Deleted download ID.

returnValue Required Boolean

Indicates the status of operation. Possible values are:

  • true - Indicates that the operation was successful.
  • false - Indicates that the operation failed. Check the "errorText" field for details
errorText Optional String

Indicates the reason for the failure of the operation. See the "Error Codes Reference" section of this method for details.

Example

Example response for a successful call :

/ # luna-send -n 1 -f luna://com.webos.service.downloadmanager/deleteDownloadedFile '{"ticket" : 124}'

{
"ticket": 124,
"returnValue": true
}



Example response for a failed call : ticket is not in download history

/ # luna-send -n 1 -f luna://com.webos.service.downloadmanager/deleteDownloadedFile '{"ticket" : 999}'

{
"ticket": 999,
"errorCode": "requested download record not found",
"returnValue": false
}


download

Description

Start a download.

Parameters

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 decribed 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:

  • wired
  • wifi
  • wan
  • btpan
subscribe Optional Boolean

To get informed when download status has been changed, set subscribe to true.

Otherwise, set subscribe to false.

Call Returns

Name

Required

Type

Description

returnValue Required Boolean

Indicates the status of operation. Possible values are:

  • true - Indicates that the operation was successful.
  • false - Indicates that the operation failed. Check the "errorCode" and "errorText" fields for details.
subscribed Required Boolean

If it is subscribed, subscribed will contain true.
If it is not subscribed, subscribed will contain false.

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.

Subscription Returns

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 donwload was completed, completed will contain true.

If the download was not completed, completed will contain false.

interrupted Optional Boolean

If the donwload was interrupted, interrupted will contain true.

If the download was not interrupted, interrupted will contain false.

aborted Optional Boolean

If the donwload was aborted, aborted will contain true.

If the download was not aborted, aborted will contain false.

completionStatusCode Optional Number (int8_t)

Completion status code. 

  • -1 - General Error
  • -2 - Connection Timeout
  • -3 - File Corrupt
  • -4 - File System Error
  • -5 - HTTP Error
  • -6 - Write Error
  • 11 - Interrupted
  • 12 - Canceled
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 References

Error Code

Error Text

Error Description

None None

Start status codes.

  • -1 - General Error
  • -2 - File does not exist
  • -3 - Queue Full
  • -4 - File System Full
  • -5 - CURL Error
  • -6 - Not Suitable Interface
  • -7 - Failed Security Check
None None

Completion status code. 

  • -1 - General Error
  • -2 - Connection Timeout
  • -3 - File Corrupt
  • -4 - File System Error
  • -5 - HTTP Error
  • -6 - Write Error
  • 11 - Interrupted
  • 12 - Canceled

Example

Example response for a successful call :

/media/internal/downloads # luna-send -f -i luna://com.webos.service.downloadmanager/download '{"target" : "http://www.google.co.kr"}'

{
"ticket": 18,
"url": "http://www.google.co.kr",
"target": "/media/internal/downloads/fileeAErBg",
"subscribed": false,
"returnValue": true
}

Example response for a failed call : file system full

/media/internal/downloads # luna-send -f -i luna://com.webos.service.downloadmanager/download '{"target" : "http://www.google.co.kr"}'

{
"subscribed": false,
"errorCode": "-4",
"returnValue": false,
"errorText": "start returned with an error code"
}


downloadStatusQuery

Description

Get the status of a download for a specific ticket number. The method will return the status of current downloads, or any downloads in the history.

Parameters

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.

Call Returns

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:

  • true - Indicates that the operation was successful.
  • false - Indicates that the operation failed. Check the "errorText" field for details.
subscribed Optional Boolean

If it is subscribed, subscribed will contain true.
If it is not subscribed, subscribed will contain false.

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:

  • wired
  • wifi
  • wan
  • btpan
state Optional String

Can have one of the following values:

  • running
  • queued
  • paused
  • cancelled

Subscription Returns

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

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
}


getAllHistory

Description

Get the download or upload history for a specific application.

Parameters

Name

Required

Type

Description

owner Required String

ID of owner requesting download or upload.

Call Returns

Name

Required

Type

Description

returnValue Required Boolean

Indicates the status of operation. Possible values are:

  • true - Indicates that the operation was successful.
  • false - Indicates that the operation failed. Check the "errorText" field for details.
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

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
}


is1xMode

Description

Determine if the network connection is in 1x mode.

Parameters

None

Call Returns

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

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 : allwyas return "true".


listPending

Description

Return the list of all downloads that are currently in progress.

Parameters

None

Call Returns

Name

Required

Type

Description

returnValue Required Boolean

Indicates the status of operation. Possible values are:

  • true - Indicates that the operation was successful.
  • false - Indicates that the operation failed.
count Required String

Number of downloads in progress.

downloads Optional Object: downloads

Array of objects for each pending download.

Example

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


pauseDownload

Description

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".

Parameters

Name

Required

Type

Description

ticket Required Number (int8_t)

Download ID to pause.

Call Returns

Name

Required

Type

Description

returnValue Required Boolean

Indicates the status of operation. Possible values are:

  • true - Indicates that the operation was successful.
  • false - Indicates that the operation failed. Check the "errorCode" and "errorText" fields for details.
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 References

Error Code

Error Text

Error Description

None None

Can have the following pause status code:

  • 1 - OK
  • 0 - General Error
  • -1 - No such download task

Example

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
}


resumeDownload

Description

Resume a download.

Parameters

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.

Call Returns

Name

Required

Type

Description

returnValue Required Boolean

Indicates the status of operation. Possible values are:

  • true - Indicates that the operation was successful.
  • false - Indicates that the operation failed. Check the "errorCode" and "errorText" fields for details.
subscribed Optional Boolean

If it is subscribed, subscribed will contain true.
If it is not subscribed, subscribed will contain false.

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.

Subscription Returns

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 References

Error Code

Error Text

Error Description

None None

Resume status codes.

  • 1 - OK
  • 0 - General Error
  • -1 - Not in History
  • -2 - Not Interrupted
  • -3 - Not Download
  • -4 - Queue Full
  • -5 - History Corrupt
  • -6 - Cannot access temp
  • -7 - Interface Down
  • -8 - File System Full

Example

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
}


upload

Description

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.

Parameters

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 decribed 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.

Call Returns

Name

Required

Type

Description

returnValue Required Boolean

Indicates the status of operation. Possible values are:

  • true - Indicates that the operation was successful.
  • false - Indicates that the operation failed. Check the "errorCode" and "errorText" fields for details.
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.
If it is not subscribed, subscribed will contain false.

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.

Subscription Returns

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 References

Error Code

Error Text

Error Description

None None

Upload status codes.

  • 0 - OK
  • 1 - General error
  • 2 - Invalid parameter

Example

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
}


Objects

items

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

Refer to Interface State.

state Optional String

Refer to Download State.

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.

downloads

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

Refer to Interface State.

postParameters

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.


Except as noted, this content is licensed under Creative Commons Attribution 4.0 and sample code is licensed under Apache License 2.0.