SJ api calls folder. Added a script for DeepL.
This commit is contained in:
Binary file not shown.
47
Scripts/API_Tests/get_all_people_toggle_prop.py
Normal file
47
Scripts/API_Tests/get_all_people_toggle_prop.py
Normal file
@ -0,0 +1,47 @@
|
||||
import requests
|
||||
import Apikeys
|
||||
import pprint
|
||||
|
||||
|
||||
|
||||
pp=pprint.PrettyPrinter(indent=4)
|
||||
APIKEY = Apikeys.DEEPL
|
||||
BASEURL = "https://api.northpass.com/v2"
|
||||
HEADERS = {
|
||||
"accept": "application/json",
|
||||
"X-Api-Key": APIKEY
|
||||
}
|
||||
|
||||
def get_people():
|
||||
count = 0
|
||||
while True:
|
||||
ppl_uuids = []
|
||||
url = f"{BASEURL}/people?page={count}&limit=100"
|
||||
print(url)
|
||||
count += 1
|
||||
response = requests.get(url, headers=HEADERS).json()
|
||||
for data in response['data']:
|
||||
person_uuid = data['id']
|
||||
ppl_uuids.append(person_uuid)
|
||||
if len(ppl_uuids) == 10:
|
||||
print(len(ppl_uuids))
|
||||
apply_prop(ppl_uuids)
|
||||
# break
|
||||
|
||||
def apply_prop(ppl_uuids):
|
||||
inserted_load = []
|
||||
for person in ppl_uuids:
|
||||
print(person)
|
||||
miniload = {
|
||||
"attributes": { "properties": { "new_content": "true" } },
|
||||
"id": person,
|
||||
"type": "person_properties"
|
||||
}
|
||||
inserted_load.append(miniload)
|
||||
prop_url = f"{BASEURL}/properties/people/bulk"
|
||||
payload = { "data": inserted_load }
|
||||
print(payload)
|
||||
# apply_payload = requests.posts(prop_url, json=payload, headers=HEADERS)
|
||||
|
||||
if __name__ == "__main__":
|
||||
get_people()
|
||||
1
Scripts/Skilljar/Apikeys.py
Normal file
1
Scripts/Skilljar/Apikeys.py
Normal file
@ -0,0 +1 @@
|
||||
NORMSANDBOX = "sk-live-1fe9249b2c81caa3cd7f336c8c080041762d82d4"
|
||||
BIN
Scripts/Skilljar/__pycache__/Apikeys.cpython-310.pyc
Normal file
BIN
Scripts/Skilljar/__pycache__/Apikeys.cpython-310.pyc
Normal file
Binary file not shown.
13
Scripts/Skilljar/get_users.py
Normal file
13
Scripts/Skilljar/get_users.py
Normal file
@ -0,0 +1,13 @@
|
||||
import requests
|
||||
import base64
|
||||
import Apikeys
|
||||
|
||||
APIKEY = base64.b64encode(Apikeys.NORMSANDBOX.encode()).decode()
|
||||
HEADERS = { "Authorization": f"Basic {APIKEY}" }
|
||||
BASE = "https://api.skilljar.com/v1"
|
||||
|
||||
url = f"{BASE}/users"
|
||||
req = requests.get(url, headers=HEADERS).json()
|
||||
print(req)
|
||||
|
||||
|
||||
111
Scripts/tmp.json
111
Scripts/tmp.json
@ -1 +1,110 @@
|
||||
{"data":[{"id":"ec77d3b5-3ad0-4a6f-a3a3-93b00b32cf73","type":"EventDelivery","attributes":{"name":"services.v2.events.plan.updated","attempt":1,"payload":{"data":{"type":"Plan","id":"79593263","attributes":{"created_at":"2025-03-24T16:35:23Z","dates":"May 4, 2025","files_expire_at":"2025-05-19T11:34:10Z","last_time_at":"2025-05-04T10:35:00Z","multi_day":false,"needed_positions_count":3,"other_time_count":1,"plan_notes_count":2,"plan_people_count":9,"planning_center_url":"https://services.planningcenteronline.com/plans/79593263","public":false,"rehearsal_time_count":2,"series_title":null,"service_time_count":2,"short_dates":"May 4","sort_date":"2025-05-04T09:05:00Z","title":null,"total_length":3945,"updated_at":"2025-04-23T19:52:42Z"},"relationships":{"service_type":{"data":{"type":"ServiceType","id":"966664"}},"series":{"data":null},"created_by":{"data":{"type":"Person","id":"3989836"}},"updated_by":{"data":{"type":"Person","id":"47417549"}},"linked_publishing_episode":{"data":null}},"links":{"all_attachments":"https://api.planningcenteronline.com/services/v2/service_types/966664/plans/79593263/all_attachments","attachments":"https://api.planningcenteronline.com/services/v2/service_types/966664/plans/79593263/attachments","attendances":"https://api.planningcenteronline.com/services/v2/service_types/966664/plans/79593263/attendances","autoschedule":"https://api.planningcenteronline.com/services/v2/service_types/966664/plans/79593263/autoschedule","contributors":"https://api.planningcenteronline.com/services/v2/service_types/966664/plans/79593263/contributors","import_template":"https://api.planningcenteronline.com/services/v2/service_types/966664/plans/79593263/import_template","item_reorder":"https://api.planningcenteronline.com/services/v2/service_types/966664/plans/79593263/item_reorder","items":"https://api.planningcenteronline.com/services/v2/service_types/966664/plans/79593263/items","live":"https://api.planningcenteronline.com/services/v2/service_types/966664/plans/79593263/live","my_schedules":"https://api.planningcenteronline.com/services/v2/service_types/966664/plans/79593263/my_schedules","needed_positions":"https://api.planningcenteronline.com/services/v2/service_types/966664/plans/79593263/needed_positions","next_plan":"https://api.planningcenteronline.com/services/v2/service_types/966664/plans/79593263/next_plan","notes":"https://api.planningcenteronline.com/services/v2/service_types/966664/plans/79593263/notes","plan_times":"https://api.planningcenteronline.com/services/v2/service_types/966664/plans/79593263/plan_times","previous_plan":"https://api.planningcenteronline.com/services/v2/service_types/966664/plans/79593263/previous_plan","series":null,"signup_teams":"https://api.planningcenteronline.com/services/v2/service_types/966664/plans/79593263/signup_teams","team_members":"https://api.planningcenteronline.com/services/v2/service_types/966664/plans/79593263/team_members","self":"https://api.planningcenteronline.com/services/v2/service_types/966664/plans/79593263","html":"https://services.planningcenteronline.com/plans/79593263"}},"included":[],"meta":{"can_include":["contributors","my_schedules","plan_times","series"],"parent":{"id":"966664","type":"ServiceType"},"event_time":"2025-04-23T19:54:44Z","idempotency_token":"01966437-8c15-7af1-9352-63c74e8e4cdb"}}},"relationships":{"organization":{"data":{"type":"Organization","id":"60435"}}}}]}
|
||||
{
|
||||
"data": [
|
||||
{
|
||||
"id": "ec77d3b5-3ad0-4a6f-a3a3-93b00b32cf73",
|
||||
"type": "EventDelivery",
|
||||
"attributes": {
|
||||
"name": "services.v2.events.plan.updated",
|
||||
"attempt": 1,
|
||||
"payload": {
|
||||
"data": {
|
||||
"type": "Plan",
|
||||
"id": "79593263",
|
||||
"attributes": {
|
||||
"created_at": "2025-03-24T16:35:23Z",
|
||||
"dates": "May 4, 2025",
|
||||
"files_expire_at": "2025-05-19T11:34:10Z",
|
||||
"last_time_at": "2025-05-04T10:35:00Z",
|
||||
"multi_day": false,
|
||||
"needed_positions_count": 3,
|
||||
"other_time_count": 1,
|
||||
"plan_notes_count": 2,
|
||||
"plan_people_count": 9,
|
||||
"planning_center_url": "https://services.planningcenteronline.com/plans/79593263",
|
||||
"public": false,
|
||||
"rehearsal_time_count": 2,
|
||||
"series_title": null,
|
||||
"service_time_count": 2,
|
||||
"short_dates": "May 4",
|
||||
"sort_date": "2025-05-04T09:05:00Z",
|
||||
"title": null,
|
||||
"total_length": 3945,
|
||||
"updated_at": "2025-04-23T19:52:42Z"
|
||||
},
|
||||
"relationships": {
|
||||
"service_type": {
|
||||
"data": {
|
||||
"type": "ServiceType",
|
||||
"id": "966664"
|
||||
}
|
||||
},
|
||||
"series": {
|
||||
"data": null
|
||||
},
|
||||
"created_by": {
|
||||
"data": {
|
||||
"type": "Person",
|
||||
"id": "3989836"
|
||||
}
|
||||
},
|
||||
"updated_by": {
|
||||
"data": {
|
||||
"type": "Person",
|
||||
"id": "47417549"
|
||||
}
|
||||
},
|
||||
"linked_publishing_episode": {
|
||||
"data": null
|
||||
}
|
||||
},
|
||||
"links": {
|
||||
"all_attachments": "https://api.planningcenteronline.com/services/v2/service_types/966664/plans/79593263/all_attachments",
|
||||
"attachments": "https://api.planningcenteronline.com/services/v2/service_types/966664/plans/79593263/attachments",
|
||||
"attendances": "https://api.planningcenteronline.com/services/v2/service_types/966664/plans/79593263/attendances",
|
||||
"autoschedule": "https://api.planningcenteronline.com/services/v2/service_types/966664/plans/79593263/autoschedule",
|
||||
"contributors": "https://api.planningcenteronline.com/services/v2/service_types/966664/plans/79593263/contributors",
|
||||
"import_template": "https://api.planningcenteronline.com/services/v2/service_types/966664/plans/79593263/import_template",
|
||||
"item_reorder": "https://api.planningcenteronline.com/services/v2/service_types/966664/plans/79593263/item_reorder",
|
||||
"items": "https://api.planningcenteronline.com/services/v2/service_types/966664/plans/79593263/items",
|
||||
"live": "https://api.planningcenteronline.com/services/v2/service_types/966664/plans/79593263/live",
|
||||
"my_schedules": "https://api.planningcenteronline.com/services/v2/service_types/966664/plans/79593263/my_schedules",
|
||||
"needed_positions": "https://api.planningcenteronline.com/services/v2/service_types/966664/plans/79593263/needed_positions",
|
||||
"next_plan": "https://api.planningcenteronline.com/services/v2/service_types/966664/plans/79593263/next_plan",
|
||||
"notes": "https://api.planningcenteronline.com/services/v2/service_types/966664/plans/79593263/notes",
|
||||
"plan_times": "https://api.planningcenteronline.com/services/v2/service_types/966664/plans/79593263/plan_times",
|
||||
"previous_plan": "https://api.planningcenteronline.com/services/v2/service_types/966664/plans/79593263/previous_plan",
|
||||
"series": null,
|
||||
"signup_teams": "https://api.planningcenteronline.com/services/v2/service_types/966664/plans/79593263/signup_teams",
|
||||
"team_members": "https://api.planningcenteronline.com/services/v2/service_types/966664/plans/79593263/team_members",
|
||||
"self": "https://api.planningcenteronline.com/services/v2/service_types/966664/plans/79593263",
|
||||
"html": "https://services.planningcenteronline.com/plans/79593263"
|
||||
}
|
||||
},
|
||||
"included": [],
|
||||
"meta": {
|
||||
"can_include": [
|
||||
"contributors",
|
||||
"my_schedules",
|
||||
"plan_times",
|
||||
"series"
|
||||
],
|
||||
"parent": {
|
||||
"id": "966664",
|
||||
"type": "ServiceType"
|
||||
},
|
||||
"event_time": "2025-04-23T19:54:44Z",
|
||||
"idempotency_token": "01966437-8c15-7af1-9352-63c74e8e4cdb"
|
||||
}
|
||||
}
|
||||
},
|
||||
"relationships": {
|
||||
"organization": {
|
||||
"data": {
|
||||
"type": "Organization",
|
||||
"id": "60435"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user