Hi
Has anyone managed to setup a link to dropbox to upload job files using the HTTP Configurator.
I have created an app on the account and obtained a token but I keep getting "401" Uthentification errors.
Dropbox Settings
Re: Dropbox Settings
If you look at the documentation in the Scripting help for HTTP it shows how to do this in the scripting interface:
I don't see why you couldn't do the same with the HTTP element if you set the following properties:
Code: Select all
function jobArrived( s : Switch, job : Job )
{
var theHTTP = new HTTP( HTTP.SSL );
theHTTP.authScheme = HTTP.OauthAuth;
theHTTP.authorization = "authorization string";
theHTTP.setAttachedFile( job.getPath() );
theHTTP.url = "https://api-content.dropbox.com/1/files_put/auto/Test.pdf";
theHTTP.post();
job.log( 4, "Upload started", 100);
while( !theHTTP.waitForFinished( 3 ) )
{
job.log( 5, "Uploading...", theHTTP.progress() );
}
job.log( 6, "Upload finished" );
job.log( 1, "Server response: %1", theHTTP.getServerResponse().toString( "UTF-8" ) );
if( theHTTP.finishedStatus == HTTP.Ok && theHTTP.statusCode == 200 )
{
job.log( 1, "Upload completed successfully" );
}
else
{
job.fail( "Upload failed with the status code %1", theHTTP.statusCode );
return;
}
job.sendToSingle( job.getPath() );
}
- URL: https://api-content.dropbox.com/1/files ... o/Test.pdf
- Request type: POST
- Attached file (use Single-line text with variables defined to select job -> path
- Authorization scheme: OAuth
- Authorization: Your token
Re: Dropbox Settings
I'm not sure if the HTTP element uses SSL or not, that would be a possible hangup.
Re: Dropbox Settings
Has anyone had success with getting dropbox API v2 to work. I have API v1 working but this is deprecated and will stop on the September 28th, 2017. This is the code that currently works.
Code: Select all
function jobArrived( s : Switch, job : Job )
{
var theHTTP = new HTTP( HTTP.SSL );
theHTTP.authScheme = HTTP.OauthAuth;
theHTTP.authorization = "Bearer authorisation String";
theHTTP.url = "https://content.dropboxapi.com/1/files/auto/xxxxx.pdf";
theHTTP.localFilePath = job.createPathWithExtension( "pdf", false );
theHTTP.get();
job.log( 4, "Download started", 100 );
while( !theHTTP.waitForFinished( 3 ) )
{
job.log( 5, "Downloading...", theHTTP.progress() );
}
job.log( 6, "Download finished" );
if( theHTTP.finishedStatus == HTTP.Ok && theHTTP.statusCode == 200
&& File.exists( theHTTP.localFilePath ) )
{
job.log( 1, "Download completed successfully" );
job.sendToSingle( theHTTP.localFilePath );
}
else
{
job.fail( "Download failed with the status code %1", theHTTP.statusCode );
job.sendToData(3,job.getPath() );
return;
}
job.sendToNull( job.getPath() );
}