<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial,helvetica,sans-serif;font-size:12pt"><div>Could the problem be that I have to encode the dash in CF-UPC somehow before sending it via CURL (but it gets encoded automatically from the form and that is why the form works)?<br>
<br>
I hope to be able to add some logging statements to
REST/1.0/ticket/default so that I can see what RT is getting in either
case, but as yet I don't have the needed permissions from my admin.<br>
<br>
K<br></div><br><br><font face="Tahoma" size="2"><hr size="1"><b><span style="font-weight: bold;">From:</span></b> "vtplymblfan-rt@yahoo.com" <vtplymblfan-rt@yahoo.com><br><b><span style="font-weight: bold;">To:</span></b> rt-users@lists.bestpractical.com<br><b><span style="font-weight: bold;">Sent:</span></b> Tuesday, May 19, 2009 12:53:21 PM<br><b><span style="font-weight: bold;">Subject:</span></b> [rt-users] any ideas why this post with php CURL not setting custom field?<br></font><br>
Hi there,<br><br>I
have modified a web application to post to RT's web interface a create
ticket request. The post works perfectly... the ticket get created in
the right queue with the given subject and text... except that the
custom field value I pass (UPC) in does not get set. Here is the CURL
code:<br><br>----<br><br>    $content = 'id: new<br>CF-UPC: 786936180992<br>Text: This is the ticket text<br>Subject: This is the subject<br>Queue: External App Requests';<br><br>    $request = RT_LOCATION;<br>    $request .= 'ticket/new/';<br><br>    $postargs = array(<br>       'user' => RT_USER,<br>       'pass' => RT_PASS,<br>       'content'
 => $content<br>    );<br><br>    // get the curl session object<br>    $session = curl_init($request);<br><br>    // set the POST options<br>    curl_setopt ($session, CURLOPT_POST, true);<br>    curl_setopt ($session, CURLOPT_POSTFIELDS, $postargs);<br>    curl_setopt($session, CURLOPT_HEADER, true);<br>    curl_setopt($session, CURLOPT_RETURNTRANSFER, true);<br>    curl_setopt( $session, CURLOPT_HTTPHEADER, array( 'Expect:' ) );<br><br>    // do the POST and then close the session<br>    $response = curl_exec($session);<br>    curl_close($session);<br><br>---<br><br>In debugging this I have also created a simple form which posts to the same place:<br><br><pre id="line1"><<span class="start-tag">form</span><span class="attribute-name"> method</span>=<span
 class="attribute-value">"POST"</span><span class="attribute-name">action</span>=<span class="attribute-value"><span>"<a rel="nofollow" target="_blank" href="http://foo.foo.edu/REST/1.0/ticket/new/">http://foo.foo.edu/REST/1.0/ticket/new/</a>"</span></span>><br>User: <<span class="start-tag">input</span><span class="attribute-name"> type</span>=<span class="attribute-value">"text" </span><span class="attribute-name">name</span>=<span class="attribute-value">"user" </span><span class="attribute-name">size</span>=<span class="attribute-value">"20"</span>><<span class="start-tag">br</span>><br>Pass: <<span class="start-tag">input</span><span class="attribute-name"> type</span>=<span class="attribute-value">"text" </span><span class="attribute-name">name</span>=<span class="attribute-value">"pass" </span><span class="attribute-name">size</span>=<span class="attribute-value">"20"</span>><<span
 class="start-tag">br</span>><br>Content: <<span class="start-tag">textarea</span><span class="attribute-name"> rows</span>=<span class="attribute-value">"10" </span><span class="attribute-name">name</span>=<span class="attribute-value">"content" </span><span class="attribute-name">cols</span>=<span class="attribute-value">"30"</span>>id: new<br>CF-UPC: 786936180992<br>Text: This is the ticket text from the form.<br>Subject: This is the subject<br>Queue: External App Requests</<span class="end-tag">textarea</span>><<span class="start-tag">br</span>><br><<span class="start-tag">p</span>><<span class="start-tag">input</span><span class="attribute-name"> type</span>=<span class="attribute-value">"submit" </span><span class="attribute-name">value</span>=<span class="attribute-value">"Submit" </span><span class="attribute-name">name</span>=<span class="attribute-value">"B1"</span>><span class="start-tag"></span><br></<span
 class="end-tag">form</span>> <br><br><span style="font-family: arial,helvetica,sans-serif;">When this form is used, again the ticket is created but in this case the custom field UPC does </span><span style="font-family: arial,helvetica,sans-serif;">get set. But <br>the "Content:" being sent is the same in both. In particular in both cases I am providing UPC's value with <br>"CF-UPC: 78..." Can anyone here explain what the difference could possibly be between these two<br>posting methods that could result in this scenario? By the way, in both cases I am passing in the same <br>user name and password. I am really stumped and I suspect some small stupid thing I have missed.<br><br>Thanks for your help,<br>Kim<br style="font-family: arial,helvetica,sans-serif;"><span style="font-family: monospace;"></span></span></pre><br><br><div style="font-family: arial,helvetica,sans-serif; font-size: 12pt;"><div style="font-family: times new roman,new
 york,times,serif; font-size: 12pt;"><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><div><br></div></div></div></div></div></body></html>