-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEdit user (all settings and preferences).js
142 lines (139 loc) · 4.31 KB
/
Edit user (all settings and preferences).js
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
const myHeaders = new Headers();
const userName = "email address or API KEY here";
const password = "password";
const siteName = "yourSiteName"
const userId = "userIdHere"
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Accept", "application/json");
myHeaders.append("Authorization", "Basic "+btoa(userName+":"+password));
const raw = JSON.stringify({
"person": {
//Essentials Tab
"email-address": "[email protected]",
"first-name": "First Name",
"last-name": "Last Name",
"company-id": 110969,
"user-type": "account",
"isClientUser": false,
"workingHours": {
"entries": [
{
"weekday": "sunday",
"taskHours": 0
},
{
"weekday": "monday",
"taskHours": 8
},
{
"weekday": "tuesday",
"taskHours": 8
},
{
"weekday": "wednesday",
"taskHours": 8
},
{
"weekday": "thursday",
"taskHours": 8
},
{
"weekday": "friday",
"taskHours": 8
},
{
"weekday": "saturday",
"taskHours": 0
}
]
},
"sendInvite": false,
//Details tab
"title": "Support Lead",
"phone-number-office": "",
"phone-number-office-ext": "",
"phone-number-mobile-countrycode": "IE",
"phone-number-mobile-prefix": "21",
"phone-number-mobile": "0122362806",
"phone-number-home": "+1 844 819 3456",
"phone-number-fax": "0314963229",
"email-alt-1": "",
"email-alt-2": "",
"email-alt-3": "",
//Address tab
"address": {
"line1": "Address Line 1",
"line2": "Address Line 2",
"city": "City",
"state": "State",
"zipcode": "Zipcode",
"countrycode": "US"
},
//Profile tab
"profile": "",
//Notes tab
"privateNotes": "",
//Social tab
"userTwitterName": "",
"userLinkedin": "",
"userFacebook": "",
"userWebsite": "",
"im-service": "Twitter",
"im-handle": "",
//Localization Tab
"language": "EN",
"dateFormatId": 2, // 1 = dd/mm/yyyy, 2 = mm/dd/yyyy, etc based on order in dropdown when setting date format
"timeFormatId": 2, // 1 = 24hr, 2 = 12hr clock
"timezoneId": 144, // Use https://apidocs.teamwork.com/docs/teamwork/v1/timezones/get-timezones-json to get a full list of timezone id's
"calendarStartsOnSunday": "yes",// no will start the calendar on a Monday
"lengthOfDay": 15,
"changeForEveryone": false,
//Permissions Tab
"administrator": true,
"canAddProjects": true,
"canManagePeople": true,
"autoGiveProjectAccess": true,
"canAccessCalendar": true,
"canAccessTemplates": true,
"canAccessPortfolio": true,
"canManageCustomFields": true,
"canAddCustomReports": true,
"canManagePortfolio": true,
"canManageProjectTemplates": true,
"canViewProjectTemplates": true,
"canViewSchedule": true,
"canManageSchedule": true,
"canManageTimeReminders": true,
//Preferences tab
"notifyOnTaskComplete": true,
"notify-on-added-as-follower": true,
"notify-on-status-update": true,
"userReceiveNotifyWarnings": true,
"userReceiveMyNotificationsOnly": true,
//Preferences tab > Daily report email
"receiveDailyReports": true,
"receiveDailyReportsAtWeekend": true,
"receiveDailyReportsIfEmpty": true,
"soundAlertsEnabled": true,
"dailyReportSort": "DATE",
"receiveDailyReportsAtTime": "7",// PM times follow 24 hour clock ie: 21 = 9pm
"dailyReportEventsType": "ALL",// MINE if you want to flag events for user only
"dailyReportDaysFilter": 2,// Change this to alter how many days to filter tasks
"avatarPendingFileRef": "",
"removeAvatar": false,
"allowEmailNotifications": true,
//Preferences tab > Editing
"textFormat": "TEXT",
"useShorthandDurations": true
}
});
const requestOptions = {
method: "PUT",
headers: myHeaders,
body: raw,
redirect: "follow"
};
fetch("https://"+siteName+".teamwork.com/people/"+userId+".json", requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));