Enables the authorization for Akamai's NetStorage API through environment variables and pre-request script. This code was derived from the official Akamai NetStorage Node Kit
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 arrise from its use.
- Postman
- NS4 Storage Group Provided
- NS Upload Account with API Access enabled
-
Add a new Postman Environment
-
Add the following environment variable names. Keep the names exactly the same as the pre-request script will look for those names.
acsAuthData
(keep it empty)acsAuthSign
(keep it empty)keyName
(add the upload account name under "CURRENT VALUE")key
(add the NS Upload Account API Key under "CURRENT VALUE")
- Create a new Postman Request
- Select the appropriate method (GET, POST, PUT)
- For the hostname use the NS API hostname, which should look like *-nsu.akamaihd.net
- Add the path to the folder or file
- Under Headers add the following:
X-Akamai-ACS-Action: version=1&action=upload
The action value can be modified to any of the Available Actions by NS4.X-Akamai-ACS-Auth-Data: {{acsAuthData}}
Observe we're pointing the value to the actual environment variable that will contain the value.X-Akamai-ACS-Auth-Sign: {{acsAuthSign}}
Observe we're pointing the value to the actual environment variable that will contain the value.
- Add the netstorage-api-postman.js contents under "Pre-request Script"
- Make sure the correct environment is selected from the Postman Environments pull down menu. Failure to do so will result in a
Cannot read property 'sigBytes' of undefined
error.
- Send the request.
-
Select PUT as the method.
-
The request URL path must include the name of the file to upload. In this case the file is named bundle.json
https://test-nsu.akamaihd.net/1234/bundle.json
-
In the body section select "form-data" and "File" from the KEY field. Point it to your file to upload.
For any other use case like listing a directory, deleting a file, updating a file, etc make sure to properly adjust the method, URL, body and action parameters.