Skip to content

Unable to create new ticket #40

Open

Description

@mgaulton

Using RT 4.2 with RTIR. Still getting a blank Queue when submitting a new ticket. Searching for a ticket gets the correct result. Not sure what i'm doing wrong here. Code follows result block.

[DEBUG] POST ticket/new
[DEBUG] {'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8', 'Accept': 'text/plain'}
[DEBUG] 'content=Queue: IST-Security\nText: My+useless%0A+text+on%0A+three+lines.\nSubject: New Ticket Test'
[INFO] POST
[INFO] http://rt.uwaterloo.ca/REST/1.0/ticket/new
[DEBUG] HTTP_STATUS: 200 OK
[DEBUG] 'RT/4.2.9-43-gd7c0cfd 200 Ok\n\n# Required: id, Queue\n\nid: ticket/new\nQueue: \nRequestor: issminion\nSubject: \nCc:\nAdminCc:\nOwner: \nStatus: new\nPriority: \nInitialPriority: \nFinalPriority: \nTimeEstimated: 0\nStarts: 2014-12-02 10:23:19\nDue: \nAttachment: \nText: \n\n'
[DEBUG] RESOURCE_STATUS: 200 Ok
[INFO] [[('id', 'ticket/new'), ('Queue', ''), ('Requestor', 'issminion'), ('Subject', ''), ('Cc', ''), ('AdminCc', ''), ('Owner', ''), ('Status', 'new'), ('Priority', ''), ('InitialPriority', ''), ('FinalPriority', ''), ('TimeEstimated', '0'), ('Starts', '2014-12-02 10:23:19'), ('Due', ''), ('Attachment', ''), ('Text', '')]]
[INFO] [[('id', 'ticket/new'), ('Queue', ''), ('Requestor', 'issminion'), ('Subject', ''), ('Cc', ''), ('AdminCc', ''), ('Owner', ''), ('Status', 'new'), ('Priority', ''), ('InitialPriority', ''), ('FinalPriority', ''), ('TimeEstimated', '0'), ('Starts', '2014-12-02 10:23:19'), ('Due', ''), ('Attachment', ''), ('Text', '')]]

!/usr/bin/env python

import sys
import re
import smtplib
import subprocess
import os
import rt
import ConfigParser
import time
from rtkit.resource import RTResource
from rtkit.authenticators import QueryStringAuthenticator
from rtkit.errors import RTResourceError

from rtkit import set_logging
import logging
set_logging('debug')
logger = logging.getLogger('rtkit')

config = ConfigParser.RawConfigParser()
config.read(os.path.expanduser('~/.rtrcp'))

notkit rtpoint = "https://{0}/REST/1.0/".format(config.get('rt','hostname'))

rtuser = config.get('rt','username')
rtpass = config.get('rt','password')
rthost = config.get('rt','hostname')

resource = RTResource('http://{0}/REST/1.0/', '{1}', '{2}', BasicAuthenticator).format(rthost,rtuser,rtpass)

try:
resource = RTResource('http://rt.uwaterloo.ca/REST/1.0/', rtuser, rtpass, QueryStringAuthenticator)

except:
print rtuser, rtpass, rthost
print "Oops."
sys.exit(0)

content = {
'content': {
'Queue': 'IST-Security',
'Subject': 'New Ticket Test',
'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)

Activity

  1. z4r commented on Dec 3, 2014

    @z4r
    Owner

    Could you try to retrieve a tkt?

  2. mgaulton commented on Dec 3, 2014

    @mgaulton
    Author

    Retrieving a ticket using the below works. Hence my confusion. :)
    #!/usr/bin/env python

    import sys
    import re
    import smtplib
    import subprocess
    import os
    import rt
    import ConfigParser
    import time
    from rtkit.resource import RTResource
    from rtkit.authenticators import QueryStringAuthenticator
    from rtkit.errors import RTResourceError

    from rtkit import set_logging
    import logging
    set_logging('debug')
    logger = logging.getLogger('rtkit')

    config = ConfigParser.RawConfigParser()
    config.read(os.path.expanduser('~/.rtrcp'))

    notkit rtpoint = "https://{0}/REST/1.0/".format(config.get('rt','hostname'))

    rtuser = config.get('rt','username')
    rtpass = config.get('rt','password')
    rthost = config.get('rt','hostname')
    #resource = RTResource('http://{0}/REST/1.0/', '{1}', '{2}', BasicAuthenticator).format(rthost,rtuser,rtpass)

    try:
    resource = RTResource('http://rt.uwaterloo.ca/REST/1.0/', rtuser, rtpass, QueryStringAuthenticator)

    except:
    print rtuser, rtpass, rthost
    print "Oops."
    sys.exit(0)
    try:
    response = resource.get(path='ticket/386422')
    for r in response.parsed:
    for t in r:
    logger.info(t)
    except RTResourceError as e:
    logger.error(e.response.status_int)
    logger.error(e.response.status)
    logger.error(e.response.parsed)

  3. z4r commented on Dec 3, 2014

    @z4r
    Owner

    Could you write here your logger output?

  4. mgaulton commented on Dec 3, 2014

    @mgaulton
    Author

    Can I message it to you offline, its got some info i'd rather not post publicly.

    On 12/3/14, Andrea de Marco notifications@github.com wrote:

    Could you write here your logger output?


    Reply to this email directly or view it on GitHub:
    #40 (comment)

  5. z4r commented on Dec 3, 2014

    @z4r
    Owner

    sure, contact me on skype: z4erre

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions