HTTP Basic Authentication original easy, reference document: http://zh.wikipedia.org/wiki/HTTP%E5%9F%BA%E6%9C%AC%E8%AE%A4%E8%AF%81
Use username and password: Separate, then encode with base64. Finally, the page is requested using the HTTP GET method
The following small piece of code calls Jenkins's remote API with newLISP:
[email protected]:~$./HTTP.LSP hello<freestylebuild><action><cause><shortdescription >started by upstream project "Detail_summary_pipeline" build number 3</shortdescription><upstreambuild >3</upstreamBuild><upstreamProject>detail_summary_pipeline</upstreamProject>< upstreamurl>job/detail_summary_pipeline/</upstreamurl></cause></action><action>< /action><action><buildsbybranchname><refsremotesorigindevelop><buildnumber>8</ Buildnumber><marked><sha1>8fe197b461d99b198551d9f50f3dc73cd5424c0b</sha1><branch> <sha1>8fe197b461d99b198551d9f50f3dc73cd5424c0b</sha1><name>refs/remotes/origin/develop</ name></branch></marked><revision><sha1>8fe197b461d99b198551d9f50f3dc73cd5424c0b< /sha1><branch><sha1>8fe197b461d99b198551d9f50f3dc73cd5424c0b</sha1><name>refs/ Remotes/origin/develop</name></branch></revision></refsremotesorigindevelop></buildsbybranchname>< Lastbuiltrevision><sha1>8fe197b461d99b198551d9f50f3dc73cd5424c0b</sha1><branch><sha1 >8fe197b461d99b198551d9f50f3dc73cd5424c0b</SHA1><name>refs/remotes/origin/develop</name> </branch></lastbuiltrevision><remoteurl>[email protected]:d Atawarehouse/log_ Aggregation.git</remoteurl><scmname></scmname></action><action></action> <action></action><action></action><building>false</building><duration >105297</duration><estimatedduration>95546</estimatedduration><fulldisplayname>sum_ User_query_day_cloud #8 </fullDisplayName><id>2014-10-02_11-01-53</id><keepLog>false< /keeplog><number>8</number><result>success</result><timestamp>1412218913296 </timestamp><url>http://10.100.86.22:8080/job/sum_user_query_day_cloud/8/</url><builton>slave25</builton>< Changeset><kind>git</kind></changeset></freestylebuild>
HTTP.LSP source code such as the following:
#!/usr/bin/newlisp (println "Hello") (set ' User-pass "User:pwd") (Set ' Auth (append "Authorization:basic" (Base64-enc User-pass) ("\ r \ n")) (set ' XML (Get-url "Http://your_jenkins/job/your_job/lastBuild/api/xml" auth) "(println XML) ( Exit
Note that the Get-url function is powerful, here the 5000 refers to the time-out, Auth is to put the encoded username and password in the header to send out.
newLISP HTTP Basic Authentication