title: ServiceNow SOAP API close ticket with python
body: <p>I'm working on connecting a python script to a ServiceNow ticketing environment. Thankfully, ServiceNow has documentation on how to create a ticket from a python script, see documentation here: </p>
  
  <p><a href="http://wiki.servicenow.com/index.php?title=Python_Web_Services_Client_Examples#gsc.tab=0" rel="nofollow">http://wiki.servicenow.com/index.php?title=Python_Web_Services_Client_Examples#gsc.tab=0</a></p>
  
  <p>Here's the script I'm using to create a ticket: </p>
  
  <pre><code>#!/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)
  </code></pre>
  
  <p>However, I cannot find any good documentation on the process to resolve the ticket that I just created using the API. When I run the above script, I get the ticket number as well as the sys_id. </p>
  
  <p>Any help would be appreciated. </p>
  
  <p>Thanks. </p>