[Question] RS4OTRS_API Addon From Radiant

English! place to talk about development, programming and coding
Post Reply
skullz
Znuny superhero
Posts: 617
Joined: 24 Feb 2012, 03:58
Znuny Version: LTS and Features
Real Name: Mo Azfar
Location: Kuala Lumpur, MY
Contact:

[Question] RS4OTRS_API Addon From Radiant

Post by skullz »

Hi all,

Now im testing the RS4OTRS_API Addon From Radiant .
Based on /tickets/getTicketList api (https://rs4otrs.com/collections/free-ad ... s/json-api ) the required and optional api is as below

Code: Select all

Get ticket list (/tickets/getTicketList)
----------------------------------------

Required parameters:

* OTRSAgentInterface - main token.

Unrequired parameters:

* Count             - just to get ticket count (1|0)
* ViewID            - view ID (for filtering).
* SortBy            - field list for sorting (array of names)
* OrderBy           - field list for sorting order (array of names)
* FullTextSearch    - string for searching in Subject, Body, From, To, Cc.
* TicketID          - ticket id.
* TicketNumber      - ticket number.
* Title             - title.
* Queues            - queue list (array of names).
* QueueIDs          - queue list (array of numbers).
* Types             - type list (array of names).
* TypeIDs           - type list (array of numbers).
* States            - state list (array of names).
* StateIDs          - state list (array of numbers).
* StateType         - state type: "Open", “Closed”.
* Priorities        - priority list (array of names).
* PriorityIDs       - priority list (array of numbers).
* Services          - service list (array of names).
* ServiceIDs        - service list (array of numbers).
* SLAs              - SLA list (array of names).
* SLAIDs            - SLA list (array of numbers).
* Locks             - lock list (array of names).
* LockIDs           - lock list (array of numbers).
* OwnerIDs          - owner list (array of numbers).
* ResponsibleIDs    - responsible list (array of numbers).
* WatchUserIDs      - watch user list (array of number).
* CustomerID        - customer id.
* CustomerUserLogin - customer user login.
* From              - from.
* To                - to.
* Cc                - copy.
* Subject           - subject.
* Body              - body. 
* Limit             - limit.
* Offset            - offset.

my code below send a multi Queue ID but only return 1 ticket only. Its supposed to return 2 ticket.

Code: Select all

use strict;
use warnings;
use Data::Dumper;
use JSON;
use REST::Client;

my $Host = 'http://app.myserver.local:83/abahko/api';
my $RestClient = REST::Client->new(
    {
        host => $Host,
    }
);

my $TicketList = '/tickets/getTicketList';

my $TicketListParams = {
    OTRSAgentInterface => $Data->{OTRSAgentInterface},       
    QueueIDs  => [1,4], 
};

my @RequestParam1;

my $TicketListQueryParams = $RestClient->buildQuery( %{ $TicketListParams } );
$TicketList .= $TicketListQueryParams;
@RequestParam1 = ($TicketList);
$RestClient->GET(@RequestParam1);

my $ResponseContent3 = $RestClient->responseContent();
my $Data3 = decode_json $ResponseContent3;

if ($Data3->{Response} eq "ERROR") { print "$Data3->{Message}\n\n"; exit; }
print Dumper($Data3);
print "\n\n";

Results

Code: Select all

{
          'NeedTokenUpdate' => 1,
          'Response' => 'OK',
          'Tickets' => [
                         {
                           'EscalationTimeWorkingTime' => 92455,
                           'Seen' => 0,
                           'Age' => 81107,
                           'PriorityID' => 3,
                           'EscalationDestinationTime' => 1585670400,
                           'ServiceID' => 4,
                           'EscalationDestinationIn' => '25h 40m',
                           'SolutionTimeWorkingTime' => 92455,
                           'Service' => 'Change Request::Module',
                           'Type' => 'Change Request',
                           'CreatedServer' => '2020-03-29 23:47:18',
                           'Responsible' => 'admin',
                           'StateID' => 4,
                           'SolutionTimeDestinationDate' => '2020-04-01 00:00:00',
                           'ResponsibleID' => 2,
                           'ChangeBy' => 2,
                           'EscalationTime' => 92455,
                           'SolutionTimeDestinationTime' => 1585670400,
                           'SLA' => 'Normal',
                           'HasWatch' => 0,
                           'UntilTimeDateUnix' => 0,
                           'OwnerID' => 3,
                           'Changed' => '2020-03-30 21:36:39',
                           'EscalationDestinationDate' => '2020-04-01 00:00:00',
                           'RealTillTimeNotUsed' => 0,
                           'SolutionTimeDestinationDateServer' => '2020-04-01 00:00:00',
                           'GroupID' => 1,
                           'EscalationDestinationDateServer' => '2020-04-01 00:00:00',
                           'Owner' => 'xyqq',
                           'CustomerID' => 'XYZI',
                           'TypeID' => 2,
                           'Created' => '2020-03-29 23:47:18',
                           'Priority' => '3 normal',
                           'UntilTimeDate' => 0,
                           'UntilTime' => 0,
                           'EscalationUpdateTime' => 0,
                           'QueueID' => 4,
                           'Queue' => 'Misc',
                           'CustomerUserLastname' => 'XXX',
                           'State' => 'open',
                           'Title' => 'Site Visit To XTreme Test 2',
                           'ChangedServer' => '2020-03-30 21:36:39',
                           'CreateBy' => 2,
                           'TicketID' => 126,
                           'LinkCount' => 1,
                           'CustomerUserFirstname' => 'XXX',
                           'StateType' => 'open',
                           'EscalationResponseTime' => 0,
                           'UnlockTimeout' => 1585496853,
                           'EscalationSolutionTime' => 1585670400,
                           'LockID' => 1,
                           'ArchiveFlag' => 'n',
                           'TicketNumber' => 1100047,
                           'SolutionTime' => 92455,
                           'Lock' => 'unlock',
                           'CreateTimeUnix' => 1585496838,
                           'SLAID' => 1,
                           'CustomerUserID' => 'xtres',
                           'WatcherCount' => 0
                         }
                       ]
        };


However, how do i suppose to send multiple ID to the parameter QueueIDs ? Thanks
Post Reply