The HTTP Request build event handler can be used to call any HTTP endpoint. This can be used to signal other systems when the Continua CI build reaches a certain point or status. You can call any HTTP webhook or endpoint API that suits your needs, such as Slack channel messaging.
The build event handler can be set to automatically respond to any Build Events in the life-cycle of the build. This allows the HTTP endpoint to be hit at any stage of the build process.
The URL of the server that the HTTP endpoint to call exists on. Note that the Continua CI server will require access to the server, as it is responsible for running build event handlers. Please make sure that the server is accessible from the machine your Continua CI server is installed on if experiencing any connectivity issues.
The resource endpoint on the server that is to be requested. Note that this is just the pure path to the endpoint, any query strings can be added later in the query string section.
The method type to use in the request. The available options here are:
The method should match what the endpoint requires so that the correct action or resource is accessed on the server.
The format that the data sent or requested should be presented in. Note that the build event handler will attempt to parse response data in the format selected before extracting any variable values. If this parsing fails, the variable values will not be assigned.
Also some HTTP endpoints require data to be sent in specific format. If the correct format is not used then the endpoint may fail with a Bad Request response. Make sure the data format is set as required by the endpoint in question.
The context-type header will also be set based on the data format selected. For example, when selecting JSON, the context-type header will be set to application/json.
The type of authentication to use to interact with the specified endpoint. The types of authentication possible are:
The login method to use will be dependent on the endpoint in question. Some endpoints also offer token-based resource paths to alleviate the need to provide credentials.
Visible only if the 'NTLM' option is selected in the 'Authentication Type' field.
If this ticked, default credentials are used for authentication.
The username to use for basic HTTP or NTLM authentication.
Note: The username and password are base64 encoded into a basic authentication HTTP header for the request.
The password to use which matches the username listed above.
The type of parameter to send the access key token as. The valid values of Cookie, Form, Header, and QueryString determine where the authentication parameter will be placed in the request sent.
The name of the parameter for the token. This can differ for each HTTP service implementation. Check with the service in question as to what the expected parameter name is for the key token.
The access token to use for the service. This should match the access level require for the requested service.
The type of parameter to send the access key token as. The valid values of Cookie, Form, Header, and Query string determine where the authentication parameter will be placed in the request sent.
The name of the parameter for the username. This can differ for each HTTP service implementation. Check with the service in question as to what the expected parameter name is for the username.
The username of the user accessing the service. This user should have the level of access required to perform the action the HTTP request is asking for.
The name of the parameter for the password. This can differ for each HTTP service implementation. Check with the service in question as to what the expected parameter name is for the password.
The matching password for the user of the service.
The request body is where the information for the request is placed. In the case above, the request expects a JSON object called payload. The object has two properties called name and icon_emoji - each with values provided for the given request.
The values can have Continua CI variables included in them so that build information can be passed onto other systems. In the above example the text message passed onto the HTTP request includes the project name and build version number.
These parameters should be provided in <name>=<value> format. Each parameter will be added to the query string which is sent as part of the request. Adding query string parameters here means that you do not have to get the formatting correct for the HTTP query string yourself. All escaping is handled for you when using the Query string parameter entry box.
Use this to add any get/post parameters to the request. These are simple parameters that the endpoint may require or use to understand the request being made of it. These parameters should be provided in <name>=<value> format with each pair on a separate line.
Allows you to add header parameters to the request. These should be entered in the <name>=<value> format with each pair on a separate line.
Allows you to add cookie parameters to the request. These should be entered in the <name>=<value> format with each pair on a separate line.
This field allows you to extract text values from JSON or XML responses and place them into selected configuration variables. The nodes containing the required values are selected from the JSON or XML response using the JSONPath and XPath query languages.
Add any namespaces in the response XML which you are using in you XPath selectors. e.g. x=http://schemas.mycompany.org/default/
Check each of the response statuses that would mean the request has been successful. If the request returns a status that is not checked then the build event handler will report an error. If errors are to be treated as failures then the build event handler will fail the build at his point.
You can specify when the build event handler runs by linking it to a Build Event on the When To Run tab.
Select the event which triggers the tag action. You can choose one of the following Build Events:
For stage events, select the stage this applies to, or "(all stages)" to trigger the tagging action for all stages
For "On Stage Completed" and "On Build Completed", you can choose to trigger the tagging action when the build is Successful or has Failed.
Clear this option to fail if the HTTP endpoint causes a redirection.
Optionally specify the date time format used in your request body. If you leave this blank the action will attempt to parse various formats in the invariant culture.
Clear this option to run the tagging action in a separate thread if you don't care about the result eg. whether the action fails or not.
An error result will be returned if a Not Found status code is returned when using DELETE or PATCH methods. Tick this option to ignore these errors, only logging a warning to the build log. This is only available if Wait for result is ticked..
An error result will be returned if a response variable JSONPath or XPath expression does not match lease with a matching tag name is not found. Tick this option to ignore these errors, only logging a warning to the build log. This is only available if Wait for result is ticked..
Tick this to fail the build if the operation returns an error or failure. This is only available if Wait for result is ticked.
When this is ticked, Continua CI will add messages to the build log during execution of the HTTP Request build event handler. Build log messages will only be recorded if Wait for Result is ticked.