Highlighted
Respected Contributor.
Respected Contributor.
1668 views

Error in REST API call to upload script to PC

Jump to solution

Getting error in uploading Vugent script to PC via PC REST API

 

web_add_header("Authorization", "Basic bqweddqc3RlcjpDcm93bjIwMDk=");
    web_rest("PCS-SignIn",
        "URL=http://{PCSERVER}/LoadTest/rest/authentication-point/authenticate",
        "Method=GET",
        HEADERS,
          "Name=Authorization", "Value=Basic bqweddqc3RlcjpDcm93bjIwMDk=",
        ENDHEADER,
        LAST);
       
       
       web_add_header("Content-Type", "multipart/form-data");
       
    web_submit_data("AddAttachment.aspx",
        "Action=http://{PCSERVER}/LoadTest/rest/domains/testdomain/projects/test/Scripts/",
        "Method=POST",
        "EncType=multipart/form-data",
        "RecContentType=multipart/form-data",
        "Snapshot=t7.inf",
        "Mode=HTML",
        ITEMDATA,
        "Name=ProductAPIv3.1", "Value=C:\\temp\\SearchAPIv7.3.zip", "File=yes", ENDITEM,
        "Name=", "Value=<Script xmlns\=\"http://www.hp.com/PC/REST/API\"><TestFolderPath>Subject\Temp</TestFolderPath><Overwrite>true</Overwrite><RuntimeOnly>true</RuntimeOnly></Script>", ENDITEM,
    LAST);

 

Response:

Action.c(24): t=4930ms: 152-byte response body for "http://pctrappprodvh2/LoadTest/rest/domains/PROJECTS/projects/WEB2/Scripts/" (RelFrameId=1, Internal ID=2)
Action.c(24): <Exception xmlns="http://www.hp.com/PC/REST/API">\r\n
Action.c(24): <ExceptionMessage>Operation failed.</ExceptionMessage>\r\n
Action.c(24): <ErrorCode>1001</ErrorCode>\r\n
Action.c(24): </Exception>
Action.c(24): Error -26612: HTTP Status-Code=500 (Internal Server Error) for "http://pctrappprodvh2/LoadTest/rest/domains/PROJECTS/projects/WEB2/Scripts/" [MsgId: MERR-26612]

 

Let me know, if anyone has working sample to upload script via REST API call?

 

Thanks

 

 

0 Likes
1 Solution

Accepted Solutions
Highlighted
Respected Contributor.
Respected Contributor.

Thanks. Appreciated. We did try with Jmeter script and used in Jenkins. Its working fine. 

View solution in original post

10 Replies
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Please check this post.

0 Likes
Highlighted
Respected Contributor.
Respected Contributor.

I tried instructions/sample given in the post. Still getting same error. Its not clear whats the value for boundary and error code is same without proper details on why its failing. So could not identify the root cause for failure 

0 Likes
Highlighted
Micro Focus Contributor
Micro Focus Contributor

Hi,

Please use this code (the values to be changed are bolded).

web_submit_data("UploadScript", 
                        "Action=http://{PCS}/LoadTest/rest/domains/{Domain}/projects/{Project}/Scripts",
                        "Method=POST", 
                        "EncType=multipart/form-data;",
                        "TargetFrame=", 
                        "RecContentType=text/html", 
                        "Referer=", 
                        "Snapshot=t2.inf", 
                        "Mode=HTML", 
                        ITEMDATA, 
                                    "Name=xml",                    
                                    "Value=<Script xmlns=\"http://www.hp.com/PC/REST/API\"><TestFolderPath>Subject\\_PCoE_Scripts_New</TestFolderPath><Overwrite>true</Overwrite><RuntimeOnly>true</RuntimeOnly><KeepCheckedOut>false</KeepCheckedOut></Script>",
                        ENDITEM, 
                                    "Name=zippedscript",                    
                                    "Value=test.zip",
                                    "File=Yes", 
                                    "FilePath=C:\\ScriptToUpload\\test.zip",
                                    "ContentType=application/x-zip-compressed",               // value in Content-Type parameter of multipart message
                        ENDITEM, 
    LAST);

 

Highlighted
Respected Contributor.
Respected Contributor.

Thanks Dovi Shulemzon.

Its working. Is there any way i can pass the GIThub path to script zip file (https://github.com/USER/testscript.git) as argument for FilePath? if so how do i pass url as filepath?

 

 

 

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Hi Senyam,

There isn't. You will have to retrieve the script from Github first and then upload it to Performance Center.

Regards,

Shlomi

0 Likes
Highlighted
Respected Contributor.
Respected Contributor.

Thanks

0 Likes
Highlighted
Respected Contributor.
Respected Contributor.

 Dovi Shulemzon,

Do u have sample to do the same using powershell script as we are trying to automate script upload from jenkins?. Thanks

0 Likes
Highlighted
Respected Contributor.
Respected Contributor.

Looking for XML(multi part with meta data and script content) to be used in REST API call when we call using powershell or any client other than Vugen

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Hi,

You can use any client you want. We do not have an example using Powershell. However, it should be easy to run the VuGen script from command line using mdrv.exe. See this help page for more details.

Regards,

Shlomi

 

0 Likes
Highlighted
Respected Contributor.
Respected Contributor.

Thanks. Appreciated. We did try with Jmeter script and used in Jenkins. Its working fine. 

View solution in original post

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.