Page Contents

Overview

This tutorial assumes you have created a generic repository in your account, and goes through the steps of uploading a zip file to it using the UI and using cURL, and then publishing it using Bintray's REST API. Along the way we will see how to create a package and a version.

Uploading via the UI

Since you cannot upload files anonymously, this tutorial assumes you have created your account and are logged in.

Creating a Package and Version

To start, let’s view the repository page of the generic repository.

Action

Result

On the Bintray homepage, click the generic repository icon
Generic repository icon

Bintray displays the repository page
Generic repository page

To create a new package, click the Add New Package button

Bintray displays the "Create New Package" page.

Fill the fields on the page. The only 3 fields that are required are:
- Name: Fill in a name for your package.
- Licenses: These are open source licenses associated with your package. For now, you can click in the field and select Unlicense.
- Version control: This points to where you manage source control for your package. For now, enter http://github.com.

Click Create Package.

The package is created and Bintray displays its "Edit" page in case you want to add more details.
Edit package

To finish creating your package, pick the package name on the top.

Bintray displays the Package page for the newly created package.

Package page

Now you need to create a new version for your package.
To create a new version, click the New version link on the package page

Bintray displays the Create New Version page.

Create new version

Fill in the details and click Create Version

The version is created and Bintray displays the Edit Version page.

Edit version

Click the version name link.

Bintray displays the Version page.

Version page;

Uploading a File

Now that you have created a package and a version in your generic repository, you are ready to upload a file. For the purposes of this tutorial, we suggest you create a dummy zip file to upload.

Action

Result

On the Version page, click Upload Files

Bintray displays the Upload Files work area.

Uploading files

You may (optionally) specify a path within the repository where the files should be stored. You can now upload your file in several ways: click to display the file selection dialog, drag and drop your file, or specify a URL from which the file can be uploaded.

Once your file is uploaded, it will be displayed under Attached Files

Attached files

To finalize file upload, you must click Save Changes.

Bintray displays the Version page showing the newly uploaded file. The file icon displays a green dot to indicate that it’s not published yet.

File uploaded

While the file is uploaded, it is not visible to anyone else until you publish it. Bintray gives you a week to publish a newly uploaded file after which it will be automatically deleted.
To publish your file, click the "Publish" link.

It may take Bintray a few seconds to complete publishing your file, but once publishing is completed, the file is displayed without the green dot on the icon.

Published file

Uploading Using cURL

Just like you can download using cURL, you can also upload files.

Getting your API Key

Since you need to be authenticated in order to upload a file, you will need your API key to upload a file using cURL. You can generate an API Key on your Edit Your Profile page.

Action

Result

Hover over your user name in Bintray’s header ribbon and select Your Profile from the menu. On your Profile page click Edit to display the Edit Your Profile page. Now, select API Key.

Generate an API key

To generate an API key, click "Generate one"

Bintray generates an API key.
"

Click the "Copy" icon to copy your API key and save it somewhere.

Using "Set Me Up"

Mirroring the process for downloading, you can also click "Set Me Up" on your repository to get the cURL command needed to upload your file.

Action

Result

Go back to the Repository page and click "Set Me Up". Since you are logged in, the "Set Me Up" dialog shows an "Uploading" option. Click "Uploading" and then "Using this repo with cURL"

Bintray displays the cURL command template to upload a file to your repository.

Uploading with cURL

Copy the cURL template, and replace the placeholders with:
- <FILE.EXT>: The name of the file you want to upload
- <API_KEY>: Your API key that you previously saved
- <PACKAGE_NAME>: The name of the package to which you are uploading this file
- <VERSION_NAME>: The name of this version
- <FILE_TARGET_PATH>: The path within the repository under which the file will be stored

For the example in this tutorial, the cURL command is:

curl -T tutorialsv2.0.0.zip -ujaycroaker:77abe80c4b2a5a3c8a682cd7db79718c29d43fbc https://api.bintray.com/content/jaycroaker/generic/MyTutorialPackage/2.0.0/tutorials/

Execute the cURL command from the folder where your file is located.

If you go back to the Bintray UI, you will see that your file has been uploaded. The file icon is displayed with a green dot indicating it is not published.

File is publised

Now let’s publish the file to make it accessible for download. We’ll do that using Bintray’s REST API in the next section.

Publishing with Bintray's REST API

Bintray has an extensive REST API which empowers you to fully automate your software distribution. We will use cURL again to apply Bintray’s Publish API call to publish the file we uploaded in the previous section.

Action

Result

To apply the Publish REST API call using cURL, the commaind is:

curl -X POST -ujaycroaker:77abe80c4b2a5a3c8a682cd7db79718c29d43fbc https://api.bintray.com/content/jaycroaker/generic/MyTutorialPackage/2.0.0/publish

Execute the cURL command.

The file is published.

File is publised