Skip to content

Reference API implementation that supports large file uploads (>100GB) in a chunked and resumable fashion to https://transfer.atlassian.com

License

Notifications You must be signed in to change notification settings

atlassian-labs/transfer-api-ref-client

Repository files navigation

transfer-api-ref-client

Atlassian license version Python version Build Status PRs Welcome

Welcome to the reference API client implementation for the transfer.atlassian.com REST API. This client is provided as a reference implementation for the provided REST API which allows resumable and chunked file uploads to https://transfer.atlassian.com. It is provided as a command-line tool (CLI).

The tool performs file upload by chunks and can resume file upload after failures. If you are faced with failure during file upload, you can run the tool again and the tool skip chunks uploaded before and upload the missed file fragments automatically.

Usage (simple)

  1. Install the client. Refer: Installation

  2. First, obtain an API token from transfer.atlassian.com/auth_token

  3. Then use your favorite terminal to run the reference client to upload one or multiple files:

python app.py \
    --file <FILE NAME 1> \
    --file <FILE NAME 2> \
    --issue_key=<ISSUE_KEY, eg. SUPTST-1234> \
    --user=<API USER ID> \
    --auth_token=<API TOKEN>

Note: --issue-key needs to refer to an existing open Support issue in the Atlassian's Support System where you have proper permissions to add attachments.

Using Docker

It is possible to build a local Docker image which has all the necessary dependencies added. The tool can then be run by just running the container.

Steps:

  1. Build the image: docker build -t transfer-reference-client .

  2. Run the following command line to upload a file:

    docker run --rm -it --name transfer-reference-client \
         --volume <HOST_PATH>/:/upload \
         transfer-reference-client:latest \
         --file /upload/<FILE_NAME> \
         --issue_key=<ISSUE_KEY> \
         --user=<API_USER_ID> \
         --auth_token=<API_TOKEN>
    

Installation

  1. Make sure you use Python3:

    $ which python 
    

    It should point to a Python3 installation

  2. Clone this repository

  3. Install the dependencies:

    pip install -r requirements.txt
    
  4. (Optional) Run tests to ensure your environment is working properly

    python -m unittest tests/*.py -v
    

Development

For development we recommend use Python virtual environment:

$ virtualenv -p `which python3` .venv
$ source .venv/bin/activate
$ pip install -r requirements.txt
$ python -m unittest tests/*.py -v

Tests

The existing tests are located in the tests/ folder. They do not actually check full connectivity to the API but check the contract implementation.

You can run the tests using: python -m unittest tests/*.py -v

Contributions

Contributions to transfer-api-ref-client are welcome! Please see CONTRIBUTING.md for details.

License

Copyright (c) 2020 Atlassian and others. Apache 2.0 licensed, see LICENSE file.


With �� from Atlassian

About

Reference API implementation that supports large file uploads (>100GB) in a chunked and resumable fashion to https://transfer.atlassian.com

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published