Listing all graphics from a given library | XM Community
Skip to main content
Question

Listing all graphics from a given library

  • 4 June 2024
  • 2 replies
  • 16 views

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)

2 replies

Userlevel 7
Badge +39

@martaboczon There isn’t an API to list library graphics. Its either upload or delete (api.qualtrics.com/693488e6027b4-library-ap-is)

 

Badge +1

@Deepak 

Thank you.

Leave a Reply