查看jenkins的python api与json api,感觉两者相差不多,但还是有所区别,所以用BeyondCompare进行对比分析。
1、jenkins base url的api对比
左侧的为:http://server:port/jenkins/api/python?pretty=true
右侧的为:http://server:port/jenkins/api/json?pretty=true
2、jenkins job的api对比
左侧的为:http://server:port/jenkins/job/JOB_NAME/api/python?pretty=true
右侧的为:http://server:port/jenkins/job/JOB_NAME/api/json?pretty=true
3、jenkins build的api对比
左侧的为:http://server:port/jenkins/job/JOB_NAME/BUILD_NUMBER/api/python?pretty=true
右侧的为:http://server:port/jenkins/job/JOB_NAME/BUILD_NUMBER/api/json?pretty=true
4、jenkins view的api对比
左侧的为:http://server:port/jenkins/view/VIEW_NAME/api/python?pretty=true
右侧的为:http://server:port/jenkins/view/VIEW_NAME/api/json?pretty=true
5、jenkins nodes的api对比
左侧的为:http://server:port/jenkins/computer/api/python?pretty=true
右侧的为:http://server:port/jenkins/computer/api/json?pretty=true
从上述api不同处,可以看出python和json(JavaScript )语法有两处不同:
* Python的boolean类型的值为:True/False;json的boolean类型的值为:true/false
* Python的空值为:None;json的空值为:null