Skip to content

Commit b6937f5

Browse files
Updating outdated code examples.
1 parent 1497300 commit b6937f5

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

README.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,28 +27,34 @@ This library assists in the interaction with Akamai's NetStorage CMS API. The fo
2727
For example, to delete a file:
2828
```
2929
import com.akamai.netstorage.NetStorage;
30+
import com.akamai.netstorage.DefaultCredential;
3031
31-
NetStorage ns = new NetStorage("example.akamaihd.net", "user1", "1234abcd");
32-
ns.delete("/1234/example.zip");
32+
DefaultCredential credential = new DefaultCredential("example.akamaihd.net","id of your upload account", "apiKey of upload account");
33+
34+
NetStorage ns = new NetStorage(credential);
35+
ns.delete("/[CP Code]/example.zip");
3336
```
3437

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

3740
```
3841
import com.akamai.netstorage.NetStorage;
39-
NetStorage ns = new NetStorage("example.akamaihd.net", "user1", "1234abcd");
42+
import com.akamai.netstorage.DefaultCredential;
43+
DefaultCredential credential = new DefaultCredential("example.akamaihd.net","id of your upload account", "apiKey of upload account");
44+
NetStorage ns = new NetStorage(credential);
4045
41-
try (InputStream result = ns.dir("/1234")) {
46+
try (InputStream result = ns.dir("/[CP code]/1234")) {
4247
// TODO: consume InputStream
4348
}
4449
```
4550

4651
Finally, when uploading a `File` object can be sent or an open `InputStream` wll be used
4752
```
4853
import com.akamai.netstorage.NetStorage;
49-
50-
NetStorage ns = new NetStorage("example.akamaihd.net", "user1", "1234abcd");
51-
try (InputStream result = ns.upload("/1234/example.zip", new File("../workingdir/srcfile.zip"))) {
54+
import com.akamai.netstorage.DefaultCredential;
55+
DefaultCredential credential = new DefaultCredential("example.akamaihd.net","id of your upload account", "apiKey of upload account");
56+
NetStorage ns = new NetStorage(credential);
57+
try (InputStream result = ns.upload("/[CP code]/1234/example.zip", new File("../workingdir/srcfile.zip"))) {
5258
// TODO: consume InputStream
5359
}
5460
```

0 commit comments

Comments
 (0)