NetStorageKit (for Java)

This library assists in the interaction with Akamai's NetStorage CMS API. The following CMS API Specs are available:

Project organization

Install

Getting Started

For example, to delete a file:

import com.akamai.netstorage.NetStorage;
import com.akamai.netstorage.DefaultCredential;

DefaultCredential credential = new DefaultCredential("example.akamaihd.net","id of your upload account", "apiKey of upload account");

NetStorage ns = new NetStorage(credential);
ns.delete("/[CP Code]/example.zip");

Other methods return an InputStream. For example, to retrieve a directory listing:

import com.akamai.netstorage.NetStorage;
import com.akamai.netstorage.DefaultCredential;
DefaultCredential credential = new DefaultCredential("example.akamaihd.net","id of your upload account", "apiKey of upload account");
NetStorage ns = new NetStorage(credential);

try (InputStream result = ns.dir("/[CP code]/1234")) {
 // TODO: consume InputStream
}

Finally, when uploading a File object can be sent or an open InputStream wll be used

import com.akamai.netstorage.NetStorage;
import com.akamai.netstorage.DefaultCredential;
DefaultCredential credential = new DefaultCredential("example.akamaihd.net","id of your upload account", "apiKey of upload account");
NetStorage ns = new NetStorage(credential);
try (InputStream result = ns.upload("/[CP code]/1234/example.zip", new File("../workingdir/srcfile.zip"))) {
 // TODO: consume InputStream
}

Sample application (CMS)

java -classpath build/classes CMS -a dir -u user1 -k 1234abcd example.akamaihd.net/1234