def createServiceNowClient(container, username, password): client = ServiceNowClient.create_client(container, username, password) return client
print "No server provided." sys.exit(1) if tableName is None: print "No tableName provided." sys.exit(1) if sysId is None: print "No sysId provided." sys.exit(1) if content is None: print "No content provided." sys.exit(1) snClient = ServiceNowClient.create_client(servicenowServer, username, password) print "Sending content %s" % content try: data = snClient.update_record( tableName, sysId, content ) print "\n" print snClient.print_record( data ) except Exception, e: exc_info = sys.exc_info() traceback.print_exception( *exc_info ) print e print snClient.print_error( e ) print "Failed to create record in Service Now" sys.exit(1)
print "No tableName provided." sys.exit(1) if content is None: print "No content provided." sys.exit(1) if shortDescription is None: print "No shortDescription provided." sys.exit(1) if description is None: print "No description provided." sys.exit(1) snClient = ServiceNowClient.create_client(servicenowServer, username, password) contentJSON = content % (shortDescription, description) sysId = None content = content % (shortDescription, description) print "Sending content %s" % content try: data = snClient.create_record(tableName, content) print "Returned DATA = %s" % (data) print json.dumps(data, indent=4, sort_keys=True) sysId = data["sys_id"] Ticket = data["number"] print "Created %s in Service Now." % (sysId) print "Created %s in Service Now." % (Ticket)
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # from servicenow.ServiceNowClient import ServiceNowClient params = { 'url': configuration.url, 'username': configuration.username, 'password': configuration.password, 'useOAuth': configuration.useOAuth, 'oauthUsername': configuration.oauthUsername, 'oauthPassword': configuration.oauthPassword, 'clientId': configuration.clientId, 'clientSecret': configuration.clientSecret, 'proxyHost': configuration.proxyHost, 'proxyPort': configuration.proxyPort, 'changeRecordTableName': configuration.changeRecordTableName, 'changeTaskTableName': configuration.changeTaskTableName, 'sysparmDisplayValue': configuration.sysparmDisplayValue, 'sysparmInputDisplayValue': configuration.sysparmInputDisplayValue } sn_client = ServiceNowClient.create_client(params) content = None print "Sending content %s" % content data = sn_client.get_change_request_states()
# # Copyright 2019 XEBIALABS # # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # from servicenow.ServiceNowClient import ServiceNowClient params = { 'url': configuration.url, 'username': configuration.username , 'password': configuration.password, 'useOAuth': configuration.useOAuth , 'oauthUsername': configuration.oauthUsername, 'oauthPassword': configuration.oauthPassword , 'clientId': configuration.clientId, 'clientSecret': configuration.clientSecret , 'proxyHost': configuration.proxyHost, 'proxyPort': configuration.proxyPort , 'changeRecordTableName': configuration.changeRecordTableName , 'changeTaskTableName': configuration.changeTaskTableName , 'sysparmDisplayValue': configuration.sysparmDisplayValue , 'sysparmInputDisplayValue': configuration.sysparmInputDisplayValue } sn_client = ServiceNowClient.create_client(params) content = None print "Sending content %s" % content data = sn_client.get_change_request_states()
# # THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS # FOR A PARTICULAR PURPOSE. THIS CODE AND INFORMATION ARE NOT SUPPORTED BY XEBIALABS. # import sys, string, time import com.xhaus.jyson.JysonCodec as json from servicenow.ServiceNowClient import ServiceNowClient snClient = ServiceNowClient.create_client(configuration) content = None print "Sending content %s" % content try: data = snClient.get_scorecards() except: print snClient.print_error(e) print "Error finding status for %s" % statusField sys.exit(1) # End try