Started Harri script. Pushed groups for Anthology.
This commit is contained in:
@ -4,26 +4,39 @@ import Apikeys
|
|||||||
apikey = Apikeys.anthology
|
apikey = Apikeys.anthology
|
||||||
|
|
||||||
groups_to_create = [
|
groups_to_create = [
|
||||||
"Engage",
|
"Academic Economics",
|
||||||
"Encompass",
|
"Academy Use/Navigation",
|
||||||
"Reach",
|
"Accreditation",
|
||||||
"Student",
|
"Ally",
|
||||||
"Learn",
|
"Anthology 101",
|
||||||
"Baseline",
|
"Baseline",
|
||||||
"Ally",
|
"Beacon",
|
||||||
"Milestone",
|
"Course Evaluations",
|
||||||
"Raise",
|
"Evaluate",
|
||||||
"Accreditation",
|
"CVue",
|
||||||
"Program Review",
|
"Data Strategy",
|
||||||
"Portfolio",
|
"Digital Assistant",
|
||||||
"Outcomes",
|
"Encompass",
|
||||||
"Engage-Campus-wide Elections",
|
"Engage",
|
||||||
"Engage-Co-Curricular Paths",
|
"Faculty Development",
|
||||||
"Engage-ECIA",
|
"Finance & HCM",
|
||||||
"Engage-Rooms and Reservations",
|
"Insight",
|
||||||
"Learn-Bb Reporting",
|
"Learn",
|
||||||
"Learn-A4L",
|
"Milestone",
|
||||||
]
|
"Occupation Insight",
|
||||||
|
"Outcomes",
|
||||||
|
"Payroll",
|
||||||
|
"Planning",
|
||||||
|
"Portfolio",
|
||||||
|
"Power BI",
|
||||||
|
"Professional Development",
|
||||||
|
"Program Review",
|
||||||
|
"Radius",
|
||||||
|
"Raise",
|
||||||
|
"Reach",
|
||||||
|
"Student",
|
||||||
|
"Talisma",
|
||||||
|
]
|
||||||
|
|
||||||
url = "https://api.northpass.com/v2/bulk/groups"
|
url = "https://api.northpass.com/v2/bulk/groups"
|
||||||
headers = {
|
headers = {
|
||||||
@ -33,10 +46,15 @@ headers = {
|
|||||||
}
|
}
|
||||||
payload2 = []
|
payload2 = []
|
||||||
for group in groups_to_create:
|
for group in groups_to_create:
|
||||||
payload2.append({"name": group})
|
t1 = f"{group} - (T1)"
|
||||||
payload = {"data": {"attributes": {"groups": payload2}}}
|
t2 = f"{group} - (T2)"
|
||||||
|
t3 = f"{group} - (T3)"
|
||||||
|
|
||||||
# print(payload)
|
payload = {"data": {"attributes": {"groups":
|
||||||
response = requests.post(url, json=payload, headers=headers)
|
[{"name": t1},
|
||||||
print(response.text)
|
{"name": t2},
|
||||||
# print(response)
|
{"name": t3}]}}}
|
||||||
|
# print(payload)
|
||||||
|
response = requests.post(url, json=payload, headers=headers)
|
||||||
|
print(response.status_code)
|
||||||
|
print(response)
|
||||||
|
|||||||
3
Scripts/GoogleScripts/GetProps.js
Normal file
3
Scripts/GoogleScripts/GetProps.js
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
function getProps() {
|
||||||
|
|
||||||
|
}
|
||||||
1
Scripts/GoogleScripts/Harri_Get_Props/.clasp.json
Normal file
1
Scripts/GoogleScripts/Harri_Get_Props/.clasp.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"scriptId":"17cLm8wwin--btQr0A6G_QkxOeT2Q3QnL8mEup8ZThMTAPwrUw2qsyg6N","rootDir":"/Users/normrasmussen/Documents/Work/Scripts/GoogleScripts/Harri_Get_Props"}
|
||||||
87
Scripts/GoogleScripts/Harri_Get_Props/GetProps.js
Normal file
87
Scripts/GoogleScripts/Harri_Get_Props/GetProps.js
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
const sheet = SpreadsheetApp.getActiveSheet();
|
||||||
|
const apiKey = 'RfmxChNLLodO6M0Z88BwG9Xyu'
|
||||||
|
|
||||||
|
function getUuids() {
|
||||||
|
var sheet = SpreadsheetApp.getActiveSheet();
|
||||||
|
var numRows = sheet.getLastRow()-1; // Number of rows to process
|
||||||
|
var dataRange = sheet.getRange(2, 3, numRows, 1);
|
||||||
|
var values = dataRange.getValues();
|
||||||
|
writeHeadings();
|
||||||
|
|
||||||
|
for (email in values){
|
||||||
|
var row = values[email];
|
||||||
|
var email = row[0]
|
||||||
|
var api_url = 'https://api.northpass.com/v2/people/?filter[email][eq]='+email;
|
||||||
|
const settings = {
|
||||||
|
async: true,
|
||||||
|
crossDomain: true,
|
||||||
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
accept: 'application/json',
|
||||||
|
'X-Api-Key': apiKey
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const sendMsg = UrlFetchApp.fetch(api_url, settings);
|
||||||
|
var uuidResponse = sendMsg.getContentText();
|
||||||
|
var parsedata = JSON.parse(uuidResponse);
|
||||||
|
try {
|
||||||
|
var uuid = parsedata["data"][0]["id"];
|
||||||
|
if (email != "") {
|
||||||
|
findRow(email, uuid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(ex) {
|
||||||
|
Logger.log(ex)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
function findRow(email, uuid){
|
||||||
|
var sheetRow = SpreadsheetApp.getActiveSpreadsheet();
|
||||||
|
var data = sheetRow.getDataRange().getValues();
|
||||||
|
for(var i = 0; i<data.length;i++){
|
||||||
|
if(data[i][2] == email){ //[1] because column B
|
||||||
|
// Logger.log((i+1))
|
||||||
|
var row = i+1;
|
||||||
|
propstoSheet(uuid, row, email);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function propstoSheet(uuid, row, email) {
|
||||||
|
var uuid_url = 'https://api.northpass.com/v2/properties/people/'+uuid;
|
||||||
|
const settings = {
|
||||||
|
async: true,
|
||||||
|
crossDomain: true,
|
||||||
|
url: uuid_url,
|
||||||
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
accept: 'application/json',
|
||||||
|
'X-Api-Key': apiKey,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const sendMsg = UrlFetchApp.fetch(uuid_url, settings);
|
||||||
|
var txtResponse = sendMsg.getContentText();
|
||||||
|
var parseProps = JSON.parse(txtResponse);
|
||||||
|
var role = parseProps["data"]["attributes"]["properties"]["role_type"];
|
||||||
|
var user_id = parseProps["data"]["attributes"]["properties"]["user_id"];
|
||||||
|
var paid = parseProps["data"]["attributes"]["properties"]["paid"];
|
||||||
|
|
||||||
|
// Write the Data to each row and column
|
||||||
|
sheet.getRange(row, 13).setValue(role);
|
||||||
|
sheet.getRange(row, 14).setValue(user_id);
|
||||||
|
sheet.getRange(row, 15).setValue(paid);
|
||||||
|
// Logger.log(row + "," + email);
|
||||||
|
}
|
||||||
|
|
||||||
|
function writeHeadings() {
|
||||||
|
// Write the new Column Headings
|
||||||
|
sheet.getRange(1, 13).setValue("Role");
|
||||||
|
sheet.getRange(1, 14).setValue("ID Number");
|
||||||
|
sheet.getRange(1, 14).clearFormat();
|
||||||
|
sheet.getRange(1, 15).setValue("Paid?");
|
||||||
|
}
|
||||||
|
}
|
||||||
7
Scripts/GoogleScripts/Harri_Get_Props/appsscript.json
Normal file
7
Scripts/GoogleScripts/Harri_Get_Props/appsscript.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"timeZone": "America/New_York",
|
||||||
|
"dependencies": {
|
||||||
|
},
|
||||||
|
"exceptionLogging": "STACKDRIVER",
|
||||||
|
"runtimeVersion": "V8"
|
||||||
|
}
|
||||||
@ -1,30 +0,0 @@
|
|||||||
{% include "header" %}
|
|
||||||
{% include "course_version_outdated_alert", courses: courses.enrolled %}
|
|
||||||
{% include "sub_navigation" %}
|
|
||||||
<main class="np-main np-dashboard np-subpage-container np-max-width">
|
|
||||||
<div class="row np-flex-center">
|
|
||||||
<div class="col-xs-12 col-sm-8">
|
|
||||||
{% if features.learning_paths? %}
|
|
||||||
<div class="np-dashboard-resources-title">
|
|
||||||
{% t shared.learning_paths %}
|
|
||||||
</div>
|
|
||||||
{% include "learning_paths_index", items: learning_paths.enrolled %}
|
|
||||||
{% endif %}
|
|
||||||
<div class="np-dashboard-resources-title">
|
|
||||||
{% t shared.course_vocabulary.plural, key: current_school.course_vocabulary %}
|
|
||||||
</div>
|
|
||||||
{% include "courses_index", class: "col-xs-12 col-sm-6 np-stretch-content" %}
|
|
||||||
</div>
|
|
||||||
{% if features.training_events? %}
|
|
||||||
<div class="np-grid-spacing col-xs-12 col-sm-4">
|
|
||||||
<div class="np-dashboard-resources-title">
|
|
||||||
{% t .upcoming_events %}
|
|
||||||
</div>
|
|
||||||
{% include "training_events_dashboard" %}
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</main>
|
|
||||||
{% include "footer" %}
|
|
||||||
|
|
||||||
current_page: "/app/user-guides"
|
|
||||||
Reference in New Issue
Block a user