I am attempting to create a ticket in RT using python-rtkit, it gives a 200 OK
and returns the information for an empty ticket that does not actually get created in RT, additionally I tried straight up using the requests module, and that had the same result as well.
My code attempting to use the requests module
post_data = """
id: ticket/new
Queue: myqueue
Subject: Test Ticket creation in RT with Python
Text: Wow ticket is created :-D .
"""
payload = {'content':post_data}
ticket_creation_reusult = requests.post("http://rt.domain.com/REST/1.0/ticket/new"+"user="+user+"&pass="+pas, payload)
My code attempting to use the requests python-rtkit,
content = {
'content': {
'Queue': 1,#'', 2
'Subject': 'New Ticket',
'Text': 'My useless\ntext on\nthree lines.',
}
}
try:
response = resource.post(path='ticket/new', payload=content)
logger.info(response.parsed)
except RTResourceError as e:
logger.error(e.response.status_int)
logger.error(e.response.status)
logger.error(e.response.parsed)
The output:
[DEBUG] POST ticket/new
[DEBUG] {'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8','Accept': 'text/plain'}
[DEBUG] 'content=Queue: 1\nText:My+useless%0A+text+on%0A+three+lines.\nSubject: New Ticket'
[INFO] POST
[INFO] http://nocrt.domain.com/REST/1.0/ticket/new
[DEBUG] HTTP_STATUS: 200 OK
[DEBUG] 'RT/4.2.9 200 Ok\n\n# Required: id, Queue\n\nid: ticket/new\nQueue:General\nRequestor: svc_nocrt\nSubject: \nCc:\nAdminCc:\nOwner: \nStatus:new\nPriority: 5\nInitialPriority:5\nFinalPriority: 1\nTimeEstimated: 0\nStarts: 2015-07-2014:20:07\nDue: 2015-07-27 14:20:07\nAttachment: \nText: \n\n'
[DEBUG] RESOURCE_STATUS: 200 Ok
[INFO] [[('id', 'ticket/new'), ('Queue', 'General'), ('Requestor','svc_nocrt'), ('Subject', ''), ('Cc', ''), ('AdminCc', ''),('Owner', ''), ('Status', 'new'), ('Priority', '5'), ('InitialPriority', '5'),('FinalPriority', '1'), ('TimeEstimated', '0'), ('Starts', '2015-07-2014:20:07'), ('Due', '2015-07-27 14:20:07'), ('Attachment', ''), ('Text', '')]]
[INFO] [[('id', 'ticket/new'), ('Queue', 'General'), ('Requestor','svc_nocrt'), ('Subject', ''), ('Cc', ''), ('AdminCc', ''),('Owner', ''), ('Status', 'new'), ('Priority', '5'), ('InitialPriority', '5'),('FinalPriority', '1'),('TimeEstimated', '0'), ('Starts', '2015-07-2014:20:07'),('Due', '2015-07-27 14:20:07'), ('Attachment', ''), ('Text', '')]]
It looks like it's creating an empty ticket; but nothing shows up in the web interface, these are the examples for python-rtkit and another I found from here but that gives the same result