15

When logged into trello in a browser you can easily backup a board by hitting a URL like this: https://trello.com/board/replaceWithMyBoardId/my-board-name.json

I'd like to write a script that will go through a given set of boards and automatically archive the json export.

I've already got a developer key, and I've already got an oauth token. I can successfully go to https://api.trello.com/1/board/replaceWithMyBoardId?key=replaceWithMyKey&token=replaceWithMyToken but that only gives me basic board info. I want to get the full board export like I would through the browser.

Any ideas?

J. Allen
  • 602
  • 1
  • 7
  • 24

7 Answers7

9

If you want to download .json files automatically for all your Trello.com boards, I wrote a small script that does it using the API: Trello-backup on Github

I setup the script to run as a daily task and all my valuable trello boards/cards/lists are automatically saved on my computer as JSON files. Good for peace of mind!

Matt
  • 161
  • 2
  • 3
8

Just wrote a post about that on my blog.

You're just missing some options that makes the API return more info. Check their API docs for the list of available options, or just try and add:

actions=all&actions_limit=1000&cards=all&lists=all&members=all&member_fields=all&checklists=all&fields=all

to get as much information as possible (as far as I can tell)

shesek
  • 4,584
  • 1
  • 28
  • 27
  • Your blog post is no longer online. – henrikstroem Nov 20 '17 at 16:00
  • Sorry about that, the blog has been down for quite some time now. An archived copy is available here: http://web.archive.org/web/20130725051925/http://www.shesek.info/general/automatically-backup-trello-lists-cards-and-other-data – shesek Nov 25 '17 at 11:38
  • Though, I'm not sure if the instructions there still apply. It's quite likely that Trello was changed since it was originally written in 2012. – shesek Nov 25 '17 at 11:39
6

These seem like the two simplest options -

sam
  • 9,486
  • 36
  • 109
  • 160
1

It wouldn't seem that hard. Simply use your trello calls, and right them to a file with the script language of your choice. With javascript/jquery you could use parseJson I suppose.

var callToTrello = 'http://trello.com/1/boards/someBoard/whateverelse
var obj = jQuery.parseJSON(callToTrelllo);
 //then just write to the local system using 

set fso = CreateObject("Scripting.FileSystemObject");  
set s = fso.CreateTextFile("C:\\trello.txt", True);
s.writeline(obj);
s.Close();

Or something along those lines. You can always use the jsbeautifier to make it look all pretty once it's in the file. But that'll get it into a file. I'll test this tomorrow and make sure it works.

John Verber
  • 745
  • 2
  • 16
  • 31
0

Hi this post was deleted (not sure why as I think this is no different to Matt's post (2nd answer) or even the chosen answer that just provides 2 links to possible solutions but I will try to elaborate.

The application will do as the op requested and provides a convenient solution as it does not require php. It will back up all your organisation boards automatically and is easy to schedule with windows scheduler. It can work through a proxy and has a mail module to integrate with your chosen mail platform to email daily reports and error logs.

The application is free and open source, the code is provided in the github repository and can be modified to fit the purpose (although I dont think this is necessary)

https://github.com/matthall103/TrelloBackup

If this answer is still not suitable could you please let me know why and I will make sure I don't make the same mistake in the future.

Thanks

Matt Hall
  • 31
  • 3
  • your answer was probably considered as spam since you were doing publicity for the app you wrote. (don't know if it was just a link or you explained details as in this new answer) – AdrieanKhisbe Mar 23 '15 at 14:08
  • As @AdrieanKhisbe mentioned, you post seems a spam... Do a publicity is not well seeing here in SO. – bcesars Mar 23 '15 at 14:22
  • 1
    ok thanks but i dont see how my post any different to the second answer by Matt, he seems to be publicizing his script too. I honestly just posted it as I think it can help people, I'm not trying to make money, i'm just trying to help :)! The code is open source and is free for anyone to modify for their own solution. Thank you for the advice anyway and I will bear it in mind for furture posts – Matt Hall Mar 23 '15 at 15:07
0

In Trello Business Class there is a button to bulk export all your boards including attachments. A very simple script using e.g. Selenium, PhantomJS, ghost.py or Splinter would suffice.

Ivan Ogai
  • 1,406
  • 15
  • 9
0

Adding my two cents.

Neither github.com/jtpio/trello-full-backup nor github.com/mattab/trello-backup worked for me. One tries to create files with too long names, other tries to create files with backslashes in names (when board titles have backslashes).

Here's self-propelled AutoHotkey_L script for proper dump/backup (without parsing): https://github.com/AntonD-mobilmir/Share-config/blob/master/Backup-Scripts/Dropbox/Backups/Trello/Backup.ahk (it requires some files from Lib folder of the same repo).

Strings there are in russian, but if there will be any interest, I'll translate.

Some features:

  1. Without args, it requests list of user boards and boards from all user's teams.
  2. Then it requests all API-accessible resources of these boards, grouping all requests in batches to save API calls (by 10, as it's max for API batch):
    • actions
    • checklists
    • labels
    • lists
    • members
    • plugins?filter=enabled
  3. Then just dumps all responses into NNN.json files. If you'll need something, it's fairly easy to parse.
  4. Saves all boards it seen to boards.json, and only backs up boards if last action date has changed (or if board is new). To make full backup again, just rename/remove this file. This file never shrinks, it's always full list of any boards seen by the script, even unavailable anymore (user access revoked or board deleted). There is boards.txt next to it, and it's just more easily readable data, same as in json. You can look at it to check which boards script ever seen. Script never actually reads the txt, just overwrites it each run.
  5. To understand what is dumped, each dump dir has it's boards.txt with list of dumped boards.

ToDo/Fixme:

  • First saved batch is always empty. It's certainly script bug, but I didn't have time yet to understand why (backup still full and fine, just an excess empty file is annoying).
  • Attached resources are not dumped
  • Without parsing dumps, it's not convenient to extract data for recovery. Aside from dumps, more easily human-readable backup structure is needed.

P.S. Same explanation in Russian: www.logicdaemon.ru/projects/trello-backup

LogicDaemon
  • 466
  • 10
  • 22