Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 8e88ff8e73f164c954698cc57c4302b43fe9218b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<!-- **************************************************************************
#
# Copyright  (c) 2004-2013 Oracle Corporation.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors: 
#
#    Kohsuke Kawaguchi, Duncan Mills
#        
#
#************************************************************************** --> 


<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:i="jelly:fmt">
  <h2>Example API calls for a Hudson Server</h2>
  <h3>Create Job</h3>
  <p>
    To create a new job, <strong>POST </strong>  <tt>config.xml</tt> to <tt>http://your_server/<b>createItem</b></tt> (<a href="../createItem">copy url</a>) with
    query parameter <tt>name=<i>JOBNAME</i></tt>.<br/>
    You'll get 200 status code if the creation is successful,
    or 4xx/5xx code if it fails. <tt>config.xml</tt> is the format Hudson uses to store the job
    in the file system, so you can see examples of them in <tt>${app.rootDir}</tt>.
  </p>

  <h3>Copy Job</h3>
  <p>
    To copy a job, send a <strong>POST</strong> request to <tt>http://your_server/<b>createItem</b></tt> with
    three query parameters:<br/>
     <tt>name=<i>NEWJOBNAME</i>&amp;mode=copy&amp;from=<i>FROMJOBNAME</i></tt>
  </p>

  <h3>Build Queue</h3>
  <p>
    Build queue has its own separate API: <tt>http://your_server/<b>queue/api/</b>[xml|json]</tt> 
     (<a href="../queue/api/xml">try it now!</a>).
  </p>
  
  <h3>Load Statistics</h3>
  <p>
    Overall load statistics of Hudson has its own separate API 
    <tt>http://your_server/<b>overallLoad/api/</b>[xml|json]</tt> <a href="../overallLoad/api/xml">(try it now!)</a>.
  </p>

  <h3>Restarting Hudson</h3>
  <p>
    Hudson will enter into the "quiet down" mode by sending a <strong>GET</strong> request
    to <tt>http://your_server/<b>quietDown</b></tt> (<a href="../quietDown">do it now</a>).
    You can cancel this mode by sending a request to <tt>http://your_server/<b>cancelQuietDown</b></tt> 
     (<a href="../cancelQuietDown">do it now</a>).<br/> 
    On environments where Hudson can restart itself (such as when Hudson is installed as 
    a Windows service), <strong>POST</strong>ing to <tt>http://your_server/<b>restart</b></tt> 
     (<a href="../restart">copy url</a>) will start the restart sequence, or <tt>http://your_server/<b>safeRestart</b></tt>
     (<a href="../safeRestart">copy url</a>) to restart once no jobs are running.<br/>
    All these URLs need the admin privilege to the system.
  </p>
</j:jelly>

Back to the top