You need a header for the [Body] component

In difference to all other PUT/POST calls, you need to include "non-empty" header content to serve as the [Body] for an "upload" action.

This can be accomplished using either the Content-Length or Transfer-Encoding: chunked headers, and providing the appropriate information.

You can use the Content-Length header

If you intend to include this header, you must include the appropriate size of the upload. Using this header, the request should look like this:

PUT /[CP Code]/[path]/[file.ext] HTTP/1.1 
Host: [Domain Prefix]-nsu.akamaihd.net 
X-Akamai-ACS-Action: version=1&action=upload&md5=atend&mtime=atend 
[Signature Header 1]
[Signature Header 2]
Content-Length: [size in bytes]

You can use the Transfer-Encoding: chunked header

If you intend to include this header, the request should look like this:

PUT /[CP Code]/[path]/[file.ext] HTTP/1.1 
Host: [Domain Prefix]-nsu.akamaihd.net 
X-Akamai-ACS-Action: version=1&action=upload&md5=atend&mtime=atend 
[Signature Header 1]
[Signature Header 2] 
Transfer-Encoding: chunked

The Transfer-Encoding: chunked header and using "chunk trailers"

When using this format, some optional action header field variables can be specified as a "chunked trailer" to be sent after upload of the object:

  • MD5=[hash]
  • SHA1=[hash]
  • SHA265=[hash]
  • mtime=[#]

To accomplish this, perform the following:

  1. Specify the value atend in the initial X-Akamai-ACS-Action header for all of the optional action header fields you wish to include.
  2. Send the body, and then re-send exactly the same X-Akamai-ACS-Action header at the end of the request, but include applicable values for each Optional Action Header Field.
  3. Finally, the Signature Headers must be recomputed and re-sent as chunk trailers.

Example of use

Below is an example of this complete HTTP request (in which the md5 and mtime optional action header fields for the "upload" action are used).

PUT /[CP Code]/[path]/[file.ext] HTTP/1.1 
Host: [Domain Prefix]-nsu.akamaihd.net 
X-Akamai-ACS-Action: version=1&action=upload&md5=atend&mtime=atend 
Transfer-Encoding: chunked 
[Signature Headers] 
[Chunked PUT Body] 
0 
X-Akamai-ACS-Action: version=1&action=upload&md5=0123456789abcdef0123456789abcdef&mtime=1260000000 
[Recomputed Signature Headers]

The Signature Headers' authentication timestamp enforcement is relaxed here to account for potential transfer buffering and/or transfer latencies. Any time between the timestamp in the initial request, and the time this header is actually received, plus 30 seconds is accepted.

Note: The chunk trailer is sent after upload of the object.