Left over notes to save
This commit is contained in:
@ -1,18 +1,26 @@
|
||||
import requests
|
||||
import json
|
||||
import Apikeys
|
||||
|
||||
|
||||
# url ="https://api.northpass.com/v2/groups/e6ef3e5f-b5a2-4b10-868b-8c165d76d263/learning_paths"
|
||||
url = "https://api.northpass.com/v1/media?limit=1"
|
||||
# url = "https://api.northpass.com/v1/media?limit=1"
|
||||
url = "https://api.northpass.com/v1/learning_paths"
|
||||
# function = sys.argv[1]
|
||||
apiKey = Apikeys.talkspace_core
|
||||
apiKey = Apikeys.normsandbox
|
||||
normuuid = "0b31c435-c18b-4573-984e-32cda57045b4"
|
||||
|
||||
# Get Group Memberships:
|
||||
# url = "https://api.northpass.com/v2/groups/504c4771-223a-447f-9ec6-08e51bc9ca23/memberships"
|
||||
|
||||
# Associate a person with a course:
|
||||
# url = "https://api.northpass.com/v2/people/person_uuid/relationships/courses"
|
||||
|
||||
# Associate a person with a Learning Path (Test):
|
||||
url = f"https://api.northpass.com/v1/people/{normuuid}/relationships/learning_paths"
|
||||
|
||||
|
||||
def putTest(apiKey, url):
|
||||
|
||||
payload = {
|
||||
"data": {
|
||||
"type": "media",
|
||||
@ -35,22 +43,32 @@ def getTest(apiKey, url):
|
||||
response = requests.get(url, headers=headers)
|
||||
# print(response.text)
|
||||
jsonResponse = response.json()
|
||||
jsonResponse = json.dumps(jsonResponse, indent=2)
|
||||
print(jsonResponse)
|
||||
# print(jsonResponse["included"][1]["attributes"]["email"])
|
||||
# print(jsonResponse["data"][1]["attributes"])
|
||||
|
||||
|
||||
def postTest(apiKey, url):
|
||||
print(url)
|
||||
# Learning Path ID is for ID and change type to "enrolled-learning-paths"
|
||||
payload = {"data": [
|
||||
{
|
||||
"type": "enrolled-learning-paths",
|
||||
"id": "6ef5c9db-81d7-427c-846b-babb9a9a2ad1"
|
||||
}
|
||||
]}
|
||||
headers = {
|
||||
"accept": "application/json",
|
||||
"content-type": "application/json",
|
||||
"X-Api-Key": apiKey,
|
||||
}
|
||||
response = requests.post(url, headers=headers)
|
||||
response = requests.post(url, json=payload, headers=headers)
|
||||
print(response.text)
|
||||
print(response)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
getTest(apiKey, url)
|
||||
# getTest(apiKey, url)
|
||||
# putTest(apiKey, url)
|
||||
# postTest(apiKey, url):
|
||||
postTest(apiKey, url)
|
||||
|
||||
Reference in New Issue
Block a user