title: Creating tickets on RT via REST API with Powershell
body: <p>I'm trying to create ticket in RT using REST API.
  So far I can searching tickets:</p>
  <pre><code>$servername=&quot;tickets.somedomain&quot;
  $u=&quot;user=someuser&quot;
  $p=&quot;pass=P@55w0rd&quot;
  $q=&quot;search/ticket?query=(Queue='Queue_name')&quot;
  $uri=&quot;http://&quot; + $servername + &quot;/REST/1.0/&quot; + $q + &quot;&amp;&quot; + $u + &quot;&amp;&quot; + $p
  $RT=Invoke-WebRequest -Uri $uri -SessionVariable sess 
  $rt.Content
  </code></pre>
  <p>But creating:</p>
  <pre><code>$servername = 'http://tickets.somedomain/REST/1.0/ticket/new'
  $postParams = @{
      user = 'someuser';
      pass = 'P@55w0rd';
      content = @&quot;
  Queue: Queue_name
  id: ticket/new
  Requestor: some_user_email
  Subject: TEST
  Status: New
  Text: blahblah
  &quot;@;
  }
  $RT = Invoke-WebRequest -Uri $servername -Method Post -Body $postParams
  $RT.content
  </code></pre>
  <p>Resulting in:</p>
  <pre><code>RT/3.8.8 200 Ok
  # Could not create ticket.
  # Could not create ticket. Queue not set
  </code></pre>
  <p>or:</p>
  <pre><code>$servername=&quot;http://tickets.somedomain/REST/1.0/ticket/new?user=someuser&amp;pass=P@55w0rd&quot;
  $RT = Invoke-WebRequest -Uri $servername -Body @{Content=&quot;Queue: 'queue_name'\nid: new&quot;} -Method Post
  $RT.content
  </code></pre>
  <p>Resulting:</p>
  <pre><code>RT/3.8.8 200 Ok
  # Required: id, Queue
  
  id: ticket/new
  Queue: 
  Requestor: lukasz.wasko
  Subject: 
  Cc:
  AdminCc:
  Owner: 
  Status: new
  Priority: 
  InitialPriority: 
  FinalPriority: 
  TimeEstimated: 0
  Starts: 2015-04-09 12:55:33
  Due: 2015-04-09 12:55:33
  Text: 
  </code></pre>
  <p><a href="http://requesttracker.wikia.com/wiki/REST#Ticket_Create" rel="nofollow noreferrer">http://requesttracker.wikia.com/wiki/REST#Ticket_Create</a> said:</p>
  <blockquote>
  <p>to create a new ticket: post on /REST/1.0/ticket/new with a variable named &quot;content&quot;, containing &quot;key: value&quot; line by line, example:</p>
  <p>Testing the new ticket section</p>
  <p>id: ticket/new
  Queue: 
  Requestor: 
  Subject: 
  Cc: &lt;...&gt;
  AdminCc: &lt;...&gt;
  Owner: &lt;...&gt;
  Status: &lt;...&gt;
  Priority: &lt;...&gt;
  InitialPriority: &lt;...&gt;
  FinalPriority: &lt;...&gt;
  TimeEstimated: &lt;...&gt;
  Starts: &lt;...&gt;
  Due: &lt;...&gt;
  Text: 
  CF-: </p>
  </blockquote>
  <p>I lost a whole day on the search for a solution. Google didn't find any help for me..
  Any advice and suggestions will be greatly appreciated.</p>