Added WildHealth scripts, need to fix Walmart Screenshots script. G2 templates.
BIN
Scripts/.DS_Store
vendored
BIN
Scripts/Auto_Scrape_Screenshots/.DS_Store
vendored
BIN
Scripts/Auto_Scrape_Screenshots/2022 tax filing FAQs_1.png
Normal file
|
After Width: | Height: | Size: 143 KiB |
BIN
Scripts/Auto_Scrape_Screenshots/About your earnings_1.png
Normal file
|
After Width: | Height: | Size: 126 KiB |
BIN
Scripts/Auto_Scrape_Screenshots/Accessing your metrics_1.png
Normal file
|
After Width: | Height: | Size: 78 KiB |
|
After Width: | Height: | Size: 98 KiB |
BIN
Scripts/Auto_Scrape_Screenshots/Appealing a deactivation_1.png
Normal file
|
After Width: | Height: | Size: 83 KiB |
BIN
Scripts/Auto_Scrape_Screenshots/Bagging tips_1.png
Normal file
|
After Width: | Height: | Size: 100 KiB |
BIN
Scripts/Auto_Scrape_Screenshots/COVID-19 best practices_1.png
Normal file
|
After Width: | Height: | Size: 119 KiB |
BIN
Scripts/Auto_Scrape_Screenshots/Cancel a trip_1.png
Normal file
|
After Width: | Height: | Size: 93 KiB |
|
After Width: | Height: | Size: 108 KiB |
|
After Width: | Height: | Size: 84 KiB |
|
After Width: | Height: | Size: 112 KiB |
|
After Width: | Height: | Size: 100 KiB |
|
After Width: | Height: | Size: 83 KiB |
|
After Width: | Height: | Size: 84 KiB |
|
After Width: | Height: | Size: 121 KiB |
|
After Width: | Height: | Size: 103 KiB |
|
After Width: | Height: | Size: 40 KiB |
|
After Width: | Height: | Size: 88 KiB |
|
After Width: | Height: | Size: 136 KiB |
|
After Width: | Height: | Size: 141 KiB |
|
After Width: | Height: | Size: 88 KiB |
BIN
Scripts/Auto_Scrape_Screenshots/Delivery FAQs_1.png
Normal file
|
After Width: | Height: | Size: 170 KiB |
|
After Width: | Height: | Size: 80 KiB |
BIN
Scripts/Auto_Scrape_Screenshots/Driver support options_1.png
Normal file
|
After Width: | Height: | Size: 82 KiB |
BIN
Scripts/Auto_Scrape_Screenshots/Earnings FAQs_1.png
Normal file
|
After Width: | Height: | Size: 158 KiB |
BIN
Scripts/Auto_Scrape_Screenshots/Error messages & alerts_1.png
Normal file
|
After Width: | Height: | Size: 93 KiB |
|
After Width: | Height: | Size: 96 KiB |
|
After Width: | Height: | Size: 127 KiB |
|
After Width: | Height: | Size: 119 KiB |
|
After Width: | Height: | Size: 92 KiB |
BIN
Scripts/Auto_Scrape_Screenshots/Items rejected by customer_1.png
Normal file
|
After Width: | Height: | Size: 79 KiB |
|
After Width: | Height: | Size: 115 KiB |
|
After Width: | Height: | Size: 93 KiB |
BIN
Scripts/Auto_Scrape_Screenshots/Order rejected by customer_1.png
Normal file
|
After Width: | Height: | Size: 97 KiB |
|
After Width: | Height: | Size: 117 KiB |
|
After Width: | Height: | Size: 103 KiB |
|
After Width: | Height: | Size: 103 KiB |
|
After Width: | Height: | Size: 100 KiB |
|
After Width: | Height: | Size: 84 KiB |
|
After Width: | Height: | Size: 94 KiB |
|
After Width: | Height: | Size: 88 KiB |
|
After Width: | Height: | Size: 77 KiB |
|
After Width: | Height: | Size: 93 KiB |
BIN
Scripts/Auto_Scrape_Screenshots/Produce shopping_1.png
Normal file
|
After Width: | Height: | Size: 96 KiB |
BIN
Scripts/Auto_Scrape_Screenshots/Questions about earnings?_1.png
Normal file
|
After Width: | Height: | Size: 84 KiB |
BIN
Scripts/Auto_Scrape_Screenshots/Receiving offers_1.png
Normal file
|
After Width: | Height: | Size: 94 KiB |
BIN
Scripts/Auto_Scrape_Screenshots/Referral incentives_1.png
Normal file
|
After Width: | Height: | Size: 114 KiB |
|
After Width: | Height: | Size: 89 KiB |
BIN
Scripts/Auto_Scrape_Screenshots/Resetting your password_1.png
Normal file
|
After Width: | Height: | Size: 86 KiB |
BIN
Scripts/Auto_Scrape_Screenshots/Resolving sign-in errors_1.png
Normal file
|
After Width: | Height: | Size: 70 KiB |
BIN
Scripts/Auto_Scrape_Screenshots/Resource Center_1.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
Scripts/Auto_Scrape_Screenshots/Returning an order_1.png
Normal file
|
After Width: | Height: | Size: 91 KiB |
BIN
Scripts/Auto_Scrape_Screenshots/Returns FAQs_1.png
Normal file
|
After Width: | Height: | Size: 151 KiB |
BIN
Scripts/Auto_Scrape_Screenshots/Reviewing your trips_1.png
Normal file
|
After Width: | Height: | Size: 90 KiB |
|
After Width: | Height: | Size: 88 KiB |
|
After Width: | Height: | Size: 106 KiB |
BIN
Scripts/Auto_Scrape_Screenshots/Shopping & Delivery FAQs_1.png
Normal file
|
After Width: | Height: | Size: 274 KiB |
|
After Width: | Height: | Size: 96 KiB |
|
After Width: | Height: | Size: 108 KiB |
BIN
Scripts/Auto_Scrape_Screenshots/Signing out_1.png
Normal file
|
After Width: | Height: | Size: 75 KiB |
BIN
Scripts/Auto_Scrape_Screenshots/Spill cleanup information_1.png
Normal file
|
After Width: | Height: | Size: 62 KiB |
|
After Width: | Height: | Size: 33 KiB |
|
After Width: | Height: | Size: 118 KiB |
|
After Width: | Height: | Size: 78 KiB |
|
After Width: | Height: | Size: 84 KiB |
@ -33,14 +33,14 @@ const getAllGroups = async (num) => {
|
||||
groupIds.push(res.data.data[i].id)
|
||||
}
|
||||
}
|
||||
//await getAllGroups(page);
|
||||
// await getAllGroups(page);
|
||||
} else {
|
||||
// for (let i = 0; i < res.data.data.length; i++) {
|
||||
// if (res.data.data[i].attributes.status == "live") {
|
||||
// console.log(res.data.data[i].attributes.name)
|
||||
// groupIds.push(res.data.data[i].id)
|
||||
// }
|
||||
// }
|
||||
for (let i = 0; i < res.data.data.length; i++) {
|
||||
if (res.data.data[i].attributes.status == "live") {
|
||||
console.log(res.data.data[i].attributes.name)
|
||||
groupIds.push(res.data.data[i].id)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
@ -59,7 +59,7 @@ function loopIds(i) {
|
||||
}
|
||||
|
||||
async function courseOverview(id, i, num) {
|
||||
console.log("Course Overview Function")
|
||||
// console.log("Course Overview Function")
|
||||
const activity = new Array();
|
||||
const url = "https://walmart.northpass.com/app/courses/";
|
||||
const browser = await puppeteer.launch();
|
||||
@ -71,6 +71,7 @@ async function courseOverview(id, i, num) {
|
||||
await browser.close();
|
||||
} else {
|
||||
await page.setViewport({ width:390, height:844 })
|
||||
// await page.setUserAgent('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3419.0 Safari/537.36');
|
||||
await page.goto(course, {
|
||||
waitUntil: 'load',
|
||||
timeout: 0 });
|
||||
@ -80,32 +81,35 @@ async function courseOverview(id, i, num) {
|
||||
const resourcetitle = await page.evaluate(name => name.innerText, getXpath);
|
||||
console.log(resourcetitle)
|
||||
const resource = resourcetitle.trim();
|
||||
console.log(resource);
|
||||
// console.log(resource);
|
||||
|
||||
await page.screenshot({path: `${resource}_1.png`, fullPage:true, headless:false});
|
||||
await page.screenshot({path: `${resource}_1.png`, fullPage:true, headless:"new"});
|
||||
|
||||
const hrefs = await page.$$eval('a', as => as.map(a => a.href));
|
||||
var links = Object.entries(hrefs);
|
||||
links.forEach(([key, value]) => {
|
||||
var link = value;
|
||||
if (link.includes("activities") && (link.includes(id))) {
|
||||
console.log("Activities Link")
|
||||
console.log(link);
|
||||
activity.push(link);
|
||||
}
|
||||
});
|
||||
setTimeout(() => {
|
||||
|
||||
}, 5000);
|
||||
}, 10000);
|
||||
uniqueLinks = [...new Set(activity)];
|
||||
for (const link of uniqueLinks) {
|
||||
|
||||
num = num+1
|
||||
const newlink = link+uid;
|
||||
console.log("New Link: " + newlink)
|
||||
await page.setViewport({ width: 390, height: 844 })
|
||||
await page.goto(newlink, {
|
||||
waitUntil: 'load',
|
||||
timeout: 0 });
|
||||
await page.screenshot({path: `${resource}_${num}.png`, fullPage: true, headless: false});
|
||||
//screenshots(newlink, resource, num, i);
|
||||
await page.screenshot({path: `${resource}_${num}.png`, fullPage: true, headless:"new"});
|
||||
screenshots(newlink, resource, num, i);
|
||||
}
|
||||
await browser.close();
|
||||
i++;
|
||||
|
||||
@ -1,84 +0,0 @@
|
||||
/* This function needs to run either once a day OR after a webhook that contains the course name.
|
||||
Date range: 2/1/23 - 7/31/23
|
||||
|
||||
Order of operations:
|
||||
- Parse Webhook, if course name == Coaching Certification, assignment == Practice Coaching Session 3 (PSA),
|
||||
Activity name == Step 1: Practice Coaching Session 3 - Recording Upload
|
||||
- GET List Assignments: https://api.northpass.com/v2/assignments/{assignment_uuid}/submissions
|
||||
- GET Person https://api.northpass.com/v2/people/{uuid}
|
||||
|
||||
Fill in columns: Date Submitted, Person's Name, Email, Assignment Name, Assignment Download Link.
|
||||
|
||||
|
||||
UUIDS:
|
||||
Activity: a94171bb-0184-433e-a62d-2b8c67ad196e
|
||||
Course: 03bb0fa0-df1f-4f40-b550-b59b113fd79f
|
||||
Assignment: a4e082a2-9416-4fdf-9ef6-a817e25d26ee
|
||||
API Key: HWxj6VTNPwbc3WghFTPzr7SjE
|
||||
*/
|
||||
|
||||
const sheet = SpreadsheetApp.getActiveSheet();
|
||||
const apiKey = "HWxj6VTNPwbc3WghFTPzr7SjE";
|
||||
var assign_uid = "a4e082a2-9416-4fdf-9ef6-a817e25d26ee"
|
||||
let page = 0;
|
||||
|
||||
function getAssignment() {
|
||||
var sheet = SpreadsheetApp.getActiveSheet();
|
||||
var api_url =
|
||||
'https://api.northpass.com/v2/assignments/'+assign_uid+'/submissions?page='+page;
|
||||
Logger.log(api_url)
|
||||
const settings = {
|
||||
async: true,
|
||||
crossDomain: true,
|
||||
method: 'GET',
|
||||
headers: {
|
||||
accept: 'application/json',
|
||||
'X-Api-Key': apiKey
|
||||
}
|
||||
}
|
||||
const sendMsg = UrlFetchApp.fetch(api_url, settings);
|
||||
var apiResponse = sendMsg.getContentText();
|
||||
var parsedata = JSON.parse(apiResponse);
|
||||
var data = parsedata["data"];
|
||||
if (data.length != 0){
|
||||
let rowArray = []
|
||||
for (item of data) {
|
||||
var submit_date = item["attributes"]["created_at"];
|
||||
var person = item["relationships"]["person"]["data"]["id"];
|
||||
var download_link = item["links"]["download"];
|
||||
var person_url = 'https://api.northpass.com/v2/people/'+person;
|
||||
const settings = {
|
||||
async: true,
|
||||
crossDomain: true,
|
||||
method: 'GET',
|
||||
headers: {
|
||||
accept: 'application/json',
|
||||
'X-Api-Key': apiKey
|
||||
}
|
||||
};
|
||||
const sendMsg = UrlFetchApp.fetch(person_url, settings);
|
||||
var uuidResponse = sendMsg.getContentText();
|
||||
var parsing = JSON.parse(uuidResponse);
|
||||
var info = parsing["data"]
|
||||
var full_name = info["attributes"]["full_name"];
|
||||
var email = info["attributes"]["email"];
|
||||
let rowArray = [submit_date, download_link, person, full_name, email];
|
||||
addToSheet(rowArray);
|
||||
};
|
||||
} else {
|
||||
|
||||
}
|
||||
page++;
|
||||
getAssignment(page);
|
||||
};
|
||||
|
||||
function addToSheet(rowArray){
|
||||
var sheet = SpreadsheetApp.getActiveSheet();
|
||||
var lastRow = Math.max(sheet.getLastRow(),1);
|
||||
|
||||
sheet.insertRowAfter(lastRow);
|
||||
sheet.getRange(lastRow + 1, 1).setValue(rowArray[0]);
|
||||
sheet.getRange(lastRow + 1, 2).setValue(rowArray[3]);
|
||||
sheet.getRange(lastRow + 1, 3).setValue(rowArray[4]);
|
||||
sheet.getRange(lastRow + 1, 4).setValue(rowArray[1]);
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
{"scriptId":"1lX_lzT7xRA-13vMq63ZPxBYj8fmz4UwgR403PV5juue1NW7sCi6NSWqq","rootDir":"/Users/normrasmussen/Documents/Work/Scripts/GoogleScripts/WildHealth_Assignments_PSA1"}
|
||||
@ -0,0 +1,87 @@
|
||||
/* This function needs to run either once a day OR after a webhook that contains the course name.
|
||||
Date range: 2/1/23 - 7/31/23
|
||||
|
||||
Order of operations:
|
||||
- Parse Webhook, if course name == Coaching Certification, assignment == Practice Coaching Session 3 (PSA),
|
||||
Activity name == Step 1: Practice Coaching Session 3 - Recording Upload
|
||||
- GET List Assignments: https://api.northpass.com/v2/assignments/{assignment_uuid}/submissions
|
||||
- GET Person https://api.northpass.com/v2/people/{uuid}
|
||||
|
||||
Fill in columns: Date Submitted, Person's Name, Email, Assignment Name, Assignment Download Link.
|
||||
|
||||
|
||||
UUIDS:
|
||||
Activity: a94171bb-0184-433e-a62d-2b8c67ad196e
|
||||
Course: 03bb0fa0-df1f-4f40-b550-b59b113fd79f
|
||||
Assignment: a4e082a2-9416-4fdf-9ef6-a817e25d26ee
|
||||
API Key: HWxj6VTNPwbc3WghFTPzr7SjE
|
||||
*/
|
||||
|
||||
const sheet = SpreadsheetApp.getActiveSheet();
|
||||
const apiKey = "HWxj6VTNPwbc3WghFTPzr7SjE";
|
||||
var assign_uid = "c6e05c41-082e-4027-9e2e-49d3c5a7c5a0"
|
||||
let page = 1;
|
||||
|
||||
function getAssignment() {
|
||||
var sheet = SpreadsheetApp.getActiveSheet();
|
||||
for (let page = 1; page <= 50; page++) {
|
||||
var api_url =
|
||||
'https://api.northpass.com/v2/assignments/'+assign_uid+'/submissions?page='+page;
|
||||
Logger.log(api_url)
|
||||
const settings = {
|
||||
async: true,
|
||||
crossDomain: true,
|
||||
method: 'GET',
|
||||
headers: {
|
||||
accept: 'application/json',
|
||||
'X-Api-Key': apiKey
|
||||
}
|
||||
}
|
||||
const sendMsg = UrlFetchApp.fetch(api_url, settings);
|
||||
var apiResponse = sendMsg.getContentText();
|
||||
var parsedata = JSON.parse(apiResponse);
|
||||
var data = parsedata["data"];
|
||||
if (data.length != 0){
|
||||
let rowArray = []
|
||||
for (item of data) {
|
||||
var submit_date = item["attributes"]["created_at"];
|
||||
var person = item["relationships"]["person"]["data"]["id"];
|
||||
Logger.log(person)
|
||||
var download_link = item["links"]["download"];
|
||||
var person_url = 'https://api.northpass.com/v2/people/'+person;
|
||||
const settings = {
|
||||
async: true,
|
||||
crossDomain: true,
|
||||
method: 'GET',
|
||||
headers: {
|
||||
accept: 'application/json',
|
||||
'X-Api-Key': apiKey
|
||||
}
|
||||
};
|
||||
const sendMsg = UrlFetchApp.fetch(person_url, settings);
|
||||
var uuidResponse = sendMsg.getContentText();
|
||||
var parsing = JSON.parse(uuidResponse);
|
||||
var info = parsing["data"]
|
||||
var full_name = info["attributes"]["full_name"];
|
||||
var email = info["attributes"]["email"];
|
||||
let rowArray = [submit_date, download_link, person, full_name, email];
|
||||
addToSheet(rowArray);
|
||||
};
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
//page++;
|
||||
//getAssignment(page);
|
||||
};
|
||||
|
||||
function addToSheet(rowArray){
|
||||
var sheet = SpreadsheetApp.getActiveSheet();
|
||||
var lastRow = Math.max(sheet.getLastRow(),1);
|
||||
|
||||
sheet.insertRowAfter(lastRow);
|
||||
sheet.getRange(lastRow + 1, 1).setValue(rowArray[0]);
|
||||
sheet.getRange(lastRow + 1, 2).setValue(rowArray[3]);
|
||||
sheet.getRange(lastRow + 1, 3).setValue(rowArray[4]);
|
||||
sheet.getRange(lastRow + 1, 4).setValue(rowArray[1]);
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
{"scriptId":"1Z2Q8woLoLOVUUJe_HthEJ8M9a27-EpGVXGVDf4__qGTcC89q3EkDi7r1","rootDir":"/Users/normrasmussen/Documents/Work/Scripts/GoogleScripts/WildHealth_Assignments_PSA2"}
|
||||
@ -0,0 +1,84 @@
|
||||
/* This function needs to run either once a day OR after a webhook that contains the course name.
|
||||
Date range: 2/1/23 - 7/31/23
|
||||
|
||||
Order of operations:
|
||||
- Parse Webhook, if course name == Coaching Certification, assignment == Practice Coaching Session 3 (PSA),
|
||||
Activity name == Step 1: Practice Coaching Session 3 - Recording Upload
|
||||
- GET List Assignments: https://api.northpass.com/v2/assignments/{assignment_uuid}/submissions
|
||||
- GET Person https://api.northpass.com/v2/people/{uuid}
|
||||
|
||||
Fill in columns: Date Submitted, Person's Name, Email, Assignment Name, Assignment Download Link.
|
||||
|
||||
|
||||
UUIDS:
|
||||
Activity: a94171bb-0184-433e-a62d-2b8c67ad196e
|
||||
Course: 03bb0fa0-df1f-4f40-b550-b59b113fd79f
|
||||
Assignment: a4e082a2-9416-4fdf-9ef6-a817e25d26ee
|
||||
API Key: HWxj6VTNPwbc3WghFTPzr7SjE
|
||||
*/
|
||||
|
||||
const sheet = SpreadsheetApp.getActiveSheet();
|
||||
const apiKey = "HWxj6VTNPwbc3WghFTPzr7SjE";
|
||||
var assign_uid = "17c5917a-2ee6-4d9f-af89-5831282fc64b"
|
||||
let page = 1;
|
||||
|
||||
function getAssignment() {
|
||||
var sheet = SpreadsheetApp.getActiveSheet();
|
||||
for (let page = 1; page <= 50; page++) {
|
||||
var api_url =
|
||||
'https://api.northpass.com/v2/assignments/'+assign_uid+'/submissions?page='+page;
|
||||
Logger.log(api_url)
|
||||
const settings = {
|
||||
async: true,
|
||||
crossDomain: true,
|
||||
method: 'GET',
|
||||
headers: {
|
||||
accept: 'application/json',
|
||||
'X-Api-Key': apiKey
|
||||
}
|
||||
}
|
||||
const sendMsg = UrlFetchApp.fetch(api_url, settings);
|
||||
var apiResponse = sendMsg.getContentText();
|
||||
var parsedata = JSON.parse(apiResponse);
|
||||
var data = parsedata["data"];
|
||||
if (data.length != 0){
|
||||
let rowArray = []
|
||||
for (item of data) {
|
||||
var submit_date = item["attributes"]["created_at"];
|
||||
var person = item["relationships"]["person"]["data"]["id"];
|
||||
var download_link = item["links"]["download"];
|
||||
var person_url = 'https://api.northpass.com/v2/people/'+person;
|
||||
const settings = {
|
||||
async: true,
|
||||
crossDomain: true,
|
||||
method: 'GET',
|
||||
headers: {
|
||||
accept: 'application/json',
|
||||
'X-Api-Key': apiKey
|
||||
}
|
||||
};
|
||||
const sendMsg = UrlFetchApp.fetch(person_url, settings);
|
||||
var uuidResponse = sendMsg.getContentText();
|
||||
var parsing = JSON.parse(uuidResponse);
|
||||
var info = parsing["data"]
|
||||
var full_name = info["attributes"]["full_name"];
|
||||
var email = info["attributes"]["email"];
|
||||
let rowArray = [submit_date, download_link, person, full_name, email];
|
||||
addToSheet(rowArray);
|
||||
};
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function addToSheet(rowArray){
|
||||
var sheet = SpreadsheetApp.getActiveSheet();
|
||||
var lastRow = Math.max(sheet.getLastRow(),1);
|
||||
|
||||
sheet.insertRowAfter(lastRow);
|
||||
sheet.getRange(lastRow + 1, 1).setValue(rowArray[0]);
|
||||
sheet.getRange(lastRow + 1, 2).setValue(rowArray[3]);
|
||||
sheet.getRange(lastRow + 1, 3).setValue(rowArray[4]);
|
||||
sheet.getRange(lastRow + 1, 4).setValue(rowArray[1]);
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
{
|
||||
"timeZone": "America/New_York",
|
||||
"dependencies": {
|
||||
},
|
||||
"exceptionLogging": "STACKDRIVER",
|
||||
"runtimeVersion": "V8"
|
||||
}
|
||||
@ -1 +1 @@
|
||||
{"scriptId":"1W9jVjAVjIivO2sj1flvoofftiZ4v0BgAMD_RPBsSTGZBcedPN_DUEW7m","rootDir":"/Users/normrasmussen/Documents/Work/Scripts/GoogleScripts/WildHealth_Assignments"}
|
||||
{"scriptId":"1W9jVjAVjIivO2sj1flvoofftiZ4v0BgAMD_RPBsSTGZBcedPN_DUEW7m","rootDir":"/Users/normrasmussen/Documents/Work/Scripts/GoogleScripts/WildHealth_Assignments_PSA3"}
|
||||
@ -0,0 +1,84 @@
|
||||
/* This function needs to run either once a day OR after a webhook that contains the course name.
|
||||
Date range: 2/1/23 - 7/31/23
|
||||
|
||||
Order of operations:
|
||||
- Parse Webhook, if course name == Coaching Certification, assignment == Practice Coaching Session 3 (PSA),
|
||||
Activity name == Step 1: Practice Coaching Session 3 - Recording Upload
|
||||
- GET List Assignments: https://api.northpass.com/v2/assignments/{assignment_uuid}/submissions
|
||||
- GET Person https://api.northpass.com/v2/people/{uuid}
|
||||
|
||||
Fill in columns: Date Submitted, Person's Name, Email, Assignment Name, Assignment Download Link.
|
||||
|
||||
|
||||
UUIDS:
|
||||
Activity: a94171bb-0184-433e-a62d-2b8c67ad196e
|
||||
Course: 03bb0fa0-df1f-4f40-b550-b59b113fd79f
|
||||
Assignment: a4e082a2-9416-4fdf-9ef6-a817e25d26ee
|
||||
API Key: HWxj6VTNPwbc3WghFTPzr7SjE
|
||||
*/
|
||||
|
||||
const sheet = SpreadsheetApp.getActiveSheet();
|
||||
const apiKey = "HWxj6VTNPwbc3WghFTPzr7SjE";
|
||||
var assign_uid = "a4e082a2-9416-4fdf-9ef6-a817e25d26ee"
|
||||
let page = 1;
|
||||
|
||||
function getAssignment() {
|
||||
var sheet = SpreadsheetApp.getActiveSheet();
|
||||
for (let page = 1; page <= 50; page++) {
|
||||
var api_url =
|
||||
'https://api.northpass.com/v2/assignments/'+assign_uid+'/submissions?page='+page;
|
||||
Logger.log(api_url)
|
||||
const settings = {
|
||||
async: true,
|
||||
crossDomain: true,
|
||||
method: 'GET',
|
||||
headers: {
|
||||
accept: 'application/json',
|
||||
'X-Api-Key': apiKey
|
||||
}
|
||||
}
|
||||
const sendMsg = UrlFetchApp.fetch(api_url, settings);
|
||||
var apiResponse = sendMsg.getContentText();
|
||||
var parsedata = JSON.parse(apiResponse);
|
||||
var data = parsedata["data"];
|
||||
if (data.length != 0){
|
||||
let rowArray = []
|
||||
for (item of data) {
|
||||
var submit_date = item["attributes"]["created_at"];
|
||||
var person = item["relationships"]["person"]["data"]["id"];
|
||||
var download_link = item["links"]["download"];
|
||||
var person_url = 'https://api.northpass.com/v2/people/'+person;
|
||||
const settings = {
|
||||
async: true,
|
||||
crossDomain: true,
|
||||
method: 'GET',
|
||||
headers: {
|
||||
accept: 'application/json',
|
||||
'X-Api-Key': apiKey
|
||||
}
|
||||
};
|
||||
const sendMsg = UrlFetchApp.fetch(person_url, settings);
|
||||
var uuidResponse = sendMsg.getContentText();
|
||||
var parsing = JSON.parse(uuidResponse);
|
||||
var info = parsing["data"]
|
||||
var full_name = info["attributes"]["full_name"];
|
||||
var email = info["attributes"]["email"];
|
||||
let rowArray = [submit_date, download_link, person, full_name, email];
|
||||
addToSheet(rowArray);
|
||||
};
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function addToSheet(rowArray){
|
||||
var sheet = SpreadsheetApp.getActiveSheet();
|
||||
var lastRow = Math.max(sheet.getLastRow(),1);
|
||||
|
||||
sheet.insertRowAfter(lastRow);
|
||||
sheet.getRange(lastRow + 1, 1).setValue(rowArray[0]);
|
||||
sheet.getRange(lastRow + 1, 2).setValue(rowArray[3]);
|
||||
sheet.getRange(lastRow + 1, 3).setValue(rowArray[4]);
|
||||
sheet.getRange(lastRow + 1, 4).setValue(rowArray[1]);
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
{
|
||||
"timeZone": "America/New_York",
|
||||
"dependencies": {
|
||||
},
|
||||
"exceptionLogging": "STACKDRIVER",
|
||||
"runtimeVersion": "V8"
|
||||
}
|
||||