DV,Walmart, API Tests
This commit is contained in:
44
Scripts/API_Tests/api_test.py
Normal file
44
Scripts/API_Tests/api_test.py
Normal file
@ -0,0 +1,44 @@
|
||||
import requests
|
||||
|
||||
apiKey = "SlpQlju219WnWogn94dQUT6Yt"
|
||||
url = "https://api.northpass.com/v1/media"
|
||||
#function = sys.argv[1]
|
||||
|
||||
def putTest(apiKey, url):
|
||||
|
||||
payload = {
|
||||
"data":
|
||||
{
|
||||
"type":"media",
|
||||
"file_name":"/Users/normrasmussen/Downloads/Shopping&Delivery 9 XP.mp4",
|
||||
}
|
||||
}
|
||||
headers = {
|
||||
"accept": "application/json",
|
||||
"content-type": "application/json",
|
||||
"X-Api-Key": apiKey,
|
||||
}
|
||||
response = requests.put(url, json=payload, headers=headers)
|
||||
print(response.text)
|
||||
|
||||
def getTest(apiKey,url):
|
||||
headers = {
|
||||
"accept": "application/json",
|
||||
"X-Api-Key": apiKey
|
||||
}
|
||||
response = requests.get(url, headers=headers)
|
||||
print(response.text)
|
||||
|
||||
def postTest(apiKey, url):
|
||||
headers = {
|
||||
"accept": "application/json",
|
||||
"content-type": "application/json",
|
||||
"X-Api-Key": apiKey
|
||||
}
|
||||
response = requests.post(url, headers=headers)
|
||||
print(response.text)
|
||||
|
||||
if __name__ == "__main__":
|
||||
getTest(apiKey, url)
|
||||
#putTest(apiKey, url)
|
||||
#postTest(apiKey, url)
|
||||
38
Scripts/API_Tests/console_medialib.html
Normal file
38
Scripts/API_Tests/console_medialib.html
Normal file
@ -0,0 +1,38 @@
|
||||
<script
|
||||
type="application/json"
|
||||
class="js-react-on-rails-component"
|
||||
data-component-name="TableBox"
|
||||
data-dom-id="TableBox-react-component-4c1d0baa-eca8-4312-8626-591abf094ee4">
|
||||
{
|
||||
"token":"eyJhbGciOiJIUzI1NiJ9.eyJhcGlfa2V5IjoiU2xwUWxqdTIxOVduV29nbjk0ZFFVVDZZdCIsImV4cCI6MTY2NzU2NTg1Nn0.CFD30gpbrwsY1LnddlfvpI1LUojrtK723MTNyeQqixM",
|
||||
"columns":[
|
||||
{
|
||||
"name":"Name",
|
||||
"field":"name",
|
||||
"link":"teaching/show",
|
||||
"sort":true
|
||||
},
|
||||
{
|
||||
"name":"File Name",
|
||||
"field":"fileName",
|
||||
"link":"teaching/show",
|
||||
"sort":true
|
||||
},
|
||||
{
|
||||
"name":"Asset Type",
|
||||
"field":"assetType",
|
||||
"as":"i18n",
|
||||
"sort":"type",
|
||||
"formatOptions":
|
||||
{
|
||||
"scope":"media.asset_type"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name":"Status",
|
||||
"field":"status",
|
||||
"as":"status",
|
||||
"formatOptions":
|
||||
{
|
||||
"errorMessageField":"status_message","i18nScope":"media.asset_status"},"sort":true},{"name":"Date Uploaded","field":"createdAt","as":"date_time","sort":true}],"filterMessage":"","initialHeader":"","initialMessage":"","loadingHeader":"","loadingMessage":"","noDataHeader":"Looks like you haven't uploaded any media assets yet!","noDataMessage":"Start uploading your first asset by clicking the button above.","url":"https://api.northpass.com/v1/media","filters":[{"name":"Asset Type","field":"type","options":[{"label":"Documents","value":"Uploads::Document"},{"label":"Presentations","value":"Uploads::Presentation"},{"label":"Videos","value":"Uploads::Video"},{"label":"SCORM","value":"Uploads::Scorm"}]},{"name":"Asset Status","field":"status","options":[{"label":"Queued","value":"queued"},{"label":"Processing","value":"processing"},{"label":"Ready","value":"ready"},{"label":"Error","value":"error"},{"label":"Replacing","value":"replacing"},{"label":"Error replacing","value":"error_replacing"}]}],"itemActions":[{"action":"delete","behavior":"deprecated_confirm_modal","behaviorOptions":{"disabledCondition":{"status":"replacing"},"hiddenCondition":{"status":"error_replacing"},"confirmButtonOptions":{"classes":["np-button--danger"],"text":"I understand, please delete."},"deleteHeader":"Are you sure you want to delete this file?","modalContent":"delete_media"}},{"action":"edit"},{"action":"replace","behaviorOptions":{"disabledCondition":{"status":"replacing"},"hiddenCondition":{"replaceable":false},"requirement":{"status":"ready"}}},{"action":"download","behaviorOptions":{"disabledCondition":{"status":"replacing"},"hiddenCondition":{"status":"error_replacing"}}},{"action":"Dismiss Error","behavior":"dismiss_error_link","behaviorOptions":{"buttonClassNames":"uk-dropdown-button","disabledCondition":{"status":"replacing"},"hiddenCondition":{"status":"not_error_replacing"}}},{"action":"create_course_from_file","behaviorOptions":{"hiddenCondition":[{"status":"not_ready"},{"assetType":"not_scorm_single"}],"method":"post"}}],"options":{"search":true,"classNames":[]}}</script><div id="TableBox-react-component-4c1d0baa-eca8-4312-8626-591abf094ee4"></div>
|
||||
|
||||
Reference in New Issue
Block a user