-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUpdate an Existing Reminder on a Task.js
45 lines (42 loc) · 1.43 KB
/
Update an Existing Reminder on a Task.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
const myHeaders = new Headers();
const userName = "email address or API KEY here";
const password = "password";
const siteName = "yourSiteName"
const taskId = "taskIdHere"
const userId = "userIdHere"
const reminderId = "reminderIdHere"
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", "Basic " + btoa(userName + ":" + password));
const raw = JSON.stringify({
"reminder": {
"note": "Hey, don't forget about me!",
"type": "EMAIL",//SMS,PUSH
"date-time-utc": "2024-10-07T10:15:45Z",//YYYY-MM-DD
"user-id": [
userId
],
"isRelative": false,//Set to true to follow task due date
"id": reminderId,//Reminder Id
"peopleAssigned": false,//true when reminder is set to all task assignees
"assignToMultiple": false,
"assigneeDetails": [
{
"id": userId,
"label": "User Name",
"firstName": "userFirstName",
"lastName": "userLastName"
}
],
"usingOffSetDueDate": false
}
});
const requestOptions = {
method: "PUT",
headers: myHeaders,
body: raw,
redirect: "follow"
};
fetch("https://" + siteName + ".teamwork.com/tasks/" + taskId + "/reminders/" + reminderId + ".json", requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));