Bintray exposes APIs with which users can automatically download package files, specified by their URLs, using different tools. These tools depend on the repository type, package type, and other criteria, and may be build tools (such as Maven and Gradle), package management tools (such as Debian and RPM) and others (such as the HTTP client cURL). To download a file using APIs you need to specify the precise URL that corresponds to the file’s location within Bintray.
Files are stored in Bintray in a well-defined structure according to the repository and package in which they reside— as well as in an additional Target Repository Path that the file’s owner can specify while performing the upload.
A file’s URL is constructed as follows:
SUBJECT_NAMEis the Bintray user or organization that owns the repository.
USER_NAMEis your Bintray user name and
API_KEYis your Bintray API Key
API_KEYare optional parameters and are only needed when you are doing an authenticated download.)
REPO_NAMEis the name of the repository in which the file is stored
FILE_PATHis the full path to the file you want to download.
For example, to use cURL to download a file called: “myfile.bin” ,
that was uploaded using a Target Repository Path of “com/acme/projectx/rel15”,
to a repository called “myrepo”,
by a user whose username is “john”,
you would use the following line of code:
curl -u <YOUR USER_NAME>:<YOUR API_KEY> https://dl.bintray.com/acme/releases/rel15/module-x/installer.bin -o /tmp/installer.bin
As a convenience, each repository and package offers a Set Me Up! button, which displays a window showing download instructions for each tool that is relevant to the specific repository or package.
The example below shows a Set Me Up! window for a Maven repository. It includes instructions for download using the Maven client as well as general instructions in a line of cURL script that other tools can use:
Clicking the different options in this window displays instructions for the relevant procedure, with GUI screenshots or lines of code where necessary.
There are two cases in which you must include authentication credentials, your Bintray Username and your API Key.
The package is stored in a private repository.
(Exception: If you are downloading the package using a Signed URL, just use the URL provided to you without adding authentication details – that’s the purpose of Signed URLs)
- You are downloading an unpublished package from your own repository.
For more details on how to download files using REST, please refer to Download Content in the Bintray REST API documentation.