cancel
Showing results for 
Search instead for 
Did you mean: 

Bad request' error 400 in Testcomplete POST request

SOLVED
Highlighted
Occasional Contributor

Bad request' error 400 in Testcomplete POST request

Hello,

 

I'm trying to send http POST request to a server to receive a JSON token.

I keep getting 'Bad Request' error. So far I have been unable to find out the real issue here.

There's not request payload required for this service call.  I've tried the same thing in postman/soapui, it  just works fine

 

If anyone can give me some direction here, I'd really appreciate it.

 

function httpPostRequest()
{
var address ="http://dc2-amopoclak.com:11114/services//auth"
var username = "ALPOLD"
var password = "XXXXXX"; 

  // Create the aqHttpRequest object
  var aqHttpRequest = aqHttp.CreatePostRequest(address, username, password);
  aqHttpRequest.SetHeader("Content-Type", "application/json");
  //There's not request payload for this
  var aqHttpResponse = aqHttpRequest.Send();
 if(aqHttpResponse.StatusCode == 200) { 
return true;
}else{ 
return false;
}

}

Thank you

Al

 

 

Tags (2)
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Manager

Re: Bad request' error 400 in Testcomplete POST request

Hi @Al2,

 

If you followed all the instructions from the Documentation and they didn't help, I suggest that you refer this question to the Support Team. You can reach out to them here:

https://support.smartbear.com/message/?prod=testcomplete

 
---------
Tanya Gorbunova
SmartBear Community Manager

Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today

View solution in original post

4 REPLIES 4
Highlighted
Community Manager

Re: Bad request' error 400 in Testcomplete POST request

Hi @Al2,

 

Could you please review the aqHttp.CreatePostRequest Method  article? You may need to perform some additional steps depending on the auth type.

 

BTW, why dodo you have a double slash in the URL?

http://dc2-amopoclak.com:11114/services//auth
 

 

---------
Tanya Gorbunova
SmartBear Community Manager

Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today
Highlighted
Community Hero

Re: Bad request' error 400 in Testcomplete POST request

Hi,

 

> I've tried the same thing in postman/soapui, it  just works fine

Use some recording proxy (e.g. Fiddler) to record requests sent by SoapUI and TestComplete. Compare recorded requests and make the one sent from TestComplete to match those sent from SoapUI.

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] 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. Posts made by [Community Heroes]
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.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
Highlighted
Occasional Contributor

Re: Bad request' error 400 in Testcomplete POST request

Thank you Tanya! I think I added a // by mistake while posting it here. I'm not using '//' in my code.

 

I reread this article, and the only difference I noticed evertime, my program doesn't have a request body for API call. I don't need a request body to make this POST call.

 

Thank you

Al2 

Highlighted
Community Manager

Re: Bad request' error 400 in Testcomplete POST request

Hi @Al2,

 

If you followed all the instructions from the Documentation and they didn't help, I suggest that you refer this question to the Support Team. You can reach out to them here:

https://support.smartbear.com/message/?prod=testcomplete

 
---------
Tanya Gorbunova
SmartBear Community Manager

Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today

View solution in original post

New Here?
Join us and watch the welcome video:
Announcements
Join TechCorner Challenge!
Want a fun and easy way to learn TestComplete? Try solving weekly TechCorner challenges and get into the Leaderboard!

Challenge Status

Changing options from outside of TestComplete

Participate!

How to execute remote test and obtain results via Test Runner REST API

Participate!

Comparing content of HTML table with Excel file data

Participate!

Compare HTML table with Excel file and correct data in the file

Participate!
Top Kudoed Authors