API TicketSearch - Between two dates.

English! place to talk about development, programming and coding
Post Reply
benjamin1234
Znuny newbie
Posts: 8
Joined: 19 Nov 2014, 17:06
Znuny Version: 1.5.0
Real Name: Benjamin PAYET
Company: b

API TicketSearch - Between two dates.

Post by benjamin1234 »

I want to display ticket newer than a date AND older than another date.

Here is how I try to do it :

Code: Select all

	 @TicketIDs = $RPC->Dispatch( $SOAP_User, $SOAP_Pass, 'TicketObject', 'TicketSearch',
			Limit  => 1000,
			Result => 'ARRAY',
		   UserID => 1,

			# custom period is given via args
			ArticleCreateTimeNewerDate => $customperiod[0],
			ArticleCreateTimeOlderDate => $customperiod[1],

		   );
I'm displaying the ticket thanks to the following code :

Code: Select all

for my $TicketID (@TicketIDs) {
        
        my %Ticket = $RPC->Dispatch( $SOAP_User, $SOAP_Pass, 'TicketObject', 'TicketGet', TicketID => $TicketID);
        print "Date: $Ticket{Created} == ";
        print "Title:  $Ticket{Title} == ";
        print "Customer:  $Ticket{CustomerID} == ";
        print "Owner:  $Ticket{Owner} == ";
        print "Sender:  $Ticket{CustomerUserID} == ";
        print "Status:  $Ticket{State} == ";
        print "Priority:  $Ticket{Priority}\n";
        

}

The problem that I meet is that the specified dates are not respected. Indeed if I specify for example : Older date : '2015-09-15 00:00:01' newer date : '2015-09-16 8:00:01'
I see a ticket that was created the 2015-09-02 ..

Can someone please help me ? Thank you !

Best regards,
Benjamin
RStraub
Znuny guru
Posts: 2210
Joined: 13 Mar 2014, 09:16
Znuny Version: 6.0.14
Real Name: Rolf Straub

Re: API TicketSearch - Between two dates.

Post by RStraub »

You are searching for ARTICLE create time, not TICKET create time :)
Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS
benjamin1234
Znuny newbie
Posts: 8
Joined: 19 Nov 2014, 17:06
Znuny Version: 1.5.0
Real Name: Benjamin PAYET
Company: b

Re: API TicketSearch - Between two dates.

Post by benjamin1234 »

Hi RStraub,

You're right I used the wrong paramater. It was obvious .., maybe I need another coffee.
Btw, thanks for your help.

Benjamin
Post Reply