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.
-
Install the client. Refer: Installation
-
First, obtain an API token from transfer.atlassian.com/auth_token
-
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.
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:
-
Build the image:
docker build -t transfer-reference-client .
-
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>
-
Make sure you use Python3:
$ which python
It should point to a Python3 installation
-
Clone this repository
-
Install the dependencies:
pip install -r requirements.txt
-
(Optional) Run tests to ensure your environment is working properly
python -m unittest tests/*.py -v
Note: If you encounter cryptography depedency installation error as below,
ERROR: Failed building wheel for cryptography
Failed to build cryptography
you might need to manually install cryptography using
pip3 install cryptography
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
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
Note:
If you encounter libmagic
issues while running the tests and see below error
'failed to find libmagic. Check your installation'
Then, you will need to install libmagic
. You can do that using
brew install libmagic
sudo apt-get update
sudo apt-get install libmagic1 libmagic-dev
pip install python-magic-bin
Contributions to transfer-api-ref-client
are welcome! Please see CONTRIBUTING.md for details.
Copyright (c) 2020 Atlassian and others. Apache 2.0 licensed, see LICENSE file.