Added Talkspace templates, made some changes to Skuid's script and started the Blacklane script
This commit is contained in:
44
Scripts/API_Tests/addalltogroup.py
Normal file
44
Scripts/API_Tests/addalltogroup.py
Normal file
@ -0,0 +1,44 @@
|
||||
import requests
|
||||
|
||||
apiKey = "L93lGMSugtpmsBhSAkx3tei6B"
|
||||
|
||||
def getallUuid(apiKey):
|
||||
x = 0
|
||||
uuid = []
|
||||
while True:
|
||||
x += 1
|
||||
url = f"https://api.northpass.com/v2/people?page={x}"
|
||||
headers = {
|
||||
"accept": "application/json",
|
||||
"X-Api-Key": apiKey
|
||||
}
|
||||
response = requests.get(url, headers=headers)
|
||||
jsonResponse = response.json()
|
||||
|
||||
for id in jsonResponse["data"]:
|
||||
user = id["id"]
|
||||
uuid.append(user)
|
||||
|
||||
if jsonResponse["links"]["next"] == "":
|
||||
break
|
||||
print(uuid)
|
||||
|
||||
def addtoGroup(apiKey, uuid):
|
||||
for x in uuid:
|
||||
url = f"https://api.northpass.com/v2/people/{x}/relationships/groups"
|
||||
payload = {"data": [
|
||||
{
|
||||
"type": "membership-groups",
|
||||
"id": "GROUP ID"
|
||||
}]}
|
||||
headers = {
|
||||
"accept": "application/json",
|
||||
"content-type": "application/json",
|
||||
"X-Api-Key": apiKey
|
||||
}
|
||||
response = requests.post(url, json=payload, headers=headers)
|
||||
jsonResponse = response.json()
|
||||
print(jsonResponse)
|
||||
|
||||
if __name__ == "__main__":
|
||||
getallUuid(apiKey)
|
||||
Reference in New Issue
Block a user