Force download of ipynb

Karan Vaswani
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 10, 2023

I am storing ipynb Jupyter notebook files. I want to use the link to the file to auto download to the computer. What change do I need to make to the URL to force that? 

1 answer

0 votes
Ben
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 11, 2023

G'day Karan!

Welcome to the Bitbucket Cloud Community :)

May I confirm first - do you want to download files from your repository source? Or from the Downloads section that is found in Repository Settings > Downloads

Cheers!

- Ben (Bitbucket Cloud Support)

Karan Vaswani
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 16, 2023

From the repository source

Ben
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 17, 2023

Hi Karan,

Unfortunately, there is no effective method for downloading specific groups of files from the repository source using a URL alone as authentication needs to take place, therefore using our /2.0/repositories API is the recommended method.

For example - here is a CURL command that will download a given file from your repository source. It will work with any extension of file that is present in your repository. You would need to specify your username and App Password (for auth purposes) as well as the workspaceID, repositoryslug, branch and filename:

curl -L -u <username>:<AppPassword> https://api.bitbucket.org/2.0/repositories/<workspaceID>/<repositoryslug>/src/<branchname>/<filename>.<ext> --output <destinationfilename>.<ext>

However, by taking a look at the URL used in the API query, you can modify this slightly to have a static link that will open in a browser outside of the API (as long as you have an actively logged-in session with Bitbucket Cloud). The problem here is - if it is a text-based file this will preview in the browser by default, whereas only non-text files will download automatically. This is why I believe it would not work for your Jupyter notebook files specifically:

https://bitbucket.org/!api/2.0/repositories/<workspaceID>/<repositoryslug>/src/<branchname>/<filename>.<ext>

Hope this helps, @Karan Vaswani 

Cheers!

- Ben (Bitbucket Cloud Support)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events