Child pages
  • HTTP Request Plugin
Skip to end of metadata
Go to start of metadata

Plugin Information

View HTTP Request on the plugin site for more information.

This plugin sends a http request to a URL with some parameters

This plugin was made to dispatch an action calling a URL. It could be useful to integrate (call-out to) some kind of systems or process.

Basically it executes a request to a URL with the build parameters.

The request is made as a job execution in Jenkins and depending of the HTTP response the job could be marked as failed (configurable). For example responses such as 404, 500 could make the job fail. When a job fails it will log the response to help identify the problem.

The request may be as an HTTP GET or POST mode, by choosing the http mode. If it was not informed it will use the default from global settings witch the default is POST.  

Configure Global Settings

Configure Build Step in your Jenkins job

HTTP Request Parameters

Parameters are escaped which means if you try to pass another value inside a value, it will not happen.

In the example below, the key "name" will be passed with a value of "jenkins&os=linux". Note that "os" is not a parameter - it is part of the value). At the HTTP server-side no parameter named "os" will exist. 

Every execution will log all parameters. Be careful to not pass privates information such as passwords or personal information.  

Change Log

https://github.com/jenkinsci/http-request-plugin/releases

21 Comments

  1. Hi - This is a useful plugin, requiring a minor enhancement:

    Please provide the ability to use Jenkins environment variables in the HTTP Request 'URL' field.

    For example - "http://my.server.name/tools/someScript.cgi?build=$BUILD_NUMBER".

    This would require that your code parses the URL string field and replace the Jenkins environment variables with their values before converting it into a URL.

    Also - please update the 'Source Code - GitHub' link in the Plugin Information table above - the link is currently 404.

    1. Sorry I only see this now.

      Thank you for sugestions. As soon I'll implement it

  2. Is there a way to pass additional json or xml content in the body of the POST?

  3. Is there any way to pass json as the Post data using this plugin?

  4. I have selected the Basic/Digest Authentication option and I am expecting that the Authorization header to be sent.  But it isn't.  What am I doing wrong?

    Also, installing this plugin is not smooth.  So far on three different occasions jenkins has not restarted cleanly after installation:  Jenkins ver. 1.532.2

    Further I cannot delete the configuration from jenkins configuration page.

    So far it would be really hard to recommend this plugin...

  5. Hello friend.

    Is there any way to get information for a form field by one selector? In my case, I need to get information from a hidden field (antiforgery token).

    Thanks!

  6. Hey there,

    This plugin is great... it lacks however a way to customize HTTP failure codes... I would rather have a 200 success code or a way to configure other failure codes not in the 4/5x range... for example, I am getting 102 error code (connection refused). Could you please extend the plugin to allow for other http codes that should be considered as failures? Here is an example:

    FATAL: Connection to [http://....my-url.com...]... refused

    org.apache.http.conn.HttpHostConnectException: Connection to [http://...my-url.com....]... refused

    at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:190)

    at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:294)

    at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:640)

    at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:479)

    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)

    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)

    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:784)

    at jenkins.plugins.http_request.util.HttpClientUtil.execute(HttpClientUtil.java:103)

    at jenkins.plugins.http_request.HttpRequest.perform(HttpRequest.java:126)

    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)

    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:761)

    at hudson.model.Build$BuildExecution.build(Build.java:199)

    at hudson.model.Build$BuildExecution.doRun(Build.java:160)

    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:536)

    at hudson.model.Run.execute(Run.java:1718)

    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)

    at hudson.model.ResourceController.execute(ResourceController.java:89)

    at hudson.model.Executor.run(Executor.java:240)

    Caused by: java.net.ConnectException: Connection timed out

    at java.net.PlainSocketImpl.socketConnect(Native Method)

    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)

    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)

    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)

    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)

    at java.net.Socket.connect(Socket.java:579)

    at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:127)

    at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:180)

    ... 17 more

  7. Fixed the issue noted above and added a few more features. Feel free to integrate the change back into the main master :)

  8. Is it possible to use this is post build task?  I want to call a url after the artifacts have been archived.

  9. I have just installed this plugin locally on my laptop to test out.  I did get it to work with siteminder authentication.  However, I may not be doing it correctly or would like an enhancement.  I have set up form authentication in Jenkins Configuration.  With form authentication, one of the fields that needs to be posted is the PASSWORD input field.  As of right now the only way I can get this to work is to add it as a parameter on the global configuration and the the value is visible.  I have also tried using a global password set up in the Jenkins Configuration page also via the Mask Password Plugin and then referencing it as $g_password or even ${g_password).  

    But the better place to have it as a build parameter on the job page along with the USER input field.  Then the user can enter both as a build parameters when submitting the job.  If using the Mask Password plugin, then set it up as a password parameter and its value will be hidden from the output.   I did try setting up this password parameter and check of pass build parameters to url, but in a POST, the PASSWORD field is not a parameter.  POST input field parameters are I believe in the request body. 

    Hope this makes sense what I am asking how to do or maybe as an enhancement.

  10. Please add licence to  plugin, we are unable to download due to missing licensing information.

  11. Hi Thanks for the great plugin. However could you please fix the following: When I go to advanced options an empty key-value pair is added to custom headers. This then makes the request invalid. The only solution is to specify a valid header.

  12. Hi Again. Another problem is that with POST method build parameters are not passed onto the URL. If I try GET method, parameters are passed, but with POST they are not included in the URL. Could you please fix this?

  13. I am trying to use this plugin to activate and deactivate Pingdom checks.

    I have a simple request with a couple of parameters and headers.

    The system is returning this error:FATAL: org.apache.http.impl.conn.SchemeRegistryFactory.createSystemDefault()Lorg/apache/http/conn/scheme/SchemeRegistry;
    java.lang.NoSuchMethodError: org.apache.http.impl.conn.SchemeRegistryFactory.createSystemDefault()Lorg/apache/http/conn/scheme/SchemeRegistry;
    at org.apache.http.impl.client.SystemDefaultHttpClient.createClientConnectionManager(SystemDefaultHttpClient.java:118)
    at org.apache.http.impl.client.AbstractHttpClient.getConnectionManager(AbstractHttpClient.java:445)
    at jenkins.plugins.http_request.util.HttpClientUtil.doSecurity(HttpClientUtil.java:135)
    at jenkins.plugins.http_request.util.HttpClientUtil.execute(HttpClientUtil.java:105)
    at jenkins.plugins.http_request.HttpRequest.perform(HttpRequest.java:207)
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
    at hudson.model.Build$BuildExecution.build(Build.java:205)
    at hudson.model.Build$BuildExecution.doRun(Build.java:162)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:537)
    at hudson.model.Run.execute(Run.java:1744)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:374)

  14. I request for an option to enter integer drop down or input value for Retry attempt. Sometimes the post or get url is not successful in the first attempt. I want the plugin to give me the option to retry request attempt 'X' number of times.

    This way i can be sure of the url not working & take necessary action on the build job

  15. The plugin is great. I hit Illegal character issue when using it, would you please help me check whether I miss something.

    The index 100 refer to the '\' after the 'Root'Caused by: java.net.URISyntaxException: Illegal character in query at index 100: https://**.eng.**.com:8443/QCIntgrt/rest/***/test-sets?folderPath=Root\test\hello

  16. The plugin is great. I hit Illegal character issue when using it, would you please help me check whether I miss something.

    The index 100 refer to the '\' after the 'Root'Caused by: java.net.URISyntaxException: Illegal character in query at index 100: https://**.eng.**.com:8443/QCIntgrt/rest/***/test-sets?folderPath=Root\test\hello

    1. I get the root cause that changing \ to %5C would resolve the issue.

  17. Can the 'Open Issues' link be fixed please? It is looking for http_request-plugin but the component seems to be named 'http-request-plugin'

    The page displays: The value 'http_request-plugin' does not exist for the field 'component'.

     

  18. hi. I need a help. Im using this plugin to make a post in a openstack request to receive an authorization token. I could make this operation in postman in my laptop and in a shell, using curl. But when I use this plugin, I receive the body response but I do not receive the headers response, one of the is the token (x-large string). Thx !

  19. Is there a way to send keepalives using this plugin?

    Background of this question:
    When using this plugin with a DELETE request that takes over 300 seconds the client (running on Windows) resets the connection when the response finally arrives and the httpRequest call keeps waiting forever, or fails with a '408 Request Timeout' when the timeout parameter is added.
    A DELETE request sent with curl does not have this problem.
    tcpdump shows that curl sends keepalives every 60 seconds which this plugin does not send.

Write a comment…