Updating a recordΒΆ
The Client.resource.update()
requires a payload and a query or sys_id to perform an update.
- This method returns
pysnow.Response.one()
(dict) if the update was successful. - Refer to
Client.resource.custom()
if you want a Response object back.
Updating multiple records is not supported.
import pysnow
# Create client object
c = pysnow.Client(instance='myinstance', user='myusername', password='mypassword')
# Define a resource, here we'll use the incident table API
incident = c.resource(api_path='/table/incident')
update = {'short_description': 'New short description', 'state': 5}
# Update 'short_description' and 'state' for 'INC012345'
updated_record = incident.update(query={'number': 'INC012345'}, payload=update)
# Print out the updated record
print(updated_record)