diff --git a/Scripts/AIIM/shopify_groups_step4.py b/Scripts/AIIM/shopify_groups_step4.py new file mode 100644 index 00000000..cb553425 --- /dev/null +++ b/Scripts/AIIM/shopify_groups_step4.py @@ -0,0 +1,19 @@ +import requests +import json + +headers = {"Accept": "application/json", "X-Api-Key": "2SBAjkYGUoD0LqesDZq50RSex"} +def check_if_user_exists(searched_email, page_number): + url = "https://api.northpass.com/v2/people?page="+str(page_number)+"&limit=100" + response = requests.request("GET", url, headers=headers) + users_dict = json.loads(response.text) + for person in users_dict["data"]: + if person["attributes"]["email"] == searched_email: + return {"founded": True, "userid": person["id"]} + if len(users_dict["data"]) > 0 : + return check_if_user_exists(searched_email, page_number+1) + else: + return {"founded": False, "userid": None} + +email = input_data["email"] +return check_if_user_exists(email, 1) + diff --git a/Scripts/AIIM/shopify_groups_step7.py b/Scripts/AIIM/shopify_groups_step7.py new file mode 100644 index 00000000..e674b6aa --- /dev/null +++ b/Scripts/AIIM/shopify_groups_step7.py @@ -0,0 +1,23 @@ +import requests + +group_in_school = "baf22792-56c4-4961-89db-e635639b2665" +person_uuid = input_data["user_id"] + + +url = "https://api.northpass.com/v2/people/"+person_uuid+"/relationships/groups" + +payload = {"data": [ + { + "type": "membership-groups", + "id": group_in_school + } + ]} +headers = { + "Accept": "*/*", + "Content-Type": "application/json", + "X-Api-Key": "2SBAjkYGUoD0LqesDZq50RSex" +} + +response = requests.request("POST", url, json=payload, headers=headers) + +return response.text diff --git a/Scripts/API_Tests/bulk_invite_and_props.py b/Scripts/API_Tests/bulk_invite_and_props.py index 0d7fd36b..0dfca702 100644 --- a/Scripts/API_Tests/bulk_invite_and_props.py +++ b/Scripts/API_Tests/bulk_invite_and_props.py @@ -11,7 +11,7 @@ HEADERS = { "X-Api-Key": APIKEY, } BASEURL = "https://api.northpass.com/v2/" -IMPORTFILE = "/Users/normrasmussen/Downloads/cisa-12825.csv" +IMPORTFILE = "/Users/normrasmussen/Downloads/cisa-21125.csv" def bulk_invite_and_group():