Quantcast
Channel: LoadRunner Practitioners Forum topics
Viewing all articles
Browse latest Browse all 3978

Fileupload using Rest API

$
0
0

Hi

I am currently developing VU Gen script for Fileupload REST API. This functionality has no UI and we need to test API with large files up to 100 MB.

So, we used

    web_add_auto_header("businessunitid","xyz");
    
    web_add_auto_header("uid","A123");
    
    web_add_auto_header("Content-Disposition","attachment");
    
    web_add_auto_header("Content-Type","multipart/form-data");

web_submit_data("Upload",
    "Action=https://abcxyz.com/upload/x1/objects",
    "Method=POST",
     "EncType=multipart/form-data",
    "TargetFrame=",
    "RecContentType=text/html",
    "Referer=",
    "Snapshot=t5.inf",
    "Mode=HTML",
    ITEMDATA,
    "Name=File", "Value=C:\\Users\\justLR\\Desktop\\testupload.jpg", "File=yes",
    ENDITEM,
    LAST );

 

 While testing API manually using CURL command, we need to give user ID, business unit ID ( Amazon S3 bucket name, where file gets uploaded), Content DIsposition as attachment, content type as multiplat/form Data.

When we used, web_custom_request ..we are getting an error with boundary ID at multipart/form-data. But, after switching to web_submit_data..there is no error with boundary ID. But, we are getting an error while uploading file to S3 bucket. The error message in server log diplays as Error during upload: Unnecessary filed occurs. Logfie is attached to showcase the error

I would like to know if there is any issed in web_submit_data.

Regarding failed web_custom_request is

    web_add_auto_header("businessunitid","xyz");
    
    web_add_auto_header("uid","A123");
    
    web_add_auto_header("Content-Disposition","attachment");
    
    web_add_auto_header("Content-Type","multipart/form-data");

web_custom_request("upload",
"URL=https://abcxyz.com/upload/x1/objects",
"Method=POST",
"TargetFrame=",
"Resource=0",
"RecContentType=text/html",
"Snapshot=t7.inf",
"Mode=HTML",
EncType=multipart/form-data",
"BodyFilePath=C:\\Users\\justLR\\Desktop\\testupload.jpg", "File=yes"",
LAST);

 

Logfile for web_submit)data is as follows

Action.c(130): \xCA\xB1\xC8\\\x8D\xF9\x0BE\xBD\x1B\x07w \xE0b]D\xF6:g\x98R\x92\xF7V\xBE\xF7E\xA5\xFBj\xFA
Action.c(130): \xD9\xBF\xD4\xF5\xFF\x00\xDA?\xC7\x8DD\xC0\x0F\x02iZ\xAF\x8D\xE0\xE8<S\xE2\x07\x93\xC4\xB7
Action.c(130): 7z_\x85\xF4\xED\x1E\xE2\xD6\xC9\xB7CinZ\xD2\x08\xB7+\x85\x9Af\r\x9C\x87\x84\xF6\x15\xF3\xFC
Action.c(130): \xF7d\x9F\x97\x8A\xD7\xF1\xEF\xC4}[\xE2F\xA7ou\xAB\xDD\x9B\xC9\xAC\xAC\xAD\xF4\xE8H\x89#\t
Action.c(130): \x04\x11,Q T\x00aQTg\x19=I$\x93X\x126=\x7F>\xB5\x94\x9D\xDD\xCF\x170\xC5{Y\xB6\xBC\x96\xBB
Action.c(130): \xE8;\xCD\xC7'\xE9\xC6h\xA8\xB3\xF4\xEB\xDE\x8A\x93\xCB\xE7g\xFF\xD9\r\n
Action.c(130): -----------------------------7d0256b064e--\r\n
Action.c(130): t=26014ms: 541-byte response headers for "https://abcxyz.com/upload/x1/objects" (RelFrameId=1, Internal ID=12)
Action.c(130): HTTP/1.1 200 OK\r\n
Action.c(130): Cache-Control: private\r\n
Action.c(130): Pragma: private\r\n
Action.c(130): X-Powered-By: Express\r\n
Action.c(130): Content-Type: text/html; charset=utf-8\r\n
Action.c(130): Content-Length: 78\r\n
Action.c(130): ETag: W/"4e-EyOMl7AHFyABCDSEFiMDcNkU"\r\n
Action.c(130): Vary: Accept-Encoding\r\n
Action.c(130): Keep-Alive: timeout=10, max=100\r\n
Action.c(130): Connection: Keep-Alive\r\n
Action.c(130): \r\n
Action.c(130): t=26016ms: 78-byte response body for "https://abcxyz.com/upload/x1/objects" (RelFrameId=1, Internal ID=12)
Action.c(130): Status Code: ERR401 and Status Description: Error in uploading object into S3
Action.c(130): HANDLE_CLOSING" on behalf of "URL="https://abcxyz.com/upload/x1/objects" [MsgId: MMSG-27397]
Action.c(130): web_submit_data("Upload") was successful, 72 body bytes, 541 header bytes [MsgId: MMSG-26386]


Viewing all articles
Browse latest Browse all 3978

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>