Skip to content

Instantly share code, notes, and snippets.

@kuharan
Created May 1, 2021 21:08
Show Gist options
  • Save kuharan/d74d27cb8f5b29ad50b22edd7c744561 to your computer and use it in GitHub Desktop.
Save kuharan/d74d27cb8f5b29ad50b22edd7c744561 to your computer and use it in GitHub Desktop.
import requests
import json
def open_incidents_test(incident):
url = "https:/xxxx/api/koi/servicenow_incident_api/update"
payload = json.dumps({
"Incident_Update": {
"number": incident,
"state": "New",
"work_notes": "xxxx",
"additional_comments": "xxxx"
}
})
headers = {
'Authorization': 'Basic XXXX',
'Content-Type': 'application/json'
}
response = requests.patch(url, headers=headers, data=payload)
return response.text
for incident in ['INCXXXX', 'INCXXXX' 'INCXXXX']:
status = open_incidents_test(incident)
print(status)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment