com.webos.service.downloadmanager

Note
This API has been available since API level 11.

API Summary

Manages file upload and download on the device.

Overview of the API

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

Methods

allow1x

ACG: download.management
  • Added: API level 11

Description

Enable or disable 1x mode for downloads/uploads.

Parameters

Name

Required

Type

Description

valueRequiredBoolean

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

returnValueRequiredBoolean

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

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

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

Indicates the reason for the failure of the operation. 

Error Codes Reference

Error Code

Error Text

Error Description

NoneMissing required key is required but it is missing

Missing required key is required but it is missing

Example

Example code

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

Response:

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

cancelAllDownloads

ACG: download.operation
  • Added: API level 11

Description

Cancel all downloads that are in progress.

Parameters

None

Call Returns

Name

Required

Type

Description

returnValueRequiredBoolean

Indicates the status of operation. Possible values are:

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

Example

Example code

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

Response:

{
    "returnValue": true
}

cancelDownload

ACG: download.management
  • Added: API level 11

Description

Cancel a download that is in progress.

Parameters

Name

Required

Type

Description

ticketRequiredNumber (int64_t)

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

Call Returns

Name

Required

Type

Description

ticketRequiredNumber (int64_t)

Canceled download ID.

returnValueRequiredBoolean

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

If the download was aborted, aborted will contain true.

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

completedOptionalBoolean

If the download was completed, completed will contain true.

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

completionStatusCodeOptionalNumber (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
errorTextOptionalString

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

Error Codes Reference

Error Code

Error Text

Error Description

NoneNone

Refer to the completionStatusCode parameter above.

NoneMissing required key is required but it is missing

Missing required key is required but it is missing

Example

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
}

cancelUpload

ACG: download.management
  • Added: API level 11

Description

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

Parameters

Name

Required

Type

Description

ticketRequiredNumber (int64_t)

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

Call Returns

Name

Required

Type

Description

ticketRequiredNumber (int64_t)

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

returnValueRequiredBoolean

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

If the upload was aborted, aborted will contain true.

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

completedOptionalBoolean

If the upload was completed, completed will contain true.

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

completionStatusCodeOptionalNumber (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
errorTextOptionalString

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

Error Codes Reference

Error Code

Error Text

Error Description

NoneNone

Refer to the completionStatusCode parameter above.

NoneMissing required key is required but it is missing

Missing required key is required but it is missing

Example

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
}

clearHistory

ACG: download.operation
  • Added: API level 11

Description

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

Parameters

Name

Required

Type

Description

ownerOptionalString

ID of owner requesting the download.

Call Returns

Name

Required

Type

Description

returnValueRequiredBoolean

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

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

errorCodeOptionalNumber (int8_t)

The error code for the failed operation.

Error Codes Reference

Error Code

Error Text

Error Description

NoneNone

Can return the following history status code:

  • 0 - OK
  • 1 - General Error
  • 2 - History Error
  • 3 - No such history
3Fail to find owner

Fail to find owner

Example

Example code

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

Response:

{
    "returnValue": true
}

deleteDownloadedFile

ACG: download.management
  • Added: API level 11

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

ticketRequiredNumber (int64_t)

Download ID of the file to be deleted.

Call Returns

Name

Required

Type

Description

ticketRequiredString

Deleted download ID.

returnValueRequiredBoolean

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
errorTextOptionalString

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

Error Codes Reference

Error Code

Error Text

Error Description

Nonerequested download record not found

requested download record not found

Example

Example code

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

Response:

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

download

ACG: download.management
  • Added: API level 11

Description

Start a download.

Parameters

Name

Required

Type

Description

targetRequiredString

Target URL to download.

mimeOptionalString

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.

deviceIdOptionalString

Used for curl in "Device-Id:".

authTokenOptionalString

Used for curl in "Auth-Token:".

cookieTokenOptionalString

cookieToken.

cookieHeaderOptionalString

cookieHeader.

targetDirOptionalString

Directory where to save the downloaded file.

targetFilenameOptionalString

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.

keepFilenameOnRedirectOptionalBoolean

To follow redirects until it downloads the actual file, set keepFilenameOnRedirect to true.

To not follow redirects, set keepFilenameOnRedirect to false.

canHandlePauseOptionalBoolean

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

autoResumeOptionalBoolean

If autoResume is set to false, paused task will not be recovered automatically.

appendTargetFileOptionalBoolean

If appendTargetFile is set to true and if the target file already exists, download manager appends download data, not creates a new one.

e_rangeLowOptionalString

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_rangeHighOptionalString

Must be bigger than e_rangeLow. Not used now. 

interfaceOptionalString

Can have one of the following values:

  • wired
  • wifi
  • wan
  • btpan
subscribeOptionalBoolean

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

Otherwise, set subscribe to false.

Call Returns

Name

Required

Type

Description

returnValueRequiredBoolean

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

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

ticketOptionalString

Unique download ID. It can be used to get more information about a specific download.

urlOptionalString

URL of the downloaded file.

targetOptionalString

Path and name of the downloading file.

errorCodeOptionalString

The error code for the failed operation.

errorTextOptionalString

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

ticketOptionalNumber (int64_t)

Unique download ID. It can be used to get more information about a specific download.

urlOptionalString

If the download is in progress, target url

sourceUrlOptionalString

Downloaded target url

deviceIdOptionalString

used for curl in "Device-Id:"

authTokenOptionalString

used for curl in "Auth-Token:"

targetOptionalString

Downloaded directory path + file name

destTempPrefixOptionalString

Prefix value for downloading. - (".")

destFileOptionalString

Downloaded file name

destPathOptionalString

Downloaded directory path

mimetypeOptionalString

mime type string, not used in curl now, instead "application/x-binary" is set

amountReceivedOptionalNumber (int32_t)

If the download is in progress, amount of received in integer format

e_amountReceivedOptionalString

If the download is in progress, amount of received in string format(llu)

amountTotalOptionalNumber (int32_t)

If the download is in progress, amount of total in integer format

e_amountTotalOptionalString

If the download is in progress, amount of total in string format(llu)

initialOffsetOptionalNumber (int32_t)

Initial offset byte in integer format

e_initialOffsetBytesOptionalString

Initial offset byte in string format(llu)

e_rangeLowOptionalString

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_rangeHighOptionalString

not used now, but must be bigger than e_rangeLow

canHandlePauseOptionalBoolean

True if it can be paused

autoResumeOptionalBoolean

If autoTesume is false, paused task will not be recovered automatically

cookieHeaderOptionalString

cookieHeader

completedOptionalBoolean

If the download was completed, completed will contain true.

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

interruptedOptionalBoolean

If the download was interrupted, interrupted will contain true.

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

abortedOptionalBoolean

If the download was aborted, aborted will contain true.

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

completionStatusCodeOptionalNumber (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
httpStatusOptionalNumber (int64_t)

HTTP return code, as described at http://www.w3.org/Protocols/HTTP/HTRESP.html.

errorCodeOptionalNumber (int8_t)

CURL error code as described at http://curl.haxx.se/libcurl/c/libcurl-errors.html.

errorTextOptionalString

CURL error text as described at http://curl.haxx.se/libcurl/c/libcurl-errors.html.

Error Codes Reference

Error Code

Error Text

Error Description

NoneNone

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
NoneNone

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 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
}

downloadStatusQuery

ACG: download.management
  • Added: API level 11

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

ticketRequiredNumber (int64_t)

Download ID of the file to get the download status.

subscribeOptionalBoolean

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

Otherwise, set subscribe to false.

Call Returns

Name

Required

Type

Description

ticketRequiredNumber (int64_t)

Unique download ID.

urlOptionalString

URL of the downloaded file.

amountReceivedOptionalNumber (int32_t)

Number of bytes in integer format received so far.

e_amountReceivedOptionalString

Number of bytes in string format(llu) received so far.

amountTotalOptionalNumber (int32_t)

Total Number of bytes in integer format downloaded.

e_amountTotalOptionalString

Total Number of bytes in string format(llu) downloaded.

returnValueRequiredBoolean

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

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

errorTextOptionalString

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

ownerOptionalString

App ID which requested the download. If the download was completed, owner is returned.

interfaceOptionalString

Can have one of the following values:

  • wired
  • wifi
  • wan
  • btpan
stateOptionalString

Can have one of the following values:

  • running
  • queued
  • paused
  • cancelled

Subscription Returns

Name

Required

Type

Description

NoneOptionalObject: downloads

Subscription response is returned with the downloads object. Refer to the downloads object for more details.

Example

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


}

getAllHistory

ACG: download.operation
  • Added: API level 11

Description

Get the download or upload history for a specific application.

Parameters

Name

Required

Type

Description

ownerRequiredString

ID of owner requesting download or upload.

Call Returns

Name

Required

Type

Description

returnValueRequiredBoolean

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

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

itemsOptionalObject: items

Objects describing information of download history.

Example

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


}

is1xMode

ACG: download.management
  • Added: API level 11

Description

Determine if the network connection is in 1x mode.

Parameters

None

Call Returns

Name

Required

Type

Description

returnValueRequiredBoolean

If the is1xMode method succeeds, returnValue will contain true.

If the is1xMode method fails, returnValue will contain false.

1xRequiredBoolean

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

listPending

ACG: download.management
  • Added: API level 11

Description

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

Parameters

None

Call Returns

Name

Required

Type

Description

returnValueRequiredBoolean

Indicates the status of operation. Possible values are:

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

Number of downloads in progress.

downloadsOptionalObject: downloads

Array of objects for each pending download.

Example

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

pauseDownload

ACG: download.management
  • Added: API level 11

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

ticketRequiredNumber (int8_t)

Download ID to pause.

Call Returns

Name

Required

Type

Description

returnValueRequiredBoolean

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

The error code for the failed operation.

errorTextOptionalString

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

Error Codes Reference

Error Code

Error Text

Error Description

NoneNone

Can have the following pause status code:

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

Example

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


}

resumeDownload

ACG: download.management
  • Added: API level 11

Description

Resume a download.

Parameters

Name

Required

Type

Description

ticketRequiredNumber (int8_t)

Download ID to resume.

authTokenOptionalString

Used for curl in "Auth-Token".

deviceIdOptionalString

used for curl in "Device-Id".

subscribeOptionalBoolean

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

Otherwise, set subscribe to false.

Call Returns

Name

Required

Type

Description

returnValueRequiredBoolean

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

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

errorCodeOptionalString

The error code for the failed operation.

errorTextOptionalString

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

NoneOptionalObject: downloads

Subscription response is returned with the downloads object. Refer to the downloads object for more details.

Error Codes Reference

Error Code

Error Text

Error Description

NoneNone

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


}

upload

ACG: download.management
  • Added: API level 11

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

urlRequiredString

URL where to upload the file.

fileNameRequiredString

Path to the local file to be uploaded.

fileLabelOptionalString

The label portion of the file name (as opposed to the file extension).

contentTypeOptionalString

The MIME type of the file, as described at http://www.webmaster-toolkit.com/mime-types.shtml.

postParametersOptionalObject: postParameters

An object containing key/data/content triplets to support parameters required by the server to which the file is uploaded.

subscribeOptionalBoolean

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

Otherwise, set subscribe to false.

Call Returns

Name

Required

Type

Description

returnValueRequiredBoolean

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.
ticketOptionalNumber (int64_t)

Unique upload ID. It can be used to get more information about a specific upload.

subscribedOptionalBoolean

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

errorTextOptionalString

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

errorCodeOptionalNumber (int8_t)

The error code for the failed operation.

Subscription Returns

Name

Required

Type

Description

locationOptionalString

Uploaded file location.

completedOptionalBoolean

If the upload is complete, completed will contain true.

Otherwise, completed will contain false.

completionCodeOptionalNumber (int8_t)

Completion Status Code, as described at http://curl.haxx.se/libcurl/c/libcurl-errors.html.

httpCodeOptionalNumber (int64_t)

HTTP return code, as described at http://www.w3.org/Protocols/HTTP/HTRESP.html.

sourceFileOptionalString

Path to the local file uploaded.

urlOptionalString

Uploaded file URL.

responseStringOptionalString

Server response to the POST request.

Error Codes Reference

Error Code

Error Text

Error Description

NoneNone

Upload status codes.

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

Example

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


}

Objects

downloads

Array containing downloads

Name

Required

Type

Description

ticketOptionalNumber (int64_t)

Unique download ID. It can be used to get more information about a specific download.

urlOptionalString

If the download is in progress, target url

sourceUrlOptionalString

Downloaded target url

deviceIdOptionalString

used for curl in "Device-Id:"

authTokenOptionalString

used for curl in "Auth-Token:"

targetOptionalString

Downloaded directory path + file name

destTempPrefixOptionalString

Prefix value for downloading. - (".")

destFileOptionalString

Downloaded file name

destPathOptionalString

Downloaded directory path

mimetypeOptionalString

mime type string, not used in curl now, instead "application/x-binary" is set

amountReceivedOptionalNumber (int32_t)

If the download is in progress, amount of received in integer format

e_amountReceivedOptionalString

If the download is in progress, amount of received in string format(llu)

amountTotalOptionalNumber (int32_t)

If the download is in progress, amount of total in integer format

e_amountTotalOptionalString

If the download is in progress, amount of total in string format(llu)

initialOffsetOptionalNumber (int32_t)

Initial offset byte in integer format

e_initialOffsetBytesOptionalString

Initial offset byte in string format(llu)

e_rangeLowOptionalString

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_rangeHighOptionalString

not used now, but must be bigger than e_rangeLow

canHandlePauseOptionalBoolean

True if it can be paused

autoResumeOptionalBoolean

If autoTesume is false, paused task will not be recovered automatically

cookieHeaderOptionalString

cookieHeader

lastUpdateAtOptionalNumber (int64_t)

last updated bytes

queuedOptionalBoolean

True if queued

ownerOptionalString

Owner ID which requested the download

connectionNameOptionalString

Interface state. Possible values are:

  • wired     
  • wifi     
  • wan     
  • btpan    

items

Objects of items which describe information of download history.

Name

Required

Type

Description

ticketOptionalNumber (int64_t)

Unique download ID. It can be used to get more information about a specific download.

interfaceOptionalString

Interface state. Possible values are:

  • wired     
  • wifi     
  • wan     
  • btpan
stateOptionalString

Download state. Possible values are:

  • running     
  • queued     
  • paused     
  • cancelled
recordStringOptionalString

Download history.

fileExistsOnFilesysOptionalBoolean

If the file exists on the file system, fileExistsOnFilesys will contain true.

fileSizeOnFilesysOptionalNumber (int8_t)

File size on the file system.

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

keyOptionalString

Key.

dataOptionalString

Literal data.

contentTypeOptionalString

Mime type of part.

Contents