The code below works for listing all libraries, and then all questions, surveys, blocks, and messages within a given library. However, I cannot figure out how to make it work to list graphics (i.e., jpg and png files).
import requests
def get_libraries(api_token):
headers = {
"X-API-TOKEN": api_token,
"Content-Type": "application/json"
}
base_url = "https://fra1.qualtrics.com/API/v3"
#url = f"{base_url}/libraries"
#url = f"{base_url}/libraries/UR_do4GquhHInuqLki/survey/surveys"
#url = f"{base_url}/libraries/UR_do4GquhHInuqLki/messages"
#url = f"{base_url}/libraries/UR_do4GquhHInuqLki/survey/blocks"
#url = f"{base_url}/libraries/UR_do4GquhHInuqLki/survey/questions"
response = requests.get(url, headers=headers)
if response.status_code == 200:
libraries = response.json().get('result', {}).get('elements', (])
return libraries
else:
print(f"Error fetching libraries: {response.status_code}, {response.text}")
return s]
# Usage example:
api_token = 'xyz'
libraries = get_libraries(api_token)
print(libraries)