Trello API Getting Started – Simple PHP API Wrapper to Get Started

Create a Card With the Trello API. I used this with a webhook with Zapier because I was having issues actually add a card to a copied board.

I was trying to get started with Trello API Integration because something was going on with Zapier and I had to do some actual hard code integration so I decided to look into the trello API and found a nice wrapper to do simple interactions. 

1) Get Trello API Keys: https://trello.com/app-key/ 

2) Download API Wrapper: https://github.com/Kong/unirest-php 

3) Take a Peek at the Documentation at Trello: https://developer.atlassian.com/cloud/trello/rest/api-group-actions/ 

Sample Code to Create Card:

$query = array(
	  'key' => TRELLO_KEY,
	  'token' => TRELLO_TOKEN
);

$response = UnirestRequest::get(
  'https://api.trello.com/1/boards/'.$board_id.'/lists',
  $headers,
  $query
);

$data = $response->body; 
$list_id = $data[0]->id;

//create card on trello board
$query_create_card_1 = array(
  'key' => TRELLO_KEY,
  'token' => TRELLO_TOKEN,
  'idList' => ''.$list_id.'',
  'name' => 'Name of Card',
  'desc' => 'Description Of Card',
  'pos' => '1',
	);

$response_create_card_1 = UnirestRequest::post(
  'https://api.trello.com/1/cards',
  $headers,
  $query_create_card_1
);