0

I need to move a file from my local machine to a drop box location. How can I do this within Jenkins ?

Do I need to use a plugin or can I do it all within a powershell script ?

Mel
  • 319
  • 2
  • 16
  • Dropbox gives you API's which you can use to do the task. refer https://www.dropbox.com/developers/documentation/http/documentation – Mahattam Oct 10 '19 at 02:26
  • managed to use the api calls to authenticate and upload files. But within dropbox you can share the file link via email. Need some help with calling this api to return me a shared link to the dropbox location so that I can email ? – Mel Oct 10 '19 at 03:14
  • I think you need to use `create_shared_link_with_settings` api of dropbox to create a shared link after uploading a file. – Mahattam Oct 10 '19 at 03:26
  • ok now managed to call the create_shared_link_with_settings using curl. Sorry I am a bit new to curl. I know in powershell I can get the response format as json and access the url value. But in curl how can I do the same ? or can I do the call in powershell . thanks – Mel Oct 10 '19 at 04:03
  • You have to use PowerShell only to manipulate with JSON response. I can see there is `ConvertFrom-Json` in PowerShell to parse the JSON response. Refer https://stackoverflow.com/questions/16575419/powershell-retrieve-json-object-by-field-value – Mahattam Oct 10 '19 at 04:16
  • could I get some input on why the following gives bad request ? $SourceFilePath = "Test/Data/App/App Installer.exe" $arg = '{"path": "/'+$SourceFilePath+'"}' $authorization = "Bearer 12345" $headers = New-Object "System.Collections.Generic.Dictionary[[String],[String],[String],[String]]" $headers.Add("Authorization", $authorization) $headers.Add("Dropbox-API-Arg", $arg) $headers.Add("User-Agent", "api-explorer-client") $headers.Add("Content-Type", "application/json") Invoke-RestMethod -Uri https://api.dropboxapi.com/2/sharing/create_shared_link_with_settings -Method Post -Headers $headers – Mel Oct 10 '19 at 04:44
  • Can I call the curel from command line on Windows ? – Mel Oct 10 '19 at 04:54
  • Sorry buddy, I'm not on the Windows platform so can't help in debugging the code. – Mahattam Oct 10 '19 at 05:00
  • No problem .. I will dig into it. 95% there. Thanks so much for the help. – Mel Oct 10 '19 at 05:02

0 Answers0