This library assists in the interaction with Akamai's NetStorage CMS API. The following CMS API Specs are available:
/src
into build/classes
.build.xml
is also provided for ease of use. Common commands are: ant compile
, ant jar
and ant test
pom.xml
is also provided for ease of use. To install: mvn install
NetStorage
object by passing in the host, username and keyNetStorage
objectFor 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
}
java -classpath build/classes CMS -a dir -u user1 -k 1234abcd example.akamaihd.net/1234