Forum Discussion

Semirxbih's avatar
Semirxbih
Contributor
12 months ago

Unable to send POST request to Jenkins using aqHTTP

Hey all,

 

So I am running into some issues and need to asked the community, for some reason when I run a POST comment using Postman, all comes back correct, but when I attempt to run a POST command in TestComplete using aqHTTP, it comes back as 403.

I can't post the code here, but I have it listed here if someone might be able to assist: https://stackoverflow.com/questions/76822490/unable-to-properly-send-a-post-request-to-jenkins-via-testcomplete

8 Replies

    • Semirxbih's avatar
      Semirxbih
      Contributor

      Thanks rraghvani, I feel like my link looks correct, do you see an issue with it? That structure is required in Jenkins.

      • Semirxbih's avatar
        Semirxbih
        Contributor

        This is my link that is needed in this format: 

        https://ex:ex@ex.com/job/ex2/build?token=automation
    • Semirxbih's avatar
      Semirxbih
      Contributor

      This can not work for me:

        var credentials = aqConvert.VarToStr(dotNET.System.Convert.ToBase64String
          (dotNET.System_Text.Encoding.UTF8.GetBytes_2(username + ":" + password)));

      Because my TestComplete cannot accept dotNET, are there alternatives?

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    Your coding indicates to use some form of credentials,

    var xhr = new XMLHttpRequest();
    xhr.withCredentials = true;

     

    I think aqHttp supports basic http protocol. You might be able to set the appropriate http headers with values, but it will involve looking at xhr and seeing what http headers are being set and trying to mimic this.

    • Semirxbih's avatar
      Semirxbih
      Contributor

      Thanks for the support, for now - I was able to do it by creating my own base64encoder and that has worked, I will look into xhr.