Created
January 24, 2019 22:30
-
-
Save mega-arbuz/830938ac2878b95bc0cc94117a5e1ae9 to your computer and use it in GitHub Desktop.
Upload to dropbox and get shareable link
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $# -lt 3 ]; then echo "Missing parameters"; exit 1; fi | |
curl -X POST https://content.dropboxapi.com/2/files/upload \ | |
--header "Authorization: Bearer $1" \ | |
--header "Dropbox-API-Arg: {\"path\": \"/builds/$2\",\"mode\": \"add\",\"autorename\": true,\"mute\": false,\"strict_conflict\": false}" \ | |
--header "Content-Type: application/octet-stream" \ | |
--data-binary @$3 > /dev/null | |
echo $(curl -X POST https://api.dropboxapi.com/2/sharing/create_shared_link_with_settings \ | |
--header "Authorization: Bearer $1" \ | |
--header "Content-Type: application/json" \ | |
--data "{\"path\": \"/builds/$2\",\"settings\": {\"requested_visibility\": \"public\"}}" \ | |
| grep -Po 'http.*dropbox.com.*[?]dl=')1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment