1

I am unable to retrieve tickets from service now by matching assignment_group. I am using pysnow and using table api to retrieve ticket from service now.

Below is my code :

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())

I get the below result :

enter image description here

Alain Merigot
  • 10,667
  • 3
  • 18
  • 31

2 Answers2

0

Try adding the following after line 2:

c.parameters.exclude_reference_link = True
giles3
  • 465
  • 2
  • 9
0

your 'a' variable is a JSON object. Try using a.value Also be mindful when using the responses. you may need to use JSON.parse if the response comes as a string

LahiruK717
  • 47
  • 7