Akamai does not maintain or regulate this package. While it can be incorporated to assist you in API use, Akamai Technical Support will not offer assistance and Akamai cannot be held liable if issues arise from its use.
This library assists in the interaction with Akamai's NetStorage CMS API. The following CMS API Specs are available:
- /src - project sources
- /test - junit test cases
- /build - build and output libraries
- /doc - javadoc for class libraries
- /lib - 3rd party dependency libraries (Currenly only necessary for running unit tests)
- /example - an example app that utilizes the NetStorageKit
- Compile the sources from
/src
intobuild/classes
. - An ant
build.xml
is also provided for ease of use. Common commands are:ant compile
,ant jar
andant test
- A maven
pom.xml
is also provided for ease of use. To install:mvn install
- Both IntelliJ and Eclipse project files are available
- the destination jar file is located in build/jar
- Create an instance of the
NetStorage
object by passing in the host, username and key - Issue a command to NetStorage by calling the appropriate method from the
NetStorage
object
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
}
- A sample application has been created that can take command line parameters.
java -classpath build/classes CMS -a dir -u user1 -k 1234abcd example.akamaihd.net/1234