Get Easter eggs in your Dropbox

// By Alexandra Feldman • Apr 03, 2015
Some people think that Easter eggs are colorful hard-boiled chicken ova that you hide in a backyard once a year. Other people think Easter eggs are cute little surprises that developers build into their apps to delight their users. With the Dropbox API, Easter eggs can be both!
Who knows where they'll be? The Easter Eggs app creates a folder tree in your Dropbox with folders like "grass" and "drain pipe" and "under the back porch," and then randomly adds image files of eggs. The aim of the game is to find all the eggs and drag the files to your "Easter basket" folder.

Making API calls to create the whole folder structure for the yard might sound like a lot of work, since there's a folder for every possible hiding place. One trick is to use /copy_ref. Rather than writing code to manually create each folder for each user who links their account, copy_ref lets you copy the contents from a pre-existing folder or file on another Dropbox account. It's much easier to manually create a custom folder hierarchy once, and then copy it many times. Plus, the cool thing about using a copy_ref on a folder is that it copies the whole thing—instant file tree! 


It also uses /delta to create a flat list of of folders in the Yard, which makes it easy to pick random hiding places for the eggs. 

def enumerate_yard(path, client):
    cursor = None
    has_more = True
    paths = set()
    while has_more:
        response =, cursor=cursor)
        for path, metadata in response['entries']:
        has_more = response['has_more']
    return paths
# Get flat list of paths to directories from '/Yard'
flat_list = enumerate_yard('/Yard', client)
# Choose 5 random places to hide eggs
hiding_places = random.sample(flat_list, 5)

The app is available at It uses /copy_ref/delta, and /metadata. Happy hunting!

// Copy link