Posted by: Ian | October 12, 2010

Multi-deposit, a reality

After a few days on head-banging and follicle scratching (not that I have much hair left these days), I have a proof-of-concept for multiple deposit.

One script, one package, and transfer the same package to multiple repositories!

I need to know the following things:

  • The host (eg
  • The URL for the collection (eg ‘/sword/deposit/123456789/2’)
  • The user name to deposit as, encoded (such as name%40some.domain)
  • The password for that user name (in plain text: myUselessPassword)

I have tested this with OpenDepot, JorumOpen, and ShareGeoOpen

The basic Perl code is pretty easy too:

$ua = LWP::UserAgent->new();
$req = HTTP::Request->new( POST => 'http://'.$username.":".$password."@".$host.$collection );
$req->header( 'X-Packaging' => '',
 'X-No-Op' => 'false',
 'X-Verbose' => 'false',
 'Content-Disposition' => "filename=$filename"
$req->content_type( 'application/zip' );
$req->content( $file_contents );
$res = $ua->request($req);
print $res->is_success ? "Deposit successful.\n" : $res->status_line, "\n"


…. stick in an appropriate loop, and you have multiple depositing.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


%d bloggers like this: