Page 1 of 1
Dropbox Settings
Posted: Thu Feb 09, 2017 4:46 pm
by Jamesnic7
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.
Re: Dropbox Settings
Posted: Thu Feb 09, 2017 5:01 pm
by cstevens
If you look at the documentation in the Scripting help for HTTP it shows how to do this in the scripting interface:
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() );
}
I don't see why you couldn't do the same with the HTTP element if you set the following properties:
Re: Dropbox Settings
Posted: Thu Feb 09, 2017 5:03 pm
by cstevens
I'm not sure if the HTTP element uses SSL or not, that would be a possible hangup.