For example, if your Hudson installation sits at http://deadlock.netbeans.org/hudson/, http://deadlock.netbeans.org/hudson/api/ will give you HTML lists of all available functionalities that act on the Hudson root. For example, from here you can access all the jobs on Hudson via XML/JSON.
Full Answer
How to check Hudson version?
To check the version of Hudson, load the top page and check for the "X-Hudson" response header. This contains the version number of Hudson, like "3.0.0" This is also a good way to check if an URL is a Hudson URL.
What port does Hudson listen to?
Hudson instances listen on UDP port 33848 . Whenever a UDP packet is received, it will respond with a short XML fragment that shows the connection information. This XML has the following format:
What is XML API?
The XML API supports a selection by XPath by using the query parameter ' xpath'. This is convenient for extracting information in environments where XML manipulation is tedious (such as shell script.)
What Can You Do with It?
- Remote API can be used to do things like these: 1. retrieve information from Hudson for programmatic consumption. 2. trigger a new build 3. create/copy jobs
Submitting Jobs
- For a job with no parameters, you need merely go an HTTP GET on HUDSON_URL/job/JOBNAME/build?token=TOKEN where TOKEN is set up in the job configuration. If you have parameters, you need to send JSON. Here's a snipped of shell, with a few extra newlines to be more readable.
Remote API and Security
- When your Hudson is secured, you can use HTTP BASIC authentication to authenticate remote API requests. See Authenticating scripted clientsfor more details.
Xpath Selection
- The XML API supports a selection by XPath by using the query parameter 'xpath'. This is convenient for extracting information in environments where XML manipulation is tedious (such as shell script.) See issue #626 for an example of how to use this. See .../api/ on your Hudson server for more up-to-date details. XPath exclusion Similar to the 'xpath' query parameter above, …
Detecting Hudson Version
- To check the version of Hudson, load the top page and check for the "X-Hudson" response header. This contains the version number of Hudson, like "1.358" This is also a good way to check if an URL is a Hudson URL.
Discovering Hudson on The Network
- Hudson instances listen on UDP port 33848. Whenever a UDP packet is received, it will respond with a short XML fragment that shows the connection information. This XML has the following format: By using this, a client can use a UDP broadcast to try to discover nearby Hudson instances. This is primarily useful for a self-organizing build cluster.
Summary
- Hudson provides machine-consumable remote access API to its functionalities. It comes in two built-in flavors, with an additional alternative REST module as a separate plugin: 1. XML 2. JSON with JSONP support Remote access API is offered in a REST-like style. That is, there is no single entry point for all features, and instead they are available ...
What Can You Do with It?
- Remote API can be used to do things like these: 1. Retrieve information from Hudson for programmatic consumption. 2. Trigger a new build 3. Create/copy jobs
Remote API and Security
- When your Hudson is secured, you can use HTTP BASIC authentication to authenticate remote API requests. See Authenticating scripted clients for more details.
Using Xpath
- XPath Selection
The XML API supports a selection by XPath by using the query parameter 'xpath'. This is convenient for extracting information in environments where XML manipulation is tedious (such as shell script.) Heres a simple example where we need to parse out the duration of the last suc… - XPath Exclusion
Similar to the 'xpath' query parameter above, you can use (possibly multiple) 'exclude' query patterns to exclude nodes from the resulting XML. All the nodes that match the specified XPath will be removed from the XML.
Controlling The Amount of Data You Fetch
- Sometimes the remote API doesn't give you enough information in one call. For example, if you'd like to find out all the last successful build of a given view, you'd realize that the invocation to the remote API of the view won't give you this, and you'd have to recursively call the remote API of each project to find this out. The depth control, solves this problem. To understand this feature, i…
Detecting Hudson Version
- To check the version of Hudson, load the top page and check for the "X-Hudson" response header. This contains the version number of Hudson, like "3.0.0" This is also a good way to check if an URL is a Hudson URL.
Discovering Hudson on The Network
- Hudson instances listen on UDP port 33848. Whenever a UDP packet is received, it will respond with a short XML fragment that shows the connection information. This XML has the following format: By using this, a client can use a UDP broadcast to try to discover nearby Hudson instances. This is primarily useful for a self-organizing build cluster.