<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Remote API Archives - scmGalaxy</title>
	<atom:link href="https://www.scmgalaxy.com/tutorials/tag/remote-api/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.scmgalaxy.com/tutorials/tag/remote-api/</link>
	<description>A Platform for Software Engineers</description>
	<lastBuildDate>Sat, 27 Feb 2021 09:49:37 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1</generator>
	<item>
		<title>Jenkins Remote access API Example &#124; Jenkins Tutorial</title>
		<link>https://www.scmgalaxy.com/tutorials/jenkins-remote-access-api-example/</link>
					<comments>https://www.scmgalaxy.com/tutorials/jenkins-remote-access-api-example/#comments</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Fri, 24 Feb 2017 12:14:09 +0000</pubDate>
				<category><![CDATA[Jenkins]]></category>
		<category><![CDATA[access]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Example]]></category>
		<category><![CDATA[Jenkins Tutorial]]></category>
		<category><![CDATA[Remote]]></category>
		<category><![CDATA[Remote access API]]></category>
		<category><![CDATA[Remote API]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/2017/02/24/jenkins-remote-access-api-example/</guid>

					<description><![CDATA[<p>Jenkins Remote access API Example Jenkins provides machine-consumable remote access API to its functionalities. Currently it comes in three flavors: [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/jenkins-remote-access-api-example/">Jenkins Remote access API Example | Jenkins Tutorial</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div><img fetchpriority="high" decoding="async" class="aligncenter wp-image-3002 size-full" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2017/02/jenkins-remote-access-api-e.png" alt="jenkins-remote-access-api-example" width="600" height="400" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2017/02/jenkins-remote-access-api-e.png 600w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2017/02/jenkins-remote-access-api-e-300x200.png 300w" sizes="(max-width: 600px) 100vw, 600px" /></div>
<div></div>
<div><strong>Jenkins Remote access API Example</strong></div>
<div></div>
<div><strong>Jenkins provides machine-consumable remote access API to its functionalities. Currently it comes in three flavors:</strong></div>
<div></div>
<div>XML</div>
<div>JSON with JSONP support</div>
<div>Python</div>
<div></div>
<div>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 under the &#8220;&#8230;/api/&#8221; URL where &#8220;&#8230;&#8221; portion is the data that it acts on.</div>
<div></div>
<div>For example, if your Jenkins installation sits at http://ci.jruby.org/, visiting http://ci.jruby.org/api/ will show just the top-level API features available – primarily a listing of the configured jobs for this Jenkins instance.</div>
<div></div>
<div>Or if you want to access information about a particular build, e.g. http://ci.jruby.org/job/jruby-base/lastSuccessfulBuild/, then go to http://ci.jruby.org/job/jruby-base/lastSuccessfulBuild/api/ and you&#8217;ll see the list of functionalities for that build.</div>
<div></div>
<div><strong>Remote API can be used to do things like these:</strong></div>
<div></div>
<div>Retrieve information from Jenkins for programmatic consumption.</div>
<div>trigger a new build</div>
<div>create/copy jobs</div>
<div></div>
<div></div>
<div>Jobs with parameters, Also see Parameterized Build.</div>
<div>Simple example &#8211; sending &#8220;String Parameters&#8221;:</div>
<div>curl -X POST JENKINS_URL/job/JOB_NAME/build \</div>
<div>  &#8211;data token=TOKEN \</div>
<div>  &#8211;data-urlencode json='{&#8220;parameter&#8221;: [{&#8220;name&#8221;:&#8221;id&#8221;, &#8220;value&#8221;:&#8221;123&#8243;}, {&#8220;name&#8221;:&#8221;verbosity&#8221;, &#8220;value&#8221;:&#8221;high&#8221;}]}&#8217;</div>
<div></div>
<div><strong>Check Jenkins Job Status via REST API</strong></div>
<div></div>
<div>job_status=`curl https://jenkins/view/job/other-job/lastBuild/api/json | grep &#8220;\&#8221;result\&#8221;:\&#8221;SUCCESS\&#8221;&#8221;`</div>
<pre>if [ -n "$job_status" ] then     # Run your script commands here else   echo "BUILD FAILURE: Other build is unsuccessful or status could not be obtained."   exit 1 fi</pre>
<div></div>
<div></div>
<div><strong>How to restart Jenkins manually?</strong></div>
<div></div>
<div>To restart Jenkins manually, you can use either of the following commands:</div>
<div>(jenkins_url)/safeRestart &#8211; Allows all running jobs to complete. New jobs will remain in the queue to run after the restart is complete.</div>
<div></div>
<div>(jenkins_url)/restart &#8211; Forces a restart without waiting for builds to complete.</div>
<div></div>
<div><strong>Reference</strong></div>
<div><a href="https://wiki.jenkins-ci.org/display/JENKINS/Remote+access+API" target="_blank" rel="noopener">https://wiki.jenkins-ci.org/display/JENKINS/Remote+access+API</a></div>
<div></div>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/jenkins-remote-access-api-example/">Jenkins Remote access API Example | Jenkins Tutorial</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/jenkins-remote-access-api-example/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
