Writing files inside the guest OS

POST /v2.1/servers/{server_id}/guest-agent/file-write?path={path}

Write data to a file inside the guest OS.

The response body is empty. The command UUID is returned in the X-Guest-Agent-Command-UUID response header.

Verifying the command status via GET /v2.1/servers/{server_id}/guest-agent/commands/{uuid} is strongly recommended. A successful HTTP upload does not guarantee that all data chunks were fully written inside the guest. The final command status confirms whether the write operation completed successfully.

Request

Parameters

Name In Type Description
server_id path string The UUID of the server.
path query string Absolute path to the file inside the guest OS.

Example

# curl -ks -H 'Content-Type: application/json' -H 'X-Auth-Token: gAAAAA<...> -d @<path_to_local_file> \
https://<node_IP_addr>:8774/v2.1/servers/<server_id>/guest-agent/file-write?path='<path_inside_guest_os>'

Response

Status codes

Success

Code Reason
204 - No Content The server has fulfilled the request.

Error

Code Reason
400 - Bad Request

Some content in the request was invalid.

401 - Unauthorized

User must authenticate before making a request.

403 - Forbidden

Policy does not allow current user to do this operation.

404 - Not Found

The requested resource could not be found.

409 - Conflict

This operation conflicted with another operation on this resource.