Forum Discussion

Al2's avatar
Occasional Contributor
5 years ago

Bad request' error 400 in Testcomplete POST request



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 =""
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;
return false;


Thank you




4 Replies

  • TanyaYatskovska's avatar
    SmartBear Alumni (Retired)

    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?


    • Al2's avatar
      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


  • AlexKaras's avatar
    Champion Level 3



    > 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.