cancel
Showing results for 
Search instead for 
Did you mean: 

Bad request' error 400 in Testcomplete POST request

SOLVED
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

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

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

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️

View solution in original post

4 REPLIES 4
Highlighted
Community Manager

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

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Highlighted
Community Hero

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

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

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

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️

View solution in original post

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors