File content transfer, Upload a file (create or replace) – HP StoreAll Storage User Manual

Page 156

Advertising
background image

File content transfer

Files can be uploaded and downloaded with the normal StoreAll HTTP shares feature with WebDAV
enabled, as described in earlier sections. In addition, the API defines an HTTP DELETE command
to delete a file. The delete command is only for WebDAV enabled shares.

Upload a file (create or replace)

This command transfers the contents of a file from the client to the HTTP share. If the file identified
does not already exist on the share, it will be created. If it already exists, the contents will be
replaced with the client’s file, if allowed by the file’s StoreAll permissions and retention properties.

Upload capability exists already in the StoreAll HTTP shares feature, and it is documented here
for completeness.

File creation and replacement is subject to StoreAll permissions on the file and directory, and it is
subject to retention settings on that file system. If it is denied, an HTTP error is returned.

The HTTP command is sent in the form of an HTTP PUT request.

HTTP syntax

The HTTP request line format is:

PUT /<urlpath>/<pathname> HTTP/1.1

The file’s contents are supplied as the HTTP message body.

The equivalent curl command format is:

NOTE:

The following command should be entered on one line.

curl -T <local_pathname>

http[s]://<IP_address>:<port>/<urlpath>/<pathname>

If the urlpath does not exist, an HTTP 405 error is returned with the message (Method Not
Allowed)

.

See

“Using HTTP” (page 114)

for information about the IP address, port, and URL path.

Description

Parameter

The pathname of the file, stored on the client’s system, to be uploaded to the HTTP share.

local_pathname

The pathname to be assign to the new file being created on the HTTP share, if the file
does not yet exist. If the file does exist, the file will be overwritten. The pathname should
be specified as a relative path from the <urlpath>, including the file’s name.

pathname

Example

curl -T temp/a1.jpg https://99.226.50.92/ibrix_share1/lab/images/xyz.jpg

This example uploads the file a1.jpg, stored on the client’s machine in the temp subdirectory of
the user’s current directory, to the HTTP share named ibrix_share1.

The share is accessed by the IP address 99.226.50.92. Because it is accessed using the standard
HTTPS port (443), the port number is not needed in the URL.

The file is created as filename xyz.jpg in the subdirectory lab/images on the share. If the file
already exists at that path in the share, its contents are overwritten by the contents of a1.jpg ,
provided that StoreAll permissions and retention settings on that file and directory allow it. If the
overwriting is denied, an HTTP error is returned.

If the local file does not exist, the response behavior depends on the client tool. In the case of
curl

, it returns an error message, such as the following:

curl: can't open '/temp/a1.jpg'

156

HTTP-REST API file-compatible mode shares

Advertising