ITOP API Python库
itoptop的Python项目详细描述
#python3的开发人员friedly itop api lib
-支持所有扩展;
-链式方法;
-使用nosql类似样式的数据操作;
-创建和更新包含查找字段的对象;
-并行方法;
##用法
>;>from itop import itop
>;>url='https://itop_server_name/webservices/rest.php'
>;>ver='1.3'
>;>usr='user'
>;>pwd='password'
>;>数据模型='path/to/data model.xml'默认为ITOP U folder/data/datamodel production.xml
\>>gt;投影=['id']
>>gt;结果=itop.organization.find(查询,投影)
'1'
insert list of person
>;>;对象列表=[
>;{'name':'name','first'name','org'name':'my company/department'},
>;{名称':'名称','名字':'其他名称','组织名称':'我的公司/部门'}
>;]
>;>>itop.person.insert(对象列表)
[
{
'电子邮件':',
'员工编号':',
'最终类别':'人员',
'名字':'名字',
'朋友姓名':'名字',
'功能':',
'id':'3',
(…)
'组织id':'1',
'组织id'friendlyname':'我的公司/部门',
'组织id'u过时标志':',
‘组织名称’:‘我的公司/部门’,
},
{
‘电子邮件’:'',
‘员工编号’:'',
‘最终类别’:‘人员’,
‘名字’:‘其他名称’,
‘友好名称’:‘其他名称’,
‘功能’:'',
‘id’:‘2’,
(…)
"组织ID":"1",
"组织ID友好名称":"我的公司/部门",
"组织ID过时标志":",
"组织名称":"我的公司/部门",
}
]
'组织名称':'我的公司/部门'}
>>>>itop.person.update(query,update,multi=true,upsert=true)
[
{
'电子邮件':',
'员工编号':',
'最终类别':'人员',
'名字':'名字',
"FriendlyName":"名字",
"功能":",
"ID":"3",
(…)
"组织ID":"1",
"组织ID友好名称":"我的公司/部门",
"组织ID过时标志":",
"组织名称":"我的公司/部门",
,
"{
"电子邮件":",
"员工编号":",
"最终类别":"人员",
"名字":"名字",
"友好名称":"其他姓名",
"功能":",
"ID":"2",
(…)
"组织ID":"1",
"组织ID友好名称":":"我的公司/部门",
"组织ID过时标志":",
"组织名称":"我的公司/部门",
}
]
'名字':'名字'})
[
{'friendlyname':'名字','id':'2'},
{'friendlyname':'名字','id':'3'}
]
pwd)
从代码为somecode的组织获取id
>;>query={'code':'somecode'}
>;>projecton=['id']
>>gt;result=itop.schema('organization).find(查询,投影)
insert list of person
>>gt;object\u list=[
>>gt;{'name':'name','first\u name','org\u id':1},
>;{'name':'name',"名字":"其他名字","组织ID":1}
>;]
>;>result=itop.schema('person')。插入(对象列表)
query={'name':'name'}
>;>;update={'first-name':'first-name','org-id':1}
>;>;result=itop.schema('person').update(query,update,multi=true,upsert=true)
result=itop.schema('person').remove({'name':'name','first戋name':'first戋name'})
\contribution
欢迎请求新功能、错误修复和建议!
许可证
gnu通用公共许可证v3(gplv3)
-支持所有扩展;
-链式方法;
-使用nosql类似样式的数据操作;
-创建和更新包含查找字段的对象;
-并行方法;
##用法
>;>from itop import itop
>;>url='https://itop_server_name/webservices/rest.php'
>;>ver='1.3'
>;>usr='user'
>;>pwd='password'
>;>数据模型='path/to/data model.xml'默认为ITOP U folder/data/datamodel production.xml
\>>gt;投影=['id']
>>gt;结果=itop.organization.find(查询,投影)
'1'
insert list of person
>;>;对象列表=[
>;{'name':'name','first'name','org'name':'my company/department'},
>;{名称':'名称','名字':'其他名称','组织名称':'我的公司/部门'}
>;]
>;>>itop.person.insert(对象列表)
[
{
'电子邮件':',
'员工编号':',
'最终类别':'人员',
'名字':'名字',
'朋友姓名':'名字',
'功能':',
'id':'3',
(…)
'组织id':'1',
'组织id'friendlyname':'我的公司/部门',
'组织id'u过时标志':',
‘组织名称’:‘我的公司/部门’,
},
{
‘电子邮件’:'',
‘员工编号’:'',
‘最终类别’:‘人员’,
‘名字’:‘其他名称’,
‘友好名称’:‘其他名称’,
‘功能’:'',
‘id’:‘2’,
(…)
"组织ID":"1",
"组织ID友好名称":"我的公司/部门",
"组织ID过时标志":",
"组织名称":"我的公司/部门",
}
]
'组织名称':'我的公司/部门'}
>>>>itop.person.update(query,update,multi=true,upsert=true)
[
{
'电子邮件':',
'员工编号':',
'最终类别':'人员',
'名字':'名字',
"FriendlyName":"名字",
"功能":",
"ID":"3",
(…)
"组织ID":"1",
"组织ID友好名称":"我的公司/部门",
"组织ID过时标志":",
"组织名称":"我的公司/部门",
,
"{
"电子邮件":",
"员工编号":",
"最终类别":"人员",
"名字":"名字",
"友好名称":"其他姓名",
"功能":",
"ID":"2",
(…)
"组织ID":"1",
"组织ID友好名称":":"我的公司/部门",
"组织ID过时标志":",
"组织名称":"我的公司/部门",
}
]
'名字':'名字'})
[
{'friendlyname':'名字','id':'2'},
{'friendlyname':'名字','id':'3'}
]
pwd)
从代码为somecode的组织获取id
>;>query={'code':'somecode'}
>;>projecton=['id']
>>gt;result=itop.schema('organization).find(查询,投影)
insert list of person
>>gt;object\u list=[
>>gt;{'name':'name','first\u name','org\u id':1},
>;{'name':'name',"名字":"其他名字","组织ID":1}
>;]
>;>result=itop.schema('person')。插入(对象列表)
query={'name':'name'}
>;>;update={'first-name':'first-name','org-id':1}
>;>;result=itop.schema('person').update(query,update,multi=true,upsert=true)
result=itop.schema('person').remove({'name':'name','first戋name':'first戋name'})
\contribution
欢迎请求新功能、错误修复和建议!
许可证
gnu通用公共许可证v3(gplv3)