An Easter Egg Hunt, Built on the Dropbox API
For developers, Easter eggs usually mean hidden features or playful messages tucked inside software. But the Easter Eggs app takes the concept literally, turning your Dropbox into a seasonal scavenger hunt.
The app builds a virtual yard in your Dropbox, complete with folders named grass, drain pipe, and under the back porch. It then drops image files of eggs into random hiding spots. The goal is to find every egg and drag it into an Easter basket folder you're given.
Creating this entire folder tree for each user could be a heavy lift if done folder-by-folder. Instead, the app relies on /copy_ref. This API call lets you duplicate a folder or file from another account. The developer sets up the ideal folder hierarchy once on their own account, then uses a copy_ref to clone the whole structure instantly for any new user. Copying a folder with copy_ref brings along everything inside it—no need to loop through each subfolder.
dropbox-tech-blog/components/content/image
Placing the eggs uses another API trick. The app calls /delta to fetch a flat list of every folder in the yard. That simplified list makes it easy to randomly pick hiding places without needing to walk a recursive file tree.
def enumerate_yard(path, client):
cursor = None
has_more = True
paths = set()
while has_more:
response = client.delta(path_prefix=path, cursor=cursor)
for path, metadata in response['entries']:
paths.add(path)
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 full app, which also uses /metadata, is available at easter-eggs.herokuapp.com. Happy hunting.



