[rt-users] any ideas why this post with php CURL not setting custom field?

Tom Lahti toml at bitstatement.net
Fri May 22 20:06:11 EDT 2009


Custom fields should be in the form of:

CF.{CustomField}: value

So you want

CF.{UPC}: 7585485.....

-not-

CF-UPC: 786936180992

vtplymblfan-rt at yahoo.com wrote:
> 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)?
> 
> 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.
> 
> K
> 
> 
> ------------------------------------------------------------------------
> *From:* "vtplymblfan-rt at yahoo.com" <vtplymblfan-rt at yahoo.com>
> *To:* rt-users at lists.bestpractical.com
> *Sent:* Tuesday, May 19, 2009 12:53:21 PM
> *Subject:* [rt-users] any ideas why this post with php CURL not setting 
> custom field?
> 
> Hi there,
> 
> 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:
> 
> ----
> 
>     $content = 'id: new
> CF-UPC: 786936180992
> Text: This is the ticket text
> Subject: This is the subject
> Queue: External App Requests';
> 
>     $request = RT_LOCATION;
>     $request .= 'ticket/new/';
> 
>     $postargs = array(
>        'user' => RT_USER,
>        'pass' => RT_PASS,
>        'content' => $content
>     );
> 
>     // get the curl session object
>     $session = curl_init($request);
> 
>     // set the POST options
>     curl_setopt ($session, CURLOPT_POST, true);
>     curl_setopt ($session, CURLOPT_POSTFIELDS, $postargs);
>     curl_setopt($session, CURLOPT_HEADER, true);
>     curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
>     curl_setopt( $session, CURLOPT_HTTPHEADER, array( 'Expect:' ) );
> 
>     // do the POST and then close the session
>     $response = curl_exec($session);
>     curl_close($session);
> 
> ---
> 
> In debugging this I have also created a simple form which posts to the 
> same place:
> 
> <form method="POST"action="http://foo.foo.edu/REST/1.0/ticket/new/">
> User: <input type="text" name="user" size="20"><br>
> Pass: <input type="text" name="pass" size="20"><br>
> Content: <textarea rows="10" name="content" cols="30">id: new
> CF-UPC: 786936180992
> Text: This is the ticket text from the form.
> Subject: This is the subject
> Queue: External App Requests</textarea><br>
> <p><input type="submit" value="Submit" name="B1">
> </form> 
> 
> When this form is used, again the ticket is created but in this case the custom field UPC does get set. But 
> the "Content:" being sent is the same in both. In particular in both cases I am providing UPC's value with 
> "CF-UPC: 78..." Can anyone here explain what the difference could possibly be between these two
> posting methods that could result in this scenario? By the way, in both cases I am passing in the same 
> user name and password. I am really stumped and I suspect some small stupid thing I have missed.
> 
> Thanks for your help,
> Kim
> 
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
> 
> Community help: http://wiki.bestpractical.com
> Commercial support: sales at bestpractical.com
> 
> 
> Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
> Buy a copy at http://rtbook.bestpractical.com




More information about the rt-users mailing list