cancel
Showing results for 
Search instead for 
Did you mean: 

Rest API Request is empty

Highlighted
Occasional Contributor

Rest API Request is empty

Dear all,

 

this is a repeated question with some more things to ask,

I have been working with the integration of TestComplete with YouTrack.

so far i have been successful with creating a new issue in youtrack through a test run from testcomplete.

however, the issue i am still facing is uploading the attachment along with creating the issue.

any help would be great.

the aqHttpRequest.set header has no effect in the response when checked in the log message.

why is my request not being effected?

also the user name and password is not working as well it creates the issue as aguest user even when i am giving it the user name and password.

below is my code:

 

function httpPostRequest()
{
project=ABC&summary=new+issue&description=description+of+new+issue";
var address = "http://URL/rest/issue?project=ABC&summary=new+issue&description=Description+of+new+issue&attachment=D:\\Newfolder\\b.jpg";
var username = "user@abc.com";
var password = "userabc";

var requestBody = '1';

var aqHttpRequest = aqHttp.CreatePostRequest(address, username, password);

aqHttpRequest.SetHeader("Content-Type", "application/json");
var aqHttpResponse = aqHttpRequest.Send()

Log.Message(aqHttpResponse.StatusCode); // A status code 
Log.Message(aqHttpResponse.Text); // A body

aqHttpResponse.SaveToFile("D:\\Postbody.txt");

}

 

this creates the issue but does'nt upload the attachment.

2 REPLIES 2
Community Hero

Re: Rest API Request is empty

Hi,

 

May I wonder why your code is exactly like provided? Why/what were your reasons to write exactly this but not some other code?

I think that the correct way is like this:

-- Either investigate YouTrack documentation, figure out requests that must be sent to the YouTrack server in order to create an issue and provide it with an attachement, and then try to implement these requests in TestComplete; or

-- If YouTrack provides some sort of web interface or application that communicates with the server via HTTP protocol, you may use some recording proxy (e.g.: Fiddler, LoadComplete, JMeter, ...) and record the traffic generated while creating an issue and sending an attachment. Then you will have to analyse the traffic, parameterize it and, again, try to implement it with TestComplete.

 

P.S. I may provide you with my opinion of why things that you've mentioned do not work. But without knowing details of how your instance of YouTrack is set up and without knowing its web API this will be just a useless wild guess.

 

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Postings made by [Community Expert Group] members
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================
Community Hero

Re: Rest API Request is empty

Hi!

 

First of all check, how you have resolved the authorization schema. YouTrack recommends to use a Token Authorization >> 

That means you should use a token for each API call

New Here?
Join us and watch the welcome video:
Watch the new Interview