Question

I've been looking around for a long time how to get files from Basecamp and so far it seems like a 'mission impossible', but I wanted to ask here as well:

Is there any way to get files from Basecamp projects and, if there is one, how?

Thanks in advance.

Edited: I mean how to get the uploaded files. You can export all project data except the files you have uploaded there.

Was it helpful?

Solution

The BaseCamp API purports to offer FULL access including files.

If you have any knowledge of REST you will be able to pull any/all data out (modulo rate limiting) manually and then do whatever you like with it.

Incidentally, if you write a tool that lets me move a project from one account to another, I'll pay good money for that!

OTHER TIPS

You can export everything from Basecamp using the following steps.

  1. Log in using Chrome.
  2. Copy Cookie header from a page document request in Chrome Developer tools.
  3. wget --mirror -e robots=no --reject logout --no-cookies 'http://your-subdomain.basecamphq.com' --header <pasted-cookie-header>

Matt McClure's answer was spot on but a couple of things held me up;

  1. To find the required cookie in Chrome Developer tools, click on Network icon on top and then Headers tab.

  2. Copy the entire cookie section from the 'request headers' section, including the 'Cookie:' label

  3. Paste the entire string with quotes where matt indicated <pasted-cookie-header> as follows;

    wget --mirror -e robots=no --reject logout --no-cookies 'http://your-subdomain.basecamphq.com' --header 'Cookie: session_token=c6a1ea88a0187b88025e; transition_token=BAhbB2kDA0VjSXU6CVRpbWUNqB...'

(I've shortened the cookie string for clarity)

Both Matt and Peter already proposed using wget --mirror which I think it is the easiest solution out there. However, I was unable to properly copy the cookies from Google Chrome.

Instead I went on a slightly different direction and used the Chrome cookie.txt export extension to copy all cookies as plain text to a cookies.txt file.

My wget command then looked like this:

wget --mirror -e robots=no --reject logout 'http://yourdomain.basecamphq.com' --load-cookies cookies.txt

Additional note for Mac users: wget can be easily installed with homebrew:

brew install wget 

basecamp offers you to export your projects in XML, HTML - and there is also a way to get it in PDF. this information could be found in the help/faq section of basecamp: http://basecamphq.com/help/general#exporting_data

more about the PDF export: http://37signals.blogs.com/products/2008/02/export-a-baseca.html

Use this tool for Windows.

In trial mode, this tool will allow three projects to be downloaded from base, will list all the projects on your base account after you login using your basecamp credentials.

  1. Import you Basecamp Classic project to the new Basecamp
  2. Export Data from new Basecamp
  3. Wait
  4. Get email that it's done and download the zip file

You can set up an integration between Basecamp and Dropbox to automatically transfer all your Basecamp attachments into a dedicated Dropbox folder:

http://blog.cloudwork.com/your-automatic-basecamp-dropbox-backup-step-by-step/

The integration is done by CloudWork, which has a free plan so if you don't think you'll be backing up more than 100 attachments a month, it can do it for free. Above that, there is a pricing plan.

If you have php installed on your machine, save this code to basecampfilevac.php:

<?
// make sure the folder of the script is writeable (0777)
ini_set('memory_limit', '-1');//keeps the script from timing out

function BasecampCall($endPoint, $usePrefix = true) {

    // From: http://prattski.com/2008/10/22/basecamp-api-examples-using-php-and-curl-get/
    $session = curl_init();

    $basecampId     = '[Your Basecamp Account Id Here]';  //this should be a number like 9999999, You can find it in the URL when you log into Basecamp.
    $username       = '[Your Basecamp Username Here]';
    $password       = '[Your Basecamp Password Here]';
    $emailaddress   = '[Your Basecamp Email Address Here]';

    $basecampUrl     = 'https://basecamp.com/' . $basecampId . '/api/v1/';

    curl_setopt($session, CURLOPT_URL, ($usePrefix == true ? $basecampUrl : "") . $endPoint);
    curl_setopt($session, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
    curl_setopt($session, CURLOPT_HTTPGET, 1);
    curl_setopt($session, CURLOPT_HEADER, false);
    curl_setopt($session, CURLOPT_HTTPHEADER, array('Accept: application/json', 'Content-Type: application/json'));
    curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($session, CURLOPT_USERAGENT, "MyApp (".$emailaddress.")");

    curl_setopt($session,CURLOPT_USERPWD, $username . ":" . $password);

    if(ereg("^(https)",$request)) curl_setopt($session,CURLOPT_SSL_VERIFYPEER,false);

    $response = curl_exec($session);
    curl_close($session);

    if($usePrefix){
        $r = json_decode($response);
    } else {
        $r = $response;
    }

    return $r;
}

$projects = BasecampCall('projects.json');

// For each project take name and id
foreach($projects as $proj) {

    $pr = array(
        "id"    => (string)$proj->id,
        "name"  => (string)$proj->name
    );

    // Retrieve the attachments
    echo "\nSaving attachments for project: " . $pr['name'] . "...\n";

    @mkdir($pr['name']);

    $filesArray = array();

    $n = 1;
    do {

        $attachments = BasecampCall("projects/" . $proj->id . "/attachments.json?page=" . $n);

        if(count($attachments) > 0) {

            foreach($attachments as $attachment) {

                $file = pathinfo($attachment->name);

                @file_put_contents($pr['name'] . "/" . $file['filename'] . (in_array($file['filename'], $filesArray) ? "-" . rand() : "") . "." . $file['extension'], BasecampCall($attachment->{'url'}, false));

                $filesArray[] = $file['filename'];

                echo "Saving file " . $attachment->name . "...\n";
            }
        }

        $n++;

    } while(count($attachments) == 50);
}
?>

then update the following lines with the correct information:

$basecampId     = '[Your Basecamp Account Id Here]';  //this should be a number like 9999999, You can find it in the URL when you log into Basecamp.
$username       = '[Your Basecamp Username Here]';
$password       = '[Your Basecamp Password Here]';
$emailaddress   = '[Your Basecamp Email Address Here]';

then save and execute this command: php basecampfilevac.php

This is a modified script originally from Rettger Galactic

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top