【问题标题】:ServiceNow SOAP API close ticket with python使用 python 的 ServiceNow SOAP API 关闭票证
【发布时间】:2016-02-16 20:07:49
【问题描述】:

我正在努力将 Python 脚本连接到 ServiceNow 票务环境。值得庆幸的是,ServiceNow 有关于如何从 python 脚本创建票证的文档,请参阅此处的文档:

http://wiki.servicenow.com/index.php?title=Python_Web_Services_Client_Examples#gsc.tab=0

这是我用来创建票证的脚本:

#!/usr/bin/python

from SOAPpy import SOAPProxy
import sys

def createincident(params_dict):

    # instance to send to
    instance='demo'

    # username/password
    username='itil'
    password='itil'


    # proxy - NOTE: ALWAYS use https://INSTANCE.service-now.com, not https://www.service-now.com/INSTANCE for web services URL from now on!
    proxy = 'https://%s:%s@%s.service-now.com/incident.do?SOAP' % (username, password, instance)
    namespace = 'http://www.service-now.com/'
    server = SOAPProxy(proxy, namespace)

    # uncomment these for LOTS of debugging output
    #server.config.dumpHeadersIn = 1
    #server.config.dumpHeadersOut = 1
    #server.config.dumpSOAPOut = 1
    #server.config.dumpSOAPIn = 1

    response = server.insert(impact=int(params_dict['impact']), urgency=int(params_dict['urgency']), priority=int(params_dict['priority']), category=params_dict['category'], location=params_dict['location'], caller_id=params_dict['user'], assignment_group=params_dict['assignment_group'], assigned_to=params_dict['assigned_to'], short_description=params_dict['short_description'], comments=params_dict['comments'])

    return response

values = {'impact': '1', 'urgency': '1', 'priority': '1', 'category': 'High',       
'location': 'San Diego', 'user': 'fred.luddy@yourcompany.com',  
'assignment_group': 'Technical Support', 'assigned_to': 'David Loo', 
'short_description': 'An incident created using python, SOAPpy, and web 
services.', 'comments': 'This a test making an incident with python.\nIsn\'t 
life wonderful?'}

new_incident_sysid=createincident(values)

print "Returned sysid: "+repr(new_incident_sysid)

但是,我找不到任何关于解决我刚刚使用 API 创建的票证的过程的好的文档。当我运行上面的脚本时,我得到了票号以及 sys_id。

任何帮助将不胜感激。

谢谢。

【问题讨论】:

    标签: python api soap soap-client servicenow


    【解决方案1】:

    显然这是一个旧请求,但我在这里搜索,而且还有其他 400 人,所以这是我的解决方案:

    使用server.update(sys_id="...",state="..",...) 修改您的记录并设置正确的值以“解决”它。

    对于此方法,只有 sys_id 参数是必需的,表单的其他字段由您决定。

    附: :您可以在这里找到 API - https://.service-now.com/incident.do?WSDL

    【讨论】:

      猜你喜欢
      • 2020-05-28
      • 1970-01-01
      • 1970-01-01
      • 2016-11-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多