Skip Menu |

This queue is for tickets about the RT-Client-REST CPAN distribution.

Report information
The Basics
Id: 44878
Status: rejected
Priority: 0/
Queue: RT-Client-REST

People
Owner: Nobody in particular
Requestors: RBOWES [...] cpan.org
rbowes [...] humyo.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Ticket creation succeeds with invalid field values
Hi, I've noticed that ticket creation succeeds using RT::Client::REST::Ticket even if some of the supplied fields are invalid. Specifically, we have an "amount" field which doesn't accept -ve values. If I try and create a ticket through the web UI it is rejected, but if I do it through RT::Client::REST::Ticket, it succeeds, but with the offending field empty. This is a fragment of the code I'm using: my $rt = RT::Client::REST->new(server => Storage::Config->RT_SERVER, timeout => 30); $rt->basic_auth_cb( sub { my ($realm, $uri, $proxy) = @_; return (Storage::Config->RT_USER, Storage::Config->RT_PASS); } ); my %rt_args = (rt => $rt, queue => $args->{queue} || Storage::Config->RT_QUEUE, subject => $args->{subject}, ); $rt_args{cf} = $args->{cf} if $args->{cf}; $rt_args{requestors} = $args->{requestors} if $args->{requestors}; my $ticket = RT::Client::REST::Ticket->new(%rt_args); $ticket->store(text => $args->{text}); $args->{cf} is set something like: cf => { amount => -12.53, currency => 'GBP', supplier => 'Acme Resellers', } It would be nice if creating a ticket over REST applied field validation. I'm not sure if this is a RT-Client-REST problem or a general RT problem.
Subject: Re: [rt.cpan.org #44878] Ticket creation succeeds with invalid field values
Date: Wed, 08 Apr 2009 12:52:48 -0700
To: bug-RT-Client-REST [...] rt.cpan.org
From: Jerrad Pierce <belg4mit [...] pthbb.org>
Show quoted text
>I'm not sure if this is a RT-Client-REST problem or a general RT problem.
Well, can you replicate the problem with the rt CLI? It also uses REST. -- Free map of local environmental resources: http://CambridgeMA.GreenMap.org -- MOTD on Pungenday, the 25th of Discord, in the YOLD 3175: Niven's Law #9: Ethics change with technology.
On Wed Apr 08 15:53:03 2009, belg4mit@pthbb.org wrote: Show quoted text
> >I'm not sure if this is a RT-Client-REST problem or a general RT problem.
> Well, can you replicate the problem with the rt CLI? It also uses REST.
I'll give that a go tomorrow. Thanks, R.
On Wed Apr 08 15:53:03 2009, belg4mit@pthbb.org wrote: Show quoted text
> >I'm not sure if this is a RT-Client-REST problem or a general RT problem.
> Well, can you replicate the problem with the rt CLI? It also uses REST.
OK, I tried this from the command-line: rt create -t ticket set subject='new from rt' text='this is the text' Amount=12.34 queue=Sandbox # Ticket 13875 created. # amount: Unknown field. id: ticket/new Requestor: website TimeEstimated: Subject: new from rt Queue: Sandbox Text: this is the text Owner: Starts: 2009-04-09 10:05:32 Priority: Two things: 1. It didn't recognise the "amount" field - is there some special way to specify custom fields from the command-line? 2. Ticket creation succeeded, even though one of the specified fields was not recognised R.
Subject: Re: [rt.cpan.org #44878] Ticket creation succeeds with invalid field values
Date: Thu, 09 Apr 2009 04:11:31 -0700
To: bug-RT-Client-REST [...] rt.cpan.org
From: Jerrad Pierce <belg4mit [...] pthbb.org>
Show quoted text
>1. It didn't recognise the "amount" field - is there some special way to >specify custom fields from the command-line?
Yes. The dox/wiki/list archives are generally a good reference for this info. http://wiki.bestpractical.com/view/UseRtTool Show quoted text
>2. Ticket creation succeeded, even though one of the specified fields >was not recognised
Then it's not a mandatory field. -- Free map of local environmental resources: http://CambridgeMA.GreenMap.org -- MOTD on Prickle-Prickle, the 26th of Discord, in the YOLD 3175: Economics is a disease --Hazel Henderson
Show quoted text
> rt create -t ticket set subject='new from rt' text='this is the text' > Amount=12.34 queue=Sandbox
Also, I thought the point was to see whether or not REST was doing validation, and therefore oughtn't you use a negative amount?
On Thu Apr 09 07:12:05 2009, belg4mit@pthbb.org wrote: Show quoted text
> >1. It didn't recognise the "amount" field - is there some special way
> to
> >specify custom fields from the command-line?
> Yes. The dox/wiki/list archives are generally a good reference for > this info. > http://wiki.bestpractical.com/view/UseRtTool
Ah, thanks for making me read that again. I must admit, I was rather thrown by this at the top: " bin/rt has its limitations; it cannot deal with custom fields yet (as of January, 2006). " Show quoted text
> >2. Ticket creation succeeded, even though one of the specified fields > >was not recognised
> Then it's not a mandatory field.
Good point. I'll check whether that is the case. R.
On Thu Apr 09 07:16:11 2009, JPIERCE wrote: Show quoted text
> > rt create -t ticket set subject='new from rt' text='this is the text' > > Amount=12.34 queue=Sandbox
> Also, I thought the point was to see whether or not REST was doing > validation, and therefore oughtn't you use a negative amount?
I thought it prudent to establish working test case before demonstrating a failure. This works (ticket creation succeeds, Amount field is set correctly): rt create -t ticket set subject='new from rt' text='this is the text' CF-Amount=12.34 queue=Sandbox # Ticket 13894 created. This fails (ticket creation succeeds, but Amount field is left undef): rt create -t ticket set subject='new from rt' text='this is the text' CF-Amount=-12.34 queue=Sandbox # Ticket 13895 created. I'll experiment with the mandatory field settings when our sysadmin gets back from holiday next week. Either way, it looks like this is not a problem with this specific module so this ticket can probably be closed. Thanks for the help. R.
Show quoted text
>I thought it prudent to establish working test case before >demonstrating a failure.
Gotcha. Show quoted text
>Either way, it looks like this is not a problem with this specific >module so this ticket can probably be closed.
Rejected actually, since we didn't solve the problem, just found that it lived elsewhere :-P Show quoted text
>Thanks for the help.
np