Note
This API has been available since API level 13.
This API has been available since API level 13.
Provides a unified interface to access contents in different storage systems:
NA
API level 13
Copies a file or directory from the source location to the destination.
Name | Required | Type | Description |
---|---|---|---|
srcStorageType | Required | String | Indicates the source storage provider. Possible values are:
Note: This method is not supported for UPnPmediaserver. |
srcDriveId | Required | String | Indicates the source drive ID. Note: The drive ID can be found by using the listStorageProviders method. |
srcPath | Required | String | Indicates the path of the source file or directory. |
destStorageType | Required | String | Indicates the destination storage provider. Possible values are:
Note: This method is not supported for UPnPmediaserver. |
destDriveId | Required | String | Indicates the destination drive ID. Note: The drive ID can be found by using the listStorageProviders method. |
destPath | Required | String | Indicates the path of the destination directory. |
overwrite | Optional | Boolean | Indicates if destination file must be overwritten, if it already exists. Possible values are:
|
subscribe | Optional | Boolean | Subscribe to get notified on the progress of the copy operation. Possible values are:
|
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of the operation.
|
errorCode | Optional | Number | Indicates the error code for the failed operation. |
errorText | Optional | String | Indicates the reason for the failure of the operation. See the API Error Codes Reference section for details. |
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of the operation. |
progress | Optional | Number | Indicates the progress of the copy operation in percentage. |
Example : Copy a file from a cloud storage provider to another location within the same storage provider
# luna-send -n 1 -f luna://com.webos.service.storageaccess/device/copy '{
"srcStorageType":"cloud",
"srcDriveId":"ojydIxW8yBZUV8J3NiyNBvJn",
"destStorageType":"cloud",
"destDriveId":"ojydIxW8yBZUV8J4NiyNBvJn",
"srcPath":"/SAF/SAF_DEMO/test1.PNG",
"destPath":"/SAF"
}'
Response:
{
"returnValue": true
}
Example : Copy a file from within internal storage
# luna-send -n 1 -f luna://com.webos.service.storageaccess/device/copy '{
"srcStorageType": "internal",
"srcDriveId": "INTERNAL_STORAGE",
"destStorageType": "internal",
"destDriveId": "INTERNAL_STORAGE",
"srcPath": "/home/guest0/source/srcfile.txt",
"destPath": "/home/guest0/dest",
"overwrite": true,
"subscribe": true
}'
Response:
{
"returnValue": true
}
Subscription Response:
{
"returnValue": true,
"progress": 10
}
{
"returnValue": true,
"progress": 40
}
{
"returnValue": true,
"progress": 70
}
{
"returnValue": true,
"progress": 100
}
API level 13
Ejects the storage device. In case of "cloud" storage type, it acts as a logout operation.
Note: This operation is not applicable for "internal" storage type.
Name | Required | Type | Description |
---|---|---|---|
storageType | Required | String | Indicates the storage provider. Possible values are:
Note: This method is not supported for UPnPmediaserver. |
driveId | Required | String | Indicates the drive ID. Note: The drive ID can be found by using the listStorageProviders method. |
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of the operation.
|
errorCode | Optional | String | Indicates the error code for the failed operation. |
errorText | Optional | String | Indicates the reason for the failure of the operation. See the API Error Codes Reference section for details. |
Example : Eject USB drive
#luna-send -n 1 -f luna://com.webos.service.storageaccess/device/eject '{
"storageType":"usb",
"driveId":"4C531001600127113005-A7BE-1862"
}'
Response:
{
"returnValue": true
}
API level 13
Gets properties of the given storage provider or the specified file or directory.
Name | Required | Type | Description |
---|---|---|---|
storageType | Required | String | Indicates the storage provider. Possible values are:
|
driveId | Required | String | Indicates the drive ID. Note: The drive ID can be found by using the listStorageProviders method. |
path | Optional | String | Indicates the path of the file or directory. |
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of the operation.
|
storageType | Optional | String | Indicates the type of storage provider. |
writable | Optional | Boolean | True if the device is writable. |
deletable | Optional | Boolean | True if the device is deletable. |
totalSpace | Optional | Number | Total storage space |
freeSpace | Optional | Number | Available free space |
attributes | Optional | Object array | Array of key value pair. Example: {"noatime": true} Note: These is just an example format. It may vary depending on the file system. |
extAttributes | Optional | Object array | Array of key value pair. Example: {"user.comment": "saf comment"} Note: These is just an example format. It may vary depending on the file system. |
errorCode | Optional | Number | Indicates the error code for the failed operation. |
errorText | Optional | String | Indicates the reason for the failure of the operation. See the API Error Codes Reference section for details. |
Example : Get properties of a cloud storage provider
# luna-send -i -f luna://com.webos.service.storageaccess/device/getProperties '{
"storageType":"cloud",
"driveId":"_4Z7KLy4uyH47NwJTB5FtIoT"
}'
Response:
{
"returnValue": true,
"deletable": false,
"writable": true,
"storageType": "cloud",
"totalSpace": 548145,
"freeSpace": 548145
}
Example : Get properties of file
# luna-send -i -f luna://com.webos.service.storageaccess/device/getProperties '{
"storageType":"internal",
"driveId": "INTERNAL_STORAGE",
"path":"/tmp/internal/f1.txt"
}'
Response :
{
"returnValue": true,
"attributes": [
{
"LastModTimeStamp": "Fri Jan 23 23:34:02 -150875\n"
}
],
"deletable": false,
"writable": true,
"storageType": "internal"
}
API level 13
Handles addtional operation related to various providers.
Name | Required | Type | Description |
---|---|---|---|
storageType | Required | String | Indicates the source storage provider. Possible values are:
|
driveId | Optional | String | Indicates the drive ID. Note: The drive ID can be found by using the listStorageProviders method. |
operation | Required | Object: operation | Object consisting of details of the operation. |
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of the operation.
|
responsePayload | Optional | Object array | Response from the storage provider. |
errorCode | Optional | Number | Indicates the error code for the failed operation. |
errorText | Optional | String | Indicates the reason for the failure of the operation. See the API Error Codes Reference section for details. |
Example : For type authenticate
# luna-send -n 1 -f luna://com.webos.service.storageaccess/device/handleExtraCommand '{
"storageType":"cloud",
"driveId":"3OVs_ttW39gu",
"operation":{
"type":"authenticate",
"payload":{
"secretToken":"4/1AY0e-gmLYrDMo0affZ8"
}
}
}'
Response:
{
"returnValue":true,
"responsePayload":[
{
"payload":{
"response":"1//0GmLTBDAi-abOi8amRQxLanOIj1Uwn_A3tsY"
},
"type":"authenticate"
}
]
}
Example : For type login
# luna-send -n 1 -f luna://com.webos.service.storageaccess/device/handleExtraCommand '{
"storageType":"cloud",
"operation":{
"type":"login",
"payload":{
"clientId":"22054195876-t6mo0ruhd0gb.apps.googleusercontent.com",
"clientSecret":"3OVs_ttW39gu"
}
}
}'
Response:
{
"returnValue":true,
"responsePayload":[
{
"payload":{
"response":"https://accounts.google.com/o/oauth2/auth?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&redirect_uri=urn%3Aietfoauth%3A2.0%3Aoob&response_type=code&client_id=22054195876-t6mo0riocigrbs5d0gb.apps.googleusercontent.com&access_type=offline"
},
"type":"login"
}
]
}
Example : For type token
# luna-send -i -f luna://com.webos.service.storageaccess/device/handleExtraCommand '{
"storageType":"CLOUD",
"operation":{
"type":"token",
"payload":{
"clientId":"22054195876-t6mo0ruhd0gb.apps.googleusercontent.com",
"clientSecret":"3OVs_ttW39gu",
"refreshToken":"1//0GmLTBDAi-abOi8amRQxLanOIj1Uwn_A3tsY"
}
}
}'
Response:
{
"returnValue": true
}
Example : For type mountSambaServer
# luna-send -n 1 -f luna://com.webos.service.storageaccess/device/handleExtraCommand '{
"storageType": "network",
"operation": {
"type": "mountSambaServer",
"payload": {
"userName": "ubuntu",
"password": "lge123",
"ip": "192.168.31.68",
"securityMode": "ntlmv2",
"sharePath": "ubuntu",
"mountFlag": "rw",
"domain": "workgroup",
"version": "2.0"
}
}
}'
Response:
{
"responsePayload": [
{
"payload": {
"mountPath": "/tmp/192.168.31.68_134"
},
"type": "mountSambaServer"
}
],
"returnValue": true
}
Example : For type discoverUPnPMediaServer
# luna-send -n 1 -f luna://com.webos.service.storageaccess/device/handleExtraCommand '{
"storageType": "network",
"operation": {
"type": "discoverUPnPMediaServer"
}
}'
Response:
{
"responsePayload": [
{
"payload": {
"mediaServer": [
{
"ip": "192.168.31.68",
"port": 49152,
"descriptionUrl": "http://192.168.31.68:49152/description.xml",
"name": "MEDIA SERVER NAME",
"urn": "urn:schemas-upnp-org:service:ContentDirectory:1"
}
]
},
"type": "discoverUPnPMediaServer"
}
],
"returnValue": true
}
API level 13
Lists contents of the specified directory.
Name | Required | Type | Description |
---|---|---|---|
storageType | Required | String | Indicates the source storage provider. Possible values are:
|
driveId | Required | String | Indicates the drive ID. Note: The drive ID can be found by using the listStorageProviders method. |
path | Required | String | Indicates the path of the directory. |
offset | Required | Number | Indicates the index/offset from where to list the files or directories. |
limit | Required | Number | Indicates the count of entries to be listed (1 - 100). |
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of the operation.
|
files | Optional | Object array: files | Provides information of the files or directories. |
totalCount | Optional | Number | Total number of files or directories in the given path. |
fullPath | Optional | String | Full path of this file or directory. |
errorCode | Optional | Number | Indicates the error code for the failed operation. |
errorText | Optional | String | Indicates the reason for the failure of the operation. See the API Error Codes Reference section for details. |
Example : List contents of a directory
# luna-send -n 1 -f luna://com.webos.service.storageaccess/device/list '{
"storageType":"cloud",
"driveId":"ojydIxW8yBZUV8J3NiyNBvJn",
"path":"/saf_demo_folder",
"limit":10,
"offset":1
}'
Response:
{
"returnValue": true,
"totalCount": 2,
"fullPath": "/saf_demo_folder",
"file": [
{
"size": 0,
"type": "directory",
"mimeType": "application/vnd.google-apps.folder",
"path": "/saf_demo_folder/SAF",
"name": "SAF"
},
{
"size": 548146,
"type": "regular",
"mimeType": "application/pdf",
"path": "/saf_demo_folder/invoice.pdf",
"name": "invoice.pdf"
}
]
}
API level 13
Moves a file or directory from the source location to the destination.
Name | Required | Type | Description |
---|---|---|---|
srcStorageType | Required | String | Indicates the source storage provider. Possible values are:
Note: This method is not supported for UPnPmediaserver. |
srcDriveId | Required | String | Indicates the source drive ID. Note: The drive ID can be found by using the listStorageProviders method. |
destStorageType | Required | String | Indicates the destination storage provider. Possible values are:
Note: This method is not supported for UPnPmediaserver. |
destDriveId | Required | String | Indicates the destination drive ID. Note: The drive ID can be found by using the listStorageProviders method. |
srcPath | Required | String | Indicates the path of the source file or directory. |
destPath | Required | String | Indicates the path of the destination directory. |
overwrite | Optional | Boolean | Indicates if destination file must be overwritten, if it already exists. Possible values are:
|
subscribe | Optional | Boolean | Subscribe to get notified on the progress of the copy operation. Possible values are:
|
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of the operation.
|
errorCode | Optional | Number | Indicates the error code for the failed operation |
errorText | Optional | String | Indicates the reason for the failure of the operation. See the API Error Codes Reference section for details. |
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of the operation. |
progress | Optional | Number | Indicates the progress of the copy operation in percentage. |
Example : Move the file to another location
# luna-send -n 1 -f luna://com.webos.service.storageaccess/device/move '{
"srcStorageType":"cloud",
"srcDriveId":"ojydIxW8yBZUV8J3NiyNBvJn",
"destStorageType":"cloud",
"destDriveId":"ojydIxW8yBZUV8J3NiyNBvJn",
"srcPath":"/SAF/SAF_DEMO/test1.PNG",
"destPath":"/SAF"
}'
Response:
{
"returnValue": true
}
Example : Move a file from within internal storage
# luna-send -n 1 -f luna://com.webos.service.storageaccess/device/move '{
"srcStorageType": "internal",
"srcDriveId": "INTERNAL_STORAGE",
"destStorageType": "internal",
"destDriveId": "INTERNAL_STORAGE",
"srcPath": "/home/guest0/source/srcfile.txt",
"destPath": "/home/guest0/dest",
"overwrite": true,
"subscribe": true
}'
Response:
{
"returnValue": true
}
Subscription Response:
{
"returnValue": true,
"progress": 10
}
{
"returnValue": true,
"progress": 40
}
{
"returnValue": true,
"progress": 70
}
{
"returnValue": true,
"progress": 100
}
API level 13
Deletes the specified file or directory.
Name | Required | Type | Description |
---|---|---|---|
storageType | Required | String | Indicates the storage provider. Possible values are:
Note: This method is not supported for UPnPmediaserver. |
driveId | Required | String | Indicates the drive ID. Note: The drive ID can be found by using the listStorageProviders method. |
path | Required | String | Inddicates the path of the file or directory. |
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of the operation.
|
errorCode | Optional | String | Indicates the error code for the failed operation. |
errorText | Optional | String | Indicates the reason for the failure of the operation. See the API Error Codes Reference section for details. |
Example : Remove a file from a cloud storage provider
# luna-send -n 1 -f luna://com.webos.service.storageaccess/device/remove '{
"storageType": "cloud",
"driveId": "ojydIxW8yBZUV8J3NiyNBvJn",
"path": "/SAF/test1.PNG"
}'
Response:
{
"returnValue": true
}
API level 13
Renames the specified file or directory.
Name | Required | Type | Description |
---|---|---|---|
storageType | Required | String | Indicates the storage provider. Possible values are:
Note: This method is not supported for UPnPmediaserver. |
driveId | Required | String | Indicates the drive ID. Note: The drive ID can be found by using the listStorageProviders method. |
path | Required | String | Indicates the path of the file or directory. |
newName | Required | String | Indicates the new name. |
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of the operation.
|
errorCode | Optional | Number | Indicates the error code for the failed operation |
errorText | Optional | String | Indicates the reason for the failure of the operation. See the API Error Codes Reference section for details. |
Example : Renames a file on a cloud storage provider
# luna-send -n 1 -f luna://com.webos.service.storageaccess/device/rename '{
"storageType":"cloud",
"driveId":"ojydIxW8yBZUV8J3NiyNBvJn",
"path":"/SAF/test1.PNG",
"newName":"17.PNG"
}'
Response:
{
"returnValue": true
}
API level 13
Provides a list of storages providers and the corresponding drive information.
Name | Required | Type | Description |
---|---|---|---|
subscribe | Optional | Boolean | Subscribe to get notifications. Possible values are:
|
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of the operation.
|
subscribe | Optional | Boolean | Indicates if subscribed to get notifications. |
storageProviders | Optional | Object array: storageProviders | Provides information of the storage providers. |
errorCode | Optional | Number | Indicates the error code for the failed operation |
errorText | Optional | String | Indicates the reason for the failure of the operation. See the API Error Codes Reference section for details. |
Example : Get a list of the storage providers available on the system
# luna-send -n 1 -f luna://com.webos.service.storageaccess/listStorageProviders '{"subscribe": true}'
Response:
{
"returnValue":true,
"storageProviders":[
{
"usb":[
{
"driveName":"sdg2",
"driveId":"4C531001600127113005-A7BE-1862",
"path":"/tmp/usb_rse_right/sdg2",
"fileSystem":"vfat"
},
{
"driveName":"sdg1",
"driveId":"4C531001600127113005-A6B3-2892",
"path":"/tmp/usb_rse_right/sdg1",
"fileSystem":"vfat"
}
]
},
{
"internal":[
{
"driveName":"INTERNAL",
"driveId":"INTERNAL_STORAGE",
"path":"/tmp/internal"
}
]
},
{
"cloud":[
{
"driveName":"GDRIVE",
"driveId":"ojydIxW8yBZUV8J3NiyNBvJn",
"path":"/"
}
]
}
]
}
Example : With subscription
# luna-send -i -f luna://com.webos.service.storageaccess/listStorageProviders '{"subscribe": true}'
Response:
{
"returnValue": true,
"storageProviders": [
{
"usb": [
{
"path": "/tmp/usb_guest0/sdg1",
"driveName": "sdg1",
"driveId": "4C531001460127113020-B23A-EBFD",
"fileSystem": "vfat"
}
]
},
{
"internal": [
{
"path": "/tmp/internal",
"driveName": "INTERNAL",
"driveId": "INTERNAL_STORAGE"
}
]
},
{
"cloud": [
{
"path": "/",
"driveName": "GDRIVE",
"driveId": "ojydIxW8yBZUV8J4NiyNBvJn"
}
]
}
]
}
Subscription Response:
{
"returnValue": true,
"storageProviders": [
{
"usb": []
},
{
"internal": [
{
"path": "/tmp/internal",
"driveName": "INTERNAL",
"driveId": "INTERNAL_STORAGE"
}
]
},
{
"cloud": [
{
"path": "/",
"driveName": "GDRIVE",
"driveId": "ojydIxW8yBZUV8J4NiyNBvJn"
}
]
}
]
}
Provides information of the file or directory.
Name | Required | Type | Description |
---|---|---|---|
name | Required | String | Indicates the file name. |
type | Required | String | Indicates the type of file. Possible values are:
|
path | Required | String | Inidcates the path of the file or directory. |
size | Required | String | Indicates the size in bytes. |
mimeType | Optional | String | Indicates the mime type of the file. |
Provides details of the operation.
Name | Required | Type | Description |
---|---|---|---|
type | Required | String | Indicates the type of operation. Possible values are:
|
payload | Required | Object | Details of the operation. The payload depends on the type specified. For types:
|
Arguments required for the operation in the form of key value pair
Name | Required | Type | Description |
---|---|---|---|
userName | Optional | String | User name required for mounting network storage. Default : guest |
sharePath | Required | String | Share path of samba server. |
password | Optional | String | Password required for authentication. |
ip | Required | String | IP address of network storage device. |
securityMode | Optional | String | Type of security. For example: ntlmv2, ntlmv2i, none, and so on. Default : none |
port | Optional | String | Samba server port. |
mountFlag | Optional | String | Mode of mounting. For example: ro (read-only), rw (read-write). Default : rw (read-write) |
ioCharset | Optional | String | Charset used to convert local path names. For example: utf8, and so on. Default : utf8 |
domain | Optional | String | Domain used to indicate the group. For example: workgroup. Default : workgroup |
version | Optional | String | Samba version. For example: 1.0, 2.0, 3.0, and so on. Default : 2.0 |
Provides information about the storage provider.
Name | Required | Type | Description |
---|---|---|---|
driveId | Required | String | Indicates the drive ID. Note: For internal storage the ID is INTERNAL_STORAGE. |
driveName | Required | String | Indicates the drive name. Note: For internal storage the name is INTERNAL and for cloud currently only GDRIVE (Google Drive) is supported. |
path | Required | String | Indicates the path of the drive. |
fileSystem | Optional | String | Indicates the file system type (only in case of USB). |
Error Code | Error Text | Error Description |
---|---|---|
2001 | Mount failed | Mount failed |
6006 | Cloud Not Attached | Cloud Not Attached |
6007 | Permission denied | Permission denied |
6008 | Already Authenticated | Already Authenticated |
6009 | Invalid URL | Invalid URL |
6010 | File Not Supported | File Not Supported |
8000 | Unknown error | Unknown error |
8003 | Invalid parameter | Invalid parameter |
8013 | Operation not permitted | Operation not permitted. |
8014 | No such file or directory | No such file or directory |
8015 | No such file or directory at Source | No such file or directory at Source |
8016 | No such file or directory at Destination | No such file or directory at Destination |
8017 | File exists | File exists |
9002 | USB Storage has more partition | USB Storage has more partition |
9003 | No USB Storage Exists with ID given | No USB Storage Exists with ID given |
9004 | No USB drive found | No USB drive found |
Contents