【问题标题】:Unable to fetch service now tickets using assignment_group无法使用 assignment_group 获取服务票证
【发布时间】:2019-03-21 14:11:57
【问题描述】:

我现在无法通过匹配 assignment_group 从服务中检索票证。我现在正在使用 pysnow 并使用 table api 从服务中检索票证。

下面是我的代码:

import pysnow
c = pysnow.Client(instance='myinstance', user='username', password='password')
incident = c.resource(api_path='/table/incident')

#getting the assignment group of a ticket 
print ("tickets are")
response = incident.get(query={'number': 'INC0010020'}, stream=True)
a = response['assignment_group']
print (a)

#using the same assigment group above to fetch more tickets
response = incident.get(query={'assignment_group' : a}, stream=True)
print (response.one())

我得到以下结果:

【问题讨论】:

  • 欢迎来到 StackOverflow!请在以后将错误消息添加为文本而不是图像

标签: python servicenow servicenow-rest-api


【解决方案1】:

尝试在第 2 行之后添加以下内容:

c.parameters.exclude_reference_link = True

【讨论】:

    【解决方案2】:

    您的“a”变量是一个 JSON 对象。尝试使用 a.value 使用响应时也要注意。如果响应以字符串形式出现,您可能需要使用 JSON.parse

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-11-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-03-15
      • 1970-01-01
      相关资源
      最近更新 更多