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?
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)
From the repository source
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.