How to upload test result from TestComplete to QAComplete using POST request.
How to upload test result from TestComplete to QAComplete using POST request. I'm planning to upload the .mht file from TestComplete result to QAComplete. This is my code to upload the file but it didnt work.
var url4 = 'https://qacomplete.smartbear.com/rest-api/service/api/v2/projects/(projID)/testruns/' + runID +'/items/' + itemId +'/report';
var value = Bytes();
var files = '{"file":'+ value +'}';
var aqHttpRequest4 = aqHttp.CreatePostRequest(url4,username,password);
aqHttpRequest4.SetHeader("Content-Type", "application/json");
var aqHttpResponse4 = aqHttpRequest4.Send(files);
if(aqHttpResponse4.StatusCode == "200"){
Log.Message(aqHttpResponse4.Text);
} else {
Log.Error("Error");
}
I'm getting this error when I run the code.
Response status text: InternalServerError Response body: {"errors":[{"message":"Index was outside the bounds of the array.","code":0}]} All response headers: Cache-Control: private Date: Fri, 13 Jul 2018 07:37:07 GMT Content-Length: 78 Content-Type: application/json; Charset=UTF-8 Server: Microsoft-IIS/8.5 X-Powered-By: ServiceStack/3.960 Win32NT/.NET X-AspNet-Version: 4.0.30319 X-Powered-By: ASP.NET X-ServerName: app22 X-Powered-By: ARR/3.0 X-Powered-By: ASP.NET X-ServerName: gw1
Response body:
{"errors":[{"message":"Index was outside the bounds of the array.","code":0}]}
All response headers:
Cache-Control: private
Date: Fri, 13 Jul 2018 07:37:07 GMT
Content-Length: 78
Content-Type: application/json; Charset=UTF-8
Server: Microsoft-IIS/8.5
X-Powered-By: ServiceStack/3.960 Win32NT/.NET
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
X-ServerName: app22
X-Powered-By: ARR/3.0
X-Powered-By: ASP.NET
X-ServerName: gw1
Any idea?
Thanks in advance.
Jeff