0% found this document useful (0 votes)
99 views31 pages

User Guide

Uploaded by

Rushikesh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
99 views31 pages

User Guide

Uploaded by

Rushikesh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

NetApp Authenticated File Upload

(Command Line Interface User Guide)


Version: 2.2

DOCUMENT VERSION HISTORY

Date Version Description Authors

12/05/2020 2.0 Initial Python CLI Release VenkatNaveen Bandyala


• Public APIs to upload files via NAFU Karun Suresh-Raj
• Python CLI implementation Murthy Patnaik
• Windows Executable to upload files to NetApp Saurabh Kumar
Infrastructure Chandram Magadum
Yogendra Pandhigunda

03/08/2021 2.1 Linux Executable Release VenkatNaveen Bandyala


• Added Linux Executable Specific details Chandram Magadum

08/25/2021 2.2 User Token Related Changes VenkatNaveen Bandyala


• Removed user id parameter for CLI execution Karun Suresh-Raj
• New Public APIs for token generation Saurabh Kumar
• Service Flow Changes to implement access token Chandram Magadum
and refresh token Yogendra Pandhigunda
• Enhanced CLI script with new security implementation Sandhya Ratakonda
• Enhanced Windows & Linux executables

1 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
Table of Contents
1 PURPOSE OF THIS DOCUMENT ......................................................................................................................................... 3
2 SYSTEM REQUIREMENTS.................................................................................................................................................. 3
3 STEPS TO DOWNLOAD THE SCRIPT................................................................................................................................... 3
4 INSTRUCTIONS FOR RUNNING PYTHON CLI FILE UPLOAD ................................................................................................ 3
4.1 SHORT AND LONG VERSION COMMAND LINE ARGUMENTS ........................................................................................... 4
4.2 SCRIPT EXECUTION FROM WINDOWS ............................................................................................................................. 5
4.3 SCRIPT EXECUTION FROM LINUX ..................................................................................................................................... 6
5 STEPS TO CHANGE THE CONFIGURATIONS ....................................................................................................................... 6
6 STEPS TO GENERATE THE AUTHENTICATION TOKEN ........................................................................................................ 7
7 UPLOAD A FILE USING WINDOWS EXECUTABLE ............................................................................................................... 8
8 ERROR MESSAGES .......................................................................................................................................................... 10
9 TROUBLESHOOTING STEPS ............................................................................................................................................ 13
10 API CALLS & EXECUTION FLOW .................................................................................................................................. 15
10.1 API CALLS ....................................................................................................................................................................... 15
10.2 API EXECUTION FLOW .................................................................................................................................................... 26
11 API HELP..................................................................................................................................................................... 27
12 SWAGGER DOCUMENT .............................................................................................................................................. 28

2 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
1 PURPOSE OF THIS DOCUMENT
This document covers the steps that are required to run NAFU CLI file upload python script and the steps
required to generate the authentication token (that is required to run the script).

2 SYSTEM REQUIREMENTS
Current version of CLI script supports Linux, Mac, and Windows. Please make sure python and pip3 are
installed and available in the system path.

NAFU CLI script has been verified for the following OS versions:

OS Version Python Version


Windows Windows 10 3.8.x
Linux RHEL 7 3.8.x
Mac Catalina 3.8.x

3 STEPS TO DOWNLOAD THE SCRIPT


Below are the steps to download the NetApp Authenticated File Upload CLI script from the NetApp Support Site.

i) Navigate to NetApp Support Site, and sign-in using your SSO.


ii) Search for ‘NetApp Authenticated File Upload CLI Script’ and click on ‘Download App’. The NetApp
Authenticated File Upload CLI Script description page will be displayed.
iii) Read and accept the license agreement, and then click ACCEPT & CONTINUE to download the product.
iv) Select the required version of the product to download from Client Downloads.

4 INSTRUCTIONS FOR RUNNING PYTHON CLI FILE UPLOAD


➢ Extract the zip file to a location of our choice.
Ex:
If the script is downloaded and extracted to /home/ netapp_auth_file_upload_cli_2.2, then it will have the
below file structure:
/home/ netapp_auth_file_upload_cli_2.2/netapp_auth_file_upload_cli_2.2_python

➢ Change directory to “netapp_auth_file_upload_cli_2.2_python” under extracted directory (eg: cd /home/


netapp_auth_file_upload_cli_2.2/netapp_auth_file_upload_cli_2.2_python).

3 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
➢ Run ‘python’ executable followed by the script name and input parameters

python ./nafu_auth_file_upload.py --casenumber <input value> --upload <input value>


--bugcheck <y/n> --token <input value> --log <input value> --region <input value> --debug
<input value> --override<input value> --noresume<True/False> --batchsize <0 to 100>

Where:
casenumber – An Active Technical Case Number.
upload – Full path to input file
bugcheck – To check for known bugs (applicable to core files)
token – Authentication Token (generated from NAFU Web Application)
log – File path to save logs generated during script execution
region – Nearest server name where you want to upload the file
debug – Logging level for log file
override – PMBTA password to proceed with upload after a bug is identified
noresume – To resume from a previous upload
batchsize – Batch size to upload files
api – API help

4.1 SHORT AND LONG VERSION COMMAND LINE ARGUMENTS


User can use either short or long version command line arguments. Some of the arguments are mandatory
while others are optional. Please refer to the below table for the mandatory and optional arguments list.
Argument name Short Form Long Form Mandatory Default value
(Y /N)
casenumber -c --casenumber N “”
upload -u --upload Y NA
bugcheck -b --bugcheck N “Y”
token -t --token Y NA
log -l --log N Current
directory/logs/YYYYMMDD
region -r --region N “North America (East)”
debug -d --debug N “info”
override -o --override N Depends on bug check response.
noresume -p --noresume N False
batchsize -b --batchsize N 6
apihelp -a --apihelp N NA

4 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
For example --token is a mandatory argument, whereas --casenumber is an optional argument. For optional
arguments, upload will take default values as provided in the above table.

Below are the regions that are currently supported by the tool:
"North America (West)"
"North America (East)"
"Canada"
"Europe"
"Mumbai"
“Singapore”
“Bahrain”
“Hong Kong”
“Japan”
“Australia”
“São Paulo”

Here are the different debug options supported (default is “info”):

Debug option Example


DEBUG -d debug / --debug debug
INFO -d info (default) / --debug info
WARNING -d warning / --debug warning
ERROR -d error / --debug error
CRITICAL -d critical / --debug critical

4.2 SCRIPT EXECUTION FROM WINDOWS

➢ Change directory to CLI_HOME directory (zip file extracted directory).


For example, if the downloaded zip file is extracted to c:\netapp_auth_file_upload_cli_2.2 directory, then

cd c:\netapp_auth_file_upload_cli_2.2\netapp_auth_file_upload_cli_2.2_python

➢ Below is the command to upload a file:

python nafu_auth_file_upload.py --casenumber 2007XXXXXX --upload “C:\200757xxxx.core.xxxx19xxxx.2020-11-


02.16_53_Retry.nz” ---bugcheck N --token
“eyJhbGciOxxxxxxxxxxxxxxpXVCJ9.eyJ1c2VyX2lkIjoia3NhdxxxxxxxxxxxxOjE1NTMwMDM0NzUsImV4cCI6MTU2MDc3OTQ3NX0.
BjLxxxxxxxx-icgHSWUwNxk7tS8bssxghq-xqYBHvw27kgIzu97zxFJ8Wh_xxxxxxxxxx5SUYKvLw” --log “logs\<YYYYMMDD>” –
region “North America (East)” –batchsize 8 –-debug debug

➢ Here is the sample output from the CLI script execution:

5 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
4.3 SCRIPT EXECUTION FROM LINUX

Change directory to CLI_HOME directory (zip file extracted directory).


For example, if the downloaded zip file extracted to /home/netapp_auth_file_upload_cli_2.2, then

cd /home/netapp_auth_file_upload_cli_2.2/netapp_auth_file_upload_cli_2.2_python

Below is the sample command to upload a file:

$ python nafu_auth_file_upload.py -t
"eyJhbGciOiJSUzI1NiIsInR5cCI6IXkpXVCJ9.eyJ1XXXXXXXXXXXXXXXXXXXXXXXTYwMjQ4NzkwNCwiZXhwIjoxNjEwMjYzOTA0fQ.Ifj
KNvsA65MdXTthspM4DN8zT0w" -c 2007XXXXXX -u "/home/200757xxxx.core.xxxx19xxxx.2020-11-02.16_53_Retry.nz" -d
debug -s 8 -p True -b "N"

5 STEPS TO CHANGE THE CONFIGURATIONS


Default configurations can be modified by updating the p_config.py file.
Note: Below default values are recommend leaving AS IS in the config file. These default values are tied to NAFU
back-end application.

Below is the snapshot of p_config.py configuration file.

To run with proxy, the user should assign appropriate values to the below property parameters.

PROXY_SERVER_URL = <SERVERIP>
PROXY_SERVER_PORT =<PORT>
PROXY_USER = <USERNAME>

6 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
PROXY_PASSWORD = <PASSWROD>

6 STEPS TO GENERATE THE AUTHENTICATION TOKEN


i) Go to URL https://upload.netapp.com/sg/getToken
ii) Enter NetApp email address in the email address field.
iii) Click on the ‘Generate Token’ button.
iv) An alphanumeric token will be generated as shown in the table below.
v) Pick a line item with a valid token and click the ‘Copy’ button.
vi) The token value is now copied on to the clipboard.
vii) Paste the value into a notepad or pass the value to the above script line for the --token parameter.

7 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
7 UPLOAD A FILE USING WINDOWS EXECUTABLE
User can also use windows executable to upload the files from Windows machines.

If script is downloaded and extracted to c:\ netapp_auth_file_upload_cli_2.2, then it will have below file structure:

8 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
Change directory to “netapp_auth_file_upload_cli_2.2_Win64” under extracted directory
(e.g., cd c:\netapp_auth_file_upload_cli_2.2\netapp_auth_file_upload_cli_2.2_Win64).

Argument Short Form Long Form Mandatory Default value


name (Y /N)
casenumber -c --casenumber N “”
upload -u --upload Y NA
bugcheck -b --bugcheck N “Y”
token -t --token Y NA
log -l --log N Current directory/logs/YYYYMMDD
region -r --region N “North America (East)”
debug -d --debug N “info”
override -o --override N Depends on bug check response.
noresume -p --noresume N False
batchsize -b --batchsize N 6
apihelp -a --apihelp N NA
proxyserver -g --proxyserver N NA
proxyport -k --proxyport N NA
proxyuser -x --proxyuser N NA
proxypassword -y --proxypassword N NA
(Note: User can use either short or long version arguments in the netapp_upload_cli_input.txt from the above table.)

netapp_upload_cli_input.txt needs to be updated with all the required parameters as shown in the below
screenshot.
Click on netapp_authe_file_upload_cli_2.2_Win64.exe and execute it.

--casenumber <input value> --upload <input value>


--bugcheck <y/n> --token <input value> --log <input value> --region <input value> --debug
<input value> --override<input value> --noresume<True/False> --batchsize <0 to 100>

Where:
casenumber – An Active Technical Case Number.
upload – Full path to input file
bugcheck – To check for known bugs (applicable to core files)
token – Authentication Token (generated from NAFU Web Application)
log – File path to save logs generated during script execution
region – Nearest server name where you want to upload the file
debug – Logging level for log file
override – PMBTA password to proceed with upload after a bug is identified
noresume – To resume from a previous upload
batchsize – Batch size to upload files
apihelp – API help

9 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
8 ERROR MESSAGES
Below are the CLI error messages and the description.

Error Message Description


Un-recognized arguments Invalid arguments provided while executing the script.
Token is missing. -t (or) --token is missing while executing the script.
-u (or) --upload parameter is missing while executing
Upload file name is missing. the script.
Mandatory arguments (token and upload file) are
Upload file name, Token is missing. missing
Invalid case number, please provide valid case
number! Invalid case number.
Provide complete file path for -u (or) –upload
File does not exist. Please provide a valid filepath. parameter.
Either your access token is expired or is associated
with an invalid user id.
Get the new token from
Access token is expired. https://upload.netapp.com/sg/getToken
Invalid input for debug, please enter the value
from ["INFO", "WARNING", "ERROR", "CRITICAL",
"DEBUG"]! Invalid value provided for -d (or) --debug.
Input value for bugcheck option is invalid, please
enter the values from [Y, y, N, n]! Invalid value provided for -b (or) --bugcheck
Invalid override password. Please provide valid
override password! Invalid value provided for -o (or) --override
Unable to execute the script due to invalid
batchsize. Please enter the value between 1 to
100! Invalid batch size provided for -s (or) --batchsize
Invalid value provided for -p (or) --noresume.
True /true will treat the upload as new.
False / false will check for existing file, if any file found
Invalid input for noresume, please enter the for same casenumber, filename and region then,
value from ['True'', 'False', 'true', 'false']! upload will resume from the last uploaded part.
Unable to get a (API name) response from a
server, retry after 5 minutes! Timeout during API call.
There is already an active upload session for the
file you are trying to upload. Close the terminal
with the upload in progress to continue with this
upload. If you have already done so, retry the If a file upload is already in progress from a different
upload after 5 minutes! terminal.
Network proxy server/port is required. You can update
Proxy user or port is missing! p_config.py file under conf directory.

10 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
(In case of windows executable, update
netapp_upload_cli_input.txt file)
Network proxy port is required. You can update
p_config.py file under conf directory.
(In case of windows executable, update
Proxy port is missing! netapp_upload_cli_input.txt file)
Network proxy URL/host/IP is required. You can
update p_config.py file under conf directory.
(In case of windows executable, update
Proxy url is missing! netapp_upload_cli_input.txt file)
Unable to delete the chunk file! Unable to delete the temporary chunk file.

Below are the error messages retuned from API calls.

Error Code Error Message Description


EIU001 File attachment is empty or invalid. File attachment is empty or invalid.
EIU002 Access token is missing. If token is not specified.
EIU003 File name is missing. If file name is not specified.
EIU005 File size is missing. if file size is not specified.
EIU006 Upload server name is missing. If upload server is not specified.
EIU007 Invalid case number! Please enter a valid 10- If caser number is not having 10 numeric
digit case number. digits.
EIU008 Invalid file name. Please remove special If file name contains [#$%&*@! ] special
characters [#$%&*@! ] if any. characters.
EIU009 Access token is expired. If access token is expired.

EIU010 Error occurred while validating access token. If we get any error while validating access
token.
EIU011 Invalid case number! Please enter a valid 10 If case number is invalid.
digit case number.
EIU012 Invalid PMBTA override password. If invalid PMBTA override password is
provided.
EIU013 Internal server error while executing PMBTA If any error while executing PMBTA
command. command.
EGP001 Upload ID is missing. If upload id is not specified.
EGP002 File type is missing. If file type is not specified.
EGP003 Mask file name is missing. If mask file name is not specified.
EGP004 Batch size is missing. If batch size is not specified.
EGP005 Part size is missing. If part size is not specified.
EGP006 Part numbers are missing. If part numbers are not specified.
EGP007 Part numbers are empty. If part numbers are empty.
EGP008 File name is missing. If file name is not specified.
EGP009 Invalid part numbers. If invalid part numbers specified.

11 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
EGP010 Invalid upload ID is found. If upload id is invalid.
EGP011 Access token is missing. If token is not specified.
EGP013 Access token is expired. If Access token is expired.

EGP014 Error occurred while validating access token. If any error while validating access token.

ECU001 Upload ID is missing. If upload id is not specified.


ECU002 File name is missing. If file name is not specified.
ECU003 Upload server name is missing. If upload server is not specified.
ECU004 File type is missing. If file type is not specified.
ECU005 Mask file name is missing. If masked file name is not specified.
ECU006 ETag list is missing. If ETag list is not specified.
ECU007 File merge is failed due to invalid Etags. If any error while completing upload.
ECU009 Access token is missing. If token is not specified.
ECU010 Access token is expired. If access token is expired.

ECU011 Error occurred while validating access token. If we get any error while validating token.
EFS001 Upload ID is missing. If upload id is not specified.
EFS002 Upload status operation is missing. If upload status operation is not specified.
EFS003 No file found for the given uploadId. If upload id is invalid.
EFS004 Parts completed number is missing. If parts completed is not specified.
EFS005 UploadId is not found. Failed to update upload Invalid upload id is identified while
progress status. updating status.
EFS006 Invalid request payload. If invalid request payload.
EFS008 Access token is expired. If access token is expired.
EFS009 Error occurred while validating access token. If we get any error while validating token.
EFS010 Total parts number is missing. If total parts number are not specified.
EFS011 Access token is missing. If token is not specified.
EGS001 Access token is missing. If token is not specified.
EGS003 Access token is expired. If access token is expired.

EGS004 Error occurred while validating access token. If we get any error while validating access
token.
EGT001 Missing user token, please provide one. If user token is not specified.
EGT002 Error while fetching token. If database connection error.
EGT003 Error while saving token. If database connection error.
EGT004 Error while generating token. If any error occurs while generating token.
EGT005 Token is not matching the user id, please The token provided does not match the
generate a new token and re-upload. user profile.
EGT006 Token is not matching any of the active user The token provided is not associated with
id, please generate a new token and re- any active user profile.
upload.

12 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
ERT001 Error while updating new token. If any error occurs while updating new
token to database.
ERT002 Refresh token update failed. The user token The user token and the expired access
and the expired access token are mis-matched token are mis-matched for the provided
for the given user id. Please check both the user profile.
tokens and retry the command to generate a
new access token.
ERT003 Either user token or expired access token is Either the user token or the expired access
missing, please provide both. token is missing.
ERT004 Error while generating token. If any error while generating token.
ERT005 Token is not matching any of the active user If provided token is invalid.
id, please generate a new token and re-
upload.

9 TROUBLESHOOTING STEPS
Note: For questions associated with NetApp Authenticated File Upload CLI Script, contact ng-nafu-cli-
[email protected]. Support for SDK is limited to API reference implementation. Questions will be addressed on
a ‘Best Effort’ basis.

i) If “MemoryError()” is encountered as shown in below screenshot, ensure you have enough memory space
on your system before running again

ii) Valid arguments list can be found by using -h (or) --help option while running the python script
nafu_auth_file_upload.py (use correct script file). Otherwise, below given error occurs.

iii) Below error will be shown when invalid arguments are provided. To provide valid arguments for script,
please refer README.txt (or) UserGuide.docx.

13 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
iv) If the below error is encountered, try running the same script after 5 minutes.
“Unable to get a (API name) response from a server, retry after 5 minutes!”

v) To troubleshoot script execution with more details, please use -d (or) --debug parameter.

14 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
10 API CALLS & EXECUTION FLOW
10.1 API CALLS
Below are the different API calls invoked sequentially during the file upload process. .

i) getNearestServer

Description: Get the nearest server location for the file upload.
Request URL: https://upload.netapp.com/sg/api/public/getNearestServer
Request Method: POST
Content type: application/json

Request attributes:
token (Mandatory) Type: String

Response attributes:
data Type: Array
optionsLabel Type: String
optionsValue Type: String
statusCode Type: Number
message Type: String
errorCode Type: Number
errorMessage Type: String

Sample Request:
{
"token":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9"
}

Sample Success Response:


{
"data": [
{
"optionsLabel":"North America (East)",
"optionsValue":"AMER"
},
{
"optionsLabel":"Europe",
"optionsValue":"EMEA"
}
],
"statusCode":200,
"message":"success",
"errorCode":null,
"errorMessage":null
}

15 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
Sample Failure Responses:
1) If token is not provided:
{
"statusCode": 400,
"error": "Bad Request",
"message": "Access token is missing.",
"data": null,
"errorCode": "EGS001",
"errorMessage": "Access token is missing."

ii) initiateUpload

Description: Initiates multipart upload session with a backend system.


Request URL: https://upload.netapp.com/sg/api/public/initiateUpload
Request Method: POST
Content type: multipart/form-data

Request attributes:
file (Mandatory) Type: multipart
casenumber (Optional) Type: String
token (Mandatory) Type: String
fileName (Mandatory) Type: String
site (Mandatory) Type: String
fileSize (Mandatory) Type: Number
noResume (Optional) Type: String
bugFlag (Optional) Type: String
overridePassword (Optional) Type: String
batchSize (Optional) Type: Number

Response attributes:
uploadId Type: String
maskedFileName Type: String
type Type: String
isOrphan Type: String
partSize Type: Number
batchSize Type: Number
totalParts Type: Number
statusCode Type: Number
message Type: String
errorCode Type: Number
errorMessage Type: String

Sample Request:
{
"token":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9",
"caseNumber": "2018092782",
"site": "AMER",
"fileName": "test_file_upload.txt",
"fileSize":84857600,
"batchSize":1,
"file": need small part of file attachment here as multipart
}

16 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
Sample Success Response:
{
"data": {
"uploadId":"ICq0juSM59DSKPk5rNuLg3uYGOZEKs-9HwFrG6rsl5Yehe--24Qu5X22qw",
"maskedFileName":"2018092782_23C5691Add0a41FE9839BA5a78eed3.txt",
"type":"NonCore",
"isOrphan":"N",
"partSize":84857600,
"batchSize":1,
"totalParts":1
},
"statusCode":200,
"message":"success",
"errorCode":null,
"errorMessage":null
}

Sample Resume Scenario Response:


Note: Only portion of file parts will get uploaded, if any interruption occurs while uploading the file. By providing
the E-tags file upload can be resumed.

‘Parts’ key in the below response is a combination of a part number and E-tag value respectively, separated by a
semicolon.

Below is the Sample Response:


{
"data": {
"Parts":
"1;8f4e33f3dc3e414ff94e5fb6905cba8c,2;8f4e33f3dc3e414ff94e5fb6905cba8c,3;8f4e33f3dc3e414ff94e5fb6905c
ba8c,4;8f4e33f3dc3e414ff94e5fb6905cba8c,5;8f4e33f3dc3e414ff94e5fb6905cba8c,6;8f4e33f3dc3e414ff94e5fb69
05cba8c",
"PartialUpload": "Y",
"isActiveSession": "N",
"maskedFileName": "2018092789_74C17CCD441d787FCD783D0db434ca.txt",
"uploadId": "nuUhwiK4eXSRBfu9BXfhVjgGSxvRmeVQXO2z-ZsBYR29HmZdicrtIhhaLw",
"fileType": "NonCore",
"uploadServer": "AMER",
"totalParts": 26,
"totalUploadedParts": 6,
"percentageCompleted": 23,
"uploadStatus": "InProgress",
"partSize": 20971520,
"batchSize": 15
},
"statusCode": 200,
"message": "success",
"errorCode": null,
"errorMessage": null
}

Sample Failure Responses:


1) If token is not provided:
{

17 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
"statusCode":400,
"error": "Bad Request",
"message": "Access token is missing.",
"data":null,
"errorCode":"EIU002",
"errorMessage":"Access token is missing."

}
2) If file name is not provided:

{
"statusCode": 400,
"error": "Bad Request",
"message": "File name is missing.",
"data": null,
"errorCode": "EIU003",
"errorMessage": "File name is missing."
}

iii) getPresignedUrls

Description: Get Pre-Signed URL list for the multipart file upload.
Request URL: https://upload.netapp.com/sg/api/public/getPresignUrls
Request Method: POST
Content type: application/json

Request attributes:
token: (Mandatory) Type: String
uploadId: (Mandatory) Type: String
maskFileName (Mandatory) Type: String
fileName (Mandatory) Type: String
fileType (Mandatory) Type: String
site (Mandatory) Type: String
partNums (Mandatory) Type: String
partSize (Mandatory) Type: String
batchSize (Mandatory) Type: String

Response attributes:
data Type: Array
partNum Type: Number
presignedUrl Type: String
statusCode Type: Number
message Type: String
errorCode Type: Number
errorMessage Type: String

Sample Request:
{
"token":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9",
"uploadId":"ICq0juSM59DSKPk5rNuLg3uYGOZEKs-9HwFrG6rsl5Yehe--24Qu5X22qw",
"maskFileName":"2018092782_23C5691Add0a41FE9839BA5a78eed3.txt",
"fileName":"test_file_upload.txt",
"fileType":"NonCore",

18 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
"site":"AMER",
"partNums":[
1
],
"partSize":84857600,
"batchSize":1
}

Sample Success Response:


{
"data":[
{
"partNum":1,
"presignedUrl":"https://osg-rtp-prd-clnt.dmz.netapp.com/tst-sfu-
noncore/2018092782_23C5691Add0a41FE9839BA5a78eed3.txt?AWSAccessKeyId=46ONLP12T1SLLW5NBSBO&Ex
pires=1605348977&Signature=5jWGrcQDKlwxWOaCrBUlObAhG%2Bc%3D&partNumber=1&uploadId=ICq0juSM59
DSKPk5rNuLg3uYGOZEKs-9HwFrG6rsl5Yehe--24Qu5X22qw"
}
],
"statusCode":200,
"message":"success",
"errorCode":null,
"errorMessage":null
}

Sample Failure Responses:


1) If token is not provided:
{
"statusCode": 400,
"error": "Bad Request",
"message": "Access token is missing.",
"data": null,
"errorCode": "EGP011",
"errorMessage": "Access token is missing."

}
2) If upload id is not provided:
{
"statusCode": 400,
"error": "Bad Request",
"message": "Upload ID is missing.",
"data": null,
"errorCode": "EGP001",
"errorMessage": "Upload ID is missing."
}
3) If upload id is invalid:
{
"statusCode": 400,
"error": "Bad Request",
"message": " Invalid upload ID is found.",
"data": null,
"errorCode": "EGP010",
"errorMessage": " Invalid upload ID is found."

19 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
}

iv) uploadStatus

Description: Get the file upload status for a given uploadId or update the multipart file progress in the database.
Request URL: https://upload.netapp.com/sg/api/public/uploadStatus
Request Method: POST
Content type: application/json

Scenario: Get the file upload status for a given uploadId.


Request attributes:
token (Mandatory) Type: String
uploadId (Mandatory) Type: String
operation (Mandatory) Type: String

Response attributes:
data Type: Object
uploadedPercentage Type: Number
statusCode Type: Number
message Type: String
errorCode Type: Number
errorMessage Type: String

Sample Request:
{
"token":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9",
"uploadId":"ICq0juSM59DSKPk5rNuLg3uYGOZEKs-9HwFrG6rsl5Yehe--24Qu5X22qw",
"operation":"fetch"
}
Sample Success Response:
{
"data": {
"uploadedPercentage": 0
},
"statusCode": 200,
"message": "success",
"errorCode": null,
"errorMessage": null
}

Sample Failure Responses:


1) If ‘operation’ parameter is not provided:
{
"statusCode": 400,
"error": "Bad Request",
"message": "Upload status operation is missing.",
"data": null,
"errorCode": "EFS002",
"errorMessage": "Upload status operation is missing."
}
2) If ‘operation ’ value provided other than ‘fetch’ or ‘update’:
{
"statusCode": 400,

20 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
"error": "Bad Request",
"message": "Invalid request payload.",
"data": null,
"errorCode": "EFS006",
"errorMessage": "Invalid request payload."
}
3) If upload id is not provided:
{
"statusCode": 400,
"error": "Bad Request",
"message": "Upload ID is missing.",
"data": null,
"errorCode": "EFS001",
"errorMessage": "Upload ID is missing."
}

Scenario: Update the multipart file progress in the database.


Request attributes:
token (Mandatory) Type: String
uploadId (Mandatory) Type: String
operation (Mandatory) Type: String
totalParts (Mandatory) Type: Number
partsCompleted (Mandatory) Type: Number

Response attributes:
data Type: Object
partsCompleted Type: Number
statusCode Type: Number
message Type: String
errorCode Type: Number
errorMessage Type: String

Sample Request:
{
"token":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9",
"totalParts":1,
"partsCompleted":1,
"uploadId":"ICq0juSM59DSKPk5rNuLg3uYGOZEKs-9HwFrG6rsl5Yehe--24Qu5X22qw",
"operation":"update"
}

Sample Success Response:


{
"data": {
"partsCompleted": 1
},
"statusCode": 200,
"message": "success",
"errorCode": null,
"errorMessage": null
}

Sample Failure Responses:


1) If upload id is not provided:

21 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
{
"statusCode": 400,
"error": "Bad Request",
"message": "Upload ID is missing.",
"data": null,
"errorCode": "EFS001",
"errorMessage": "Upload ID is missing."
}

2) If ‘totalParts’ parameter is not provided

{
"statusCode": 400,
"error": "Bad Request",
"message": "Total parts number is missing.",
"data": null,
"errorCode": "EFS010",
"errorMessage": "Total parts number is missing."
}
3) If ‘partsCompleted’ parameter is not provided:

{
"statusCode": 400,
"error": "Bad Request",
"message": "Parts completed number is missing.",
"data": null,
"errorCode": "EFS004",
"errorMessage": "Parts completed number is missing."
}

v) completeUpload

Description: Completes a multipart upload by merging all the uploaded parts.


Request URL: https://upload.netapp.com/sg/api/public/completeUpload
Request Method: POST
Content type: application/json

Request attributes:
token (Mandatory) Type: String
uploadId (Mandatory) Type: String
maskFileName (Mandatory) Type: String
fileName (Mandatory) Type: String
fileType (Mandatory) Type: String
site (Mandatory) Type: String
eTagList (Mandatory) Type: Array

Response attributes:
data Type: Object
statusMessage Type: String
statusCode Type: Number
message Type: String
errorCode Type: Number
errorMessage Type: String

22 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
Sample Request:
{
"token":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9",
"uploadId":"ICq0juSM59DSKPk5rNuLg3uYGOZEKs-9HwFrG6rsl5Yehe--24Qu5X22qw",
"maskFileName":"2018092782_23C5691Add0a41FE9839BA5a78eed3.txt",
"fileName":"test_file_upload.txt",
"fileType":"NonCore",
"site":"AMER",
"eTagList":[
"00257af974e00d5b394a8394550a1c3d"
]
}

Sample Success Response:


{
"data": {
"statusMessage":"Upload successful"
},
"statusCode":200,
"message":"success",
"errorCode":null,
"errorMessage":null
}

Sample Failure Responses:

1) If upload id is not provided:


{
"statusCode": 400,
"error": "Bad Request",
"message": "Upload ID is missing.",
"data": null,
"errorCode": "ECU001",
"errorMessage": "Upload ID is missing."
}
2) If Etaglist is not provided:
{
"statusCode": 400,
"error": "Bad Request",
"message": "Etag list is missing.",
"data": null,
"errorCode": "ECU006",
"errorMessage": "Etag list is missing."
}
3) If token is not provided:
{
"statusCode": 400,
"error": "Bad Request",
"message": "Access token is missing.",
"data": null,
"errorCode": "ECU009",
"errorMessage": "Access token is missing."
}

23 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
vi) generateToken

Description: This API is used to generate access token for a given user token. This access token is used across all
the APIs to perform NAFU file upload functionalities.
Request URL: https://upload.netapp.com/api/public/generateToken.
Request Method: POST
Content type: application/json

Request attributes:
token (Mandatory) Type: String

Response attributes:
data Type: Object
accessToken Type: String
statusCode Type: Number
message Type: String
errorCode Type: Number
errorMessage Type: String

Sample Request:
{
"token":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9"
}

Sample Success Response:


{
"data": {
"accessToken":" eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9CLM"
},
"statusCode":200,
"message":"success",
"errorCode": null,
"errorMessage": null
}

Sample Failure Responses:

1) If user token is invalid:


{
"statusCode": 400,
"error": "Bad Request",
"message": "Token is not matching the user id, please generate a new token and re-upload.",
"data": null,
"errorCode": "EGT005",
"errorMessage": "Token is not matching the user id, please generate a new token and re-upload."
}

2) If user token is not provided:


{
"statusCode": 400,
"error": "Bad Request",
"message": "Missing user token, please provide one and retry the command. "
"data": null,
"errorCode": "EGT001",

24 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
"errorMessage": "Missing user token, please provide one."
}

vii) refreshToken

Description: Generates new access token, if the current access token is expired for a given user token.
Request URL: https://upload.netapp.com/api/public/refreshToken.
Request Method: POST
Content type: application/json

Request attributes:
utoken (Mandatory) Type: String
rtoken (Mandatory) Type: String

Response attributes:
data Type: Object
accessToken Type: String
statusCode Type: Number
message Type: String
errorCode Type: Number
errorMessage Type: String

Sample Request:
{
"utoken":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9",
"rtoken":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9"
}

Sample Success Response:


{
"data": {
"accessToken":" eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9CLM"
},
"statusCode":200,
"message":"success",
"errorCode":null,
"errorMessage":null
}

Sample Failure Response:

1) If any of the required tokens (user token and expired access token (rtoken)) not provided:
{
"statusCode": 400,
"error": "Bad Request",
"message": "Either user token or expired access token is missing, please provide both. ",
"data": null,
"errorCode": "ERT003",
"errorMessage": "Either the user token or the expired access token is missing. Please provide both the
tokens and re-run the command to generate a new access token."
}

25 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
10.2 API EXECUTION FLOW

26 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
11 API HELP
The below are the two different ways to get details about the NetApp Authenticated File Upload public APIs.

1) From the terminal using -a or --apihelp argument.

Providing a valid Service/API name will list out all required arguments, argument types, sample request and
sample response for the requested/given API.

Below are the valid argument values:

getNearestServer
initiateUpload
getPresignedUrls
uploadStatus
completeUpload
generateToken
refreshToken
help (only for windows executable)

e.g.,
./nafu_auth_file_upload.py -a getNearestServer
(or)
./nafu_auth_file_upload.py -apihelp getNearestServer

2) Invoking help API

Request URL: https://upload.netapp.com/sg/api/public/help?serviceName=getnearestserver


Request Method: GET
Content type: application/json

Request query param attributes:


serviceName (Optional) Type: string

Note: ‘serviceName’ attribute values should be one of the following:


initiateupload
getnearestserver
getpresignurls
uploadStatus
completeupload
generatetoken
refreshtoken

Sample Request:
https://upload.netapp.com/sg/api/public/help?serviceName= getnearestserver

Sample Response:
Description: Get the nearest server location for file upload.
Request URL: https://upload.netapp.com/sg/api/public/getNearestServer
Request Method: POST

27 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
Content type: application/json
-------------------
Request attributes:
-------------------
token: (Mandatory) Type: String

Response attributes:
--------------------
data Type: Array
optionsLabel Type: String
optionsValue Type: String
statusCode Type: Number
message Type: String
errorCode Type: Number
errorMessage Type: String

Sample Request:
---------------
{
"token":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9",
}

Sample Response:
----------------
{
"data":[
{
"optionsLabel":"North America (East)",
"optionsValue":"AMER"
},
{
"optionsLabel":"Europe",
"optionsValue":"EMEA"
}
],
"statusCode":200,
"message":"success",
"errorCode":null,
"errorMessage":null
}

12 Swagger Document
• Swagger file path: netapp_auth_file_upload_cli_2.2_python/NAFU_PUBLIC_APIs_SWAGGER_DOC.txt

• Swagger file name: NAFU_PUBLIC_APIs_SWAGGER_DOC.txt

• Go to Swagger file path and open the file with name as “NAFU_PUBLIC_APIs_SWAGGER_DOC.txt” in
Notepad and copy the entire text.

28 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
• Open this swagger editor using this URL https://editor.swagger.io/ in any browser. Please refer below given
screen shot.

• Select all the text on the left side and remove/delete it. The screen looks like the below provided screenshot after
deletion.

• Copy all the text from NAFU_PUBLIC_APIs_SWAGGER_DOC.txt and paste in the left side of swagger editor as shown
in the below screen shot.

29 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
• All the APIs will be seen with the specifications on the right side of the editor.

• Click on the individual API or use the expand button from the right-side panel to view the details. Below is the
screenshot shown for the reference:

30 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
NOTE: “Try it out” functionality is currently not supported.

31 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.

You might also like