-
Notifications
You must be signed in to change notification settings - Fork 0
/
holidaylist.dg
78 lines (78 loc) · 1.91 KB
/
holidaylist.dg
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// Update Holiday List via API
// Florian Lamml
// 23.05.2022
// Jahr bestimmen
year = zoho.currentdate.right(4);
//DE Holiday
getDEHoliday = invokeurl
[
url :"https://get.api-feiertage.de/?years=" + year + "&all_states=true"
type :GET
];
// BY Holiday
getBYHoliday = invokeurl
[
url :"https://get.api-feiertage.de/?years=" + year + "&states=by"
type :GET
];
// General
headerMap = Map();
headerMap.put("Content-Type","application/json");
// Vorbereiten DE
responseDE = getDEHoliday;
dataDE = responseDE.getJSON("feiertage");
json_listDE = dataDE.toJSONList();
// Vorbereiten BY
responseBY = getBYHoliday;
dataBY = responseBY.getJSON("feiertage");
json_listBY = dataBY.toJSONList();
// Verarbeiten DE
listVarDE = list();
for each item in json_listDE
{
datumlang = item.getJSON("date");
datum = datumlang.getSuffix(year+"-");
name = item.getJSON("fname");
paramMap = Map();
paramMap.put("from",datum);
paramMap.put("to",datum);
paramMap.put("holidayName",name);
listVarDE.add(paramMap);
}
pretext = '{"holidays" : [';
posttext = '] , "name" : "Feiertage_Deutschland"}';
fulltext = pretext + "" + listVarDE + "" + posttext;
updatelistDE = invokeurl
[
url :"https://desk.zoho.eu/api/v1/holidayList/<HOLIDAYLISTID>"
type :PATCH
parameters:fulltext
headers:headerMap
connection:"holidayup"
];
info updatelistDE;
// Verarbeiten BY
listVarBY = list();
for each item in json_listBY
{
datumlang = item.getJSON("date");
datum = datumlang.getSuffix(year+"-");
name = item.getJSON("fname");
paramMap = Map();
paramMap.put("from",datum);
paramMap.put("to",datum);
paramMap.put("holidayName",name);
listVarBY.add(paramMap);
}
pretext = '{"holidays" : [';
posttext = '] , "name" : "Feiertage_Bayern"}';
fulltext = pretext + "" + listVarBY + "" + posttext;
updatelistBY = invokeurl
[
url :"https://desk.zoho.eu/api/v1/holidayList/<HOLIDAYLISTID>"
type :PATCH
parameters:fulltext
headers:headerMap
connection:"holidayup"
];
info updatelistBY;