Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upload from CLI #6

Closed
davidchalifoux opened this issue Jul 10, 2020 · 7 comments
Closed

Upload from CLI #6

davidchalifoux opened this issue Jul 10, 2020 · 7 comments
Assignees
Labels
enhancement New feature or request

Comments

@davidchalifoux
Copy link
Owner

It'd be nice to be able to also upload files to Put from the CLI.

@davidchalifoux davidchalifoux added the enhancement New feature or request label Jul 10, 2020
@davidchalifoux davidchalifoux self-assigned this Jul 10, 2020
@davidchalifoux
Copy link
Owner Author

This is not currently possible using only the Put.js library.

@Gex2501
Copy link

Gex2501 commented May 2, 2023

Is it possible to upload a .torrent file to start the transfer?

@davidchalifoux
Copy link
Owner Author

@Gex2501 Good news, I'm actually 95% done with completely rewriting this software and I already have file uploading working.

My goal is to have v2.0 released this weekend!

@Gex2501
Copy link

Gex2501 commented May 2, 2023

That's fantastic! What I'm really looking for a simple one line curl command to add torrent transfers. I've been reading over the API for hours and I'm just not sure how to do it. I got the following from the API but where do I put my token so the command is authenticated?

curl -X 'POST' \
  'https://upload.put.io/v2/files/upload' \
  -H 'accept: application/json' \
  -H 'Content-Type: multipart/form-data' \
  -F 'file=@TotallyLegalFile.torrent' \
  -F 'filename=' \
  -F 'parent_id=0'

@davidchalifoux
Copy link
Owner Author

@Gex2501 You're super close!

You just need an API token in the header:
Authorization: Bearer ${API_TOKEN}

Which I think looks like -H "Authorization: Bearer TOKEN_HERE" added to CURL.

@Gex2501
Copy link

Gex2501 commented May 2, 2023

Thank you so much! I spent hours trying to figure this out! This worked for me...

curl -X 'POST' \
  'https://upload.put.io/v2/files/upload' \
  -H 'accept: application/json' \
  -H 'Content-Type: multipart/form-data' \
  -H 'Authorization: Bearer XXXXXXXTOKENXXXXXXXX' \
  -F 'file=@TotallyLegitFile.torrent' \
  -F 'filename=' \
  -F 'parent_id='

@davidchalifoux
Copy link
Owner Author

Added in v2.0.0!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants