Pushing Files
Function
This asynchronous API is used to push a file to the cloud phone file system. The file is downloaded and decompressed by the system, and then the decompressed content is pushed to the root directory of the cloud phone. Only .tar files can be pushed. You need to upload the .tar files to your OBS bucket in advance. Before calling this API, ensure that the CPH service has been authorized to operate OBS buckets. For details, see Delegating CPH to Operate OBS Buckets.
-
The management plane performance is limited. Executing ADB commands in batches on the same cloud phone server blocks the execution of other tasks on the cloud phone.
-
You can only push files up to 6 GB in an OBS bucket to cloud phones. If you push a file that exceeds 6 GB, an error message will be returned.
-
Due to restrictions of the cloud phone OS, pushing files to the system disk of a cloud phone may fail. You are advised to push files to the cloud phone data disk. When packaging a .tar file, place the file to be pushed in the data/ directory created on the local host and compress the file (for example, tar -cvf data.tar data) to ensure that the file is pushed to the data disk of the cloud phone.
URI
POST /v1/{project_id}/cloud-phone/phones/commands
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Specifies the project ID. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
Specifies the user token. It can be obtained by calling an Identity and Access Management (IAM) API. The value of X-Subject-Token in the response header is the user token. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
command |
Yes |
String |
This parameter is fixed at push. |
content |
Yes |
String |
(Only .tar files can be pushed.) Specify the .tar files in the Object Storage Service (OBS) bucket. The file name can contain a maximum of 1,024 bytes, including only letters, digits, underscores (_), dots (.), slashes (/), colons (:), and hyphens (-). File format: obs://obs-bucket-name/obs-file-path/file.tar. The file path corresponds to the object path in the OBS bucket. |
phone_ids |
No |
Array of strings |
Specifies the ID list of cloud phones. This parameter is mandatory when there is no parameter server_ids. If there is parameter server_ids, set phone_ids only. |
server_ids |
No |
Array of strings |
Specifies the ID list of cloud phone servers. This parameter is mandatory when there is no parameter phone_ids. If there is parameter phone_ids, set phone_ids only. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
request_id |
String |
Specifies the unique request ID. |
jobs |
Array of PhoneJob objects |
Specifies the task list. |
Parameter |
Type |
Description |
---|---|---|
phone_id |
String |
Specifies the unique ID of a cloud phone. This parameter is contained in tasks related to cloud phones. |
job_id |
String |
Specifies the unique ID of a task. |
error_code |
String |
Specifies the error code. |
error_msg |
String |
Specifies the error message. |
Example Requests
Pushing a file to the cloud phone file system
POST https://{CPH Endpoint}/v1/{project_id}/cloud-phone/phones/commands { "command" : "push", "content" : "obs://push-bucket/my_apps/test.tar", "phone_ids" : [ "1234567b8bab40ffb711234cb80d0234", "1678567b8bab40f93711234cb80d0764" ] }
Example Responses
Status code: 200
OK
{ "request_id" : "6837531fd3f54550927b930180a706bf", "jobs" : [ { "phone_id" : "1234567b8bab40ffb711234cb80d0234", "job_id" : "1564567b8bab40f34711234cb80d0123" }, { "phone_id" : "1678567b8bab40f93711234cb80d0764", "job_id" : "1564567b8bab40f34711234cb80d5678" } ] }
Status Codes
Status Code |
Description |
---|---|
200 |
OK |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot