The "upload" action (NS4)
You can upload files to an ObjectStore (NS4) storage group with the "upload" action.
PUT /[CP Code]/[path]/[file.ext] HTTP/1.1 Host: [Domain Prefix]-nsu.akamaihd.net X-Akamai-ACS-Action: version=1&action=upload&[Optional action header field variables] [Signature Header 1] [Signature Header 2] [Body]
Variable values are as follows:
[CP code]: The unique CP code that represents the root directory in the applicable NetStorage Storage Group.
[path]: The complete path—including applicable subdirectories—to the file to be uploaded..
[file.ext]: The file to be uploaded (including its extension, if applicable).
[Domain Prefix]: This is the unique domain prefix set up for the storage group during its creation. It can be viewed in the NetStorage Groups UI in Control Center.
[Signature Header 1]and
[Signature Header 2]: Applicable signature headers.
[Body]: You must also include an applicable request
[Body], which is the case with any “PUT” or “POST” action.
Optional action header field variables
Along with the standard action header content, the following optional fields can be included. Each must be appended to the end of the header, prefaced by an ampersand (“&”).
index-zip=1: Include this to enable az2z processing of an uploaded “.zip” archive file, this will index the archive for use with the “Serve from Zip” feature. Serve from Zip requires each archive to have an index, and have a “.zip” extension.Note: The Serve from Zip functionality has specific usage requirements. Refer to the NetStorage - User Guide for detailed instructions.
mtime=[#]: Set the “[#]” variable as the desired modification time for uploaded content using an applicable UNIX epoch time value. If not specified, the actual upload completion time will used instead.
size=[#]: Enforce that the uploaded file is precisely “[#]” size (in bytes).
md5=[hash]: Check and enforce that the
md5sumused in the base-64-encoded-signature (for the X-Akamai-ACS-Auth-Sign signature header) matches what is specified here. This Action Header Field applies to the use of authentication encryption format "version 3". The hash must be specified in lowercase, hexadecimal notation. If this value is not specified, no content integrity checking will be performed for this version.
sha1=[hash]: Similar to the
md5=[hash]header field, but uses the SHA-1 algorithm. This Action Header Field applies to the use of authentication encryption format "version 4".
sha256=[hash]: Similar to the
md5=[hash]header field, but uses the SHA-256 algorithm. This Action Header Field applies to the use of authentication encryption format "version 5".Note: We recommend that you include the
sizeaction header field and one of the hash fields (
sha265) for added security. Also, if you include multiple hash verification headers, the server implementation must enforce at least one, but may choose to enforce multiple or all hashes present.
upload-type=[type]: Include this field to specify the upload type. The following are supported as the “
- binary: To specify a binary-encoded upload (e.g., “&upload-type=binary”)
- form: To specify a form-encoded
upload. In this case, one of two additional header fields must be included:
field-name=[X]: The upload is a multi-part form, and the content named in the field,
[X]should be targeted for the upload (for example,
field-index=[#]: The upload is a multi-part form, and the content specified in field number
[#]should be targeted for the upload (for example,
&upload-type=form&field-name=1). This field is zero-based. Use “0” as the variable value (
field-index=0) to select the first field, “1” to select the second, and so on.
upload-type=formis specified, but neither the
field-index=[#]are specified, the API will try first to resolve those by looking up options in the appropriate data structure. If these values are not located, the API will default to the first form input field (index “0”).