CrookedNumber
2/7/2014 - 3:27 AM

Sample bash script to add tickets to Trello

Sample bash script to add tickets to Trello

#!/bin/bash

if [ $# -ne 2 ]
then
    echo "Usage is: $0: <board> <title>"
    echo "For example: trello wedding 'Taste cakes'"
    exit 1
fi

if [ $1 != 'work' -a $1 != 'homeprojects' -a $1 != 'wedding' ]
then
  echo 'Bad board'
  exit 1
fi


if [ $1 = 'work' ]
then
  listid='edlkdj238742847qldelqjhljeh'  
fi

if [ $1 = 'homeprojects' ]
then
  listid='kdjqlkdhj23o2kj2lq;edjk2edkj2'   
fi

if [ $1 = 'wedding' ]
then
  listid='ekjwlekfjeqlkwelk293294829348'   
fi

# replace spaces in name with + (or else http call will fail)
name=$2
safe_name=$(echo $name|tr ' ' '+')

data="name="$safe_name"&due=null&idList="$listid"&token=YourTrelloToken&key=YourTrelloKey"

# The following curl will throw away response json, and display just status code (200 == two thumbs up!)

curl -s -o /dev/null -w "%{http_code}\\n" --data $data https://api.trello.com/1/cards