Skip to main content

Hi,

 

Is there a way to download files/folders by name? It is possible to download using the folderid/fileid. But I wanna method to download by using the name.

 

Thank you in advance.



You can use the Search endpoint or you can search through the names in an item_collection of a folder and go down the path tree that way.

 

https://developer.box.com/reference#searching-for-content

https://developer.box.com/docs/search-for-content




I tried this method but I didn't get the file information.  Check the code I have used, 

 

search_term = 'Welcome to Box.pdf'
type = 'file' # file, folder, or web_link
limit = 10
offset = 0

# Set search config fields
content = client.search().query(search_term, result_type=type, limit=limit, offset=offset)
print(content.__dict__)

Output: 

{'_session': , '_url': 'https://api.box.com/2.0/search', '_limit': 10, '_fields': None, '_additional_params': {'query': 'Welcome to Box.pdf', 'type': 'file'}, '_return_full_pages': False, '_has_retrieved_all_items': False, '_all_items': None, '_offset': 0}

 

Item did not get searched. What is the mistake I have done? Please explain.

 

Thank you in advance.

 



Reply