-
Notifications
You must be signed in to change notification settings - Fork 0
/
spo_test.pl
executable file
·63 lines (51 loc) · 1.6 KB
/
spo_test.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#! /usr/bin/env perl
use strict;
use warnings;
use v5.11;
use utf8;
use Data::Dumper;
use Config::Simple;
use DBI;
use Time::Piece;
use Parallel::ForkManager;
use FindBin;
use lib "$FindBin::Bin/lib";
use MsSpoList;
my %config;
Config::Simple->import_from("$FindBin::Bin/spo.cfg",\%config) or die("No config: $!");
my $spo_object = MsSpoList->new(
'app_id' => $config{'APP_ID'},
'app_secret' => $config{'APP_PASS'},
'tenant_id' => $config{'TENANT_ID'},
'site_naam' => 'support',
'list_naam' => 'ITSM360_Tickets',
'login_endpoint'=> $config{'LOGIN_ENDPOINT'},
'graph_endpoint'=> $config{'GRAPH_ENDPOINT'},
);
my $items = $spo_object->list_items(
# 'expand=fields(select=Title,StatusLookupId,id,AssignedTeamLookupId,RequestorClaims)',
'expand=fields',
'filter=fields/StatusLookupId eq \'1\' and fields/AssignedTeamLookupId eq \'4\' and startswith(fields/Title, \'Mutatie\')'
);
say Dumper $items;
my $payload = {
"fields" => {
'SLAPriorityLookupId' => '5',
'StatusLookupId' => '1',
'TicketType' => 'Incident',
'RequesterLookupId' => '12',
'AssignedTeamLookupId' => '4',
'Origin' => 'Self Service',
'Title' => 'Mutatie: b_enditisweergraph',
'Description' => '<p>Dit ticket is via graph gemaakt als test</p>'
}
};
my $result = $spo_object->list_item_create($payload);
say Dumper $result;
# SLAPriorityLookupId Priority Id 5
# StatusLookupId Status Id (1 is new)
# TicketType TicketType Value Incident
# Requester Claims responder email
# AssignedTeamLookupId Assigned Team Id (4 is account team)
# Origin Omni Channel Value Self Service
# Description Description bla bla bla