Mostly migration work. Some Api test script updates.

This commit is contained in:
Norm Rasmussen
2024-12-17 17:02:46 -05:00
parent 77f1b63e35
commit abfa25a4d4
9 changed files with 28 additions and 19 deletions

View File

@ -3,7 +3,6 @@ import requests
# JSON Payload for SCORM file
baseurl = "https://api.northpass.com"
endpoint = f"{baseUrl}/v2/migration/projects/{projectid}/items/{activityitemid}/activity_resources"
# Migration Sandbox Items
# projectid = "f33ce6c1-65cf-48a2-96c8-825beee2ff88"
@ -11,9 +10,14 @@ endpoint = f"{baseUrl}/v2/migration/projects/{projectid}/items/{activityitemid}/
# course_uuid = "07b97dea-ca66-4a9c-ae32-ebf3aa7205c2"
# Norm's Sandbox Items:
course_uuid = "5bee0361-3161-4d9b-9369-cba4bb4b2d84"
course_uuid = "1de95b11-f2b6-473c-9637-4a6b5f9f98be"
project_uuid = "a1a36fbf-f11e-40c7-add4-89a0ae7bf76c"
item_uuid = "3bec2531-705a-47c1-a1b6-5c68ec955698"
scorm_uuid = "a030164d-00b1-430c-8f41-211416d573e2"
section_uuid = "b6414605-9d43-4f27-9f85-bccd5928bafb"
apikey = apikeys.NORMSANDBOX
endpoint = f"{baseurl}/v2/migration/projects/{project_uuid}/items/{item_uuid}/activity_resources"
headers = { "X-Api-Key": apikey, "content-type": "application/json" }
payload = {
"data": [
@ -23,14 +27,15 @@ payload = {
"uuid": "6aeea279-e70e-40b8-98a0-776fa93779d8",
"display_name": "SCORM File 38",
"data": {
"name": "Introduction to Agile - SCORM",
"name": "Introduction to Agile SCORM",
"type": "activities/scorm_sco",
"course_id": course_uuid,
"section_id": "72efe0d0-b8ae-48db-ac71-cd2f450ec2e8",
"section_id": section_uuid,
"activity_attributes": {
"scorm_sco_id": "a1ee4933-74b9-4d5f-ab88-380db1d04d7a",
"upload_id": scorm_uuid,
"description": "Explore Agile as a concept and why it's effective in today's project environments. SCORM file",
"position": 5,
"body": scorm_uuid,
"position": 2
},
},
},
@ -38,6 +43,6 @@ payload = {
]
}
# post_load = requests.post(endpoint, headers=headers, json=payload)
post_load = requests.post(endpoint, headers=headers, json=payload)
print(post_load.text)
print(post_load.status_code)

View File

@ -309,10 +309,10 @@ def check_resources():
if __name__ == "__main__":
delete_all_projects()
# delete_all_projects()
# read_json_docs()
# create_project()
# get_all_projects()
get_all_projects()
# get_specific_project()
# create_enrollment()
# check_resources()

View File

@ -4,7 +4,7 @@ import pprint
PP = pprint.PrettyPrinter(indent=4)
APIKEY = apikeys.SANDBOX
APIKEY = apikeys.NORMSANDBOX
HEADERS = {"content-type": "application/json", "X-Api-Key": APIKEY}
BASEURL = "https://api.northpass.com/v2"