forked from paymo-org/api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget.gs
More file actions
27 lines (20 loc) · 678 Bytes
/
Copy pathget.gs
File metadata and controls
27 lines (20 loc) · 678 Bytes
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
function sampleGetRequest() {
const email = 'johndoe@email.com';
const password = 'secret';
var headers = {
"Authorization": "Basic " + Utilities.base64Encode(email + ":" + password),
"Accept": "application/json"
};
var params = {
"method": "GET",
"headers": headers
};
var url = "https://app.paymoapp.com/api/projects";
var response = UrlFetchApp.fetch(url, params);
Logger.log("response code: " + response.getResponseCode());
var responseJson = JSON.parse(response.getContentText());
Logger.log(responseJson.projects.length + " projects");
responseJson.projects.forEach(function (project) {
Logger.log(project.name);
});
}