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

2009-05-22 Thread vtplymblfan-rt
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...@yahoo.com" 
To: rt-users@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:


http://foo.foo.edu/REST/1.0/ticket/new/";>
User: 
Pass: 
Content: id: new
CF-UPC: 786936180992
Text: This is the ticket text from the form.
Subject: This is the subject
Queue: External App Requests

 

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: sa...@bestpractical.com


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com

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

2009-05-19 Thread vtplymblfan-rt
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:


http://foo.foo.edu/REST/1.0/ticket/new/";>
User: 
Pass: 
Content: id: new
CF-UPC: 786936180992
Text: This is the ticket text from the form.
Subject: This is the subject
Queue: External App Requests

 

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: sa...@bestpractical.com


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com