trello

How to show Trello board ? using Trello API


I'm trying to show Trello board with the Trello API.

This is my code if there is an any mistake please suggest me.

$(document).ready(function() {

    $("#connectLink")
        .click(function() {
            Trello.authorize({
                type: "popup",
                name: "from link test",
                scope: {
                    read: true,
                    write: true
                },
                success: function() {
                    onAuthorizeSuccessful();
                },
                error: function() {
                    onFailedAuthorization();
                }

            })
        });

    function onAuthorizeSuccessful() {

        console.log("Authorization success.");

    }

    function onFailedAuthorization() {
        console.log("Authorization failed.");
    }

});

and this is link

<a id="connectLink" href="#">Connect To Trello</a>

Solution

  • you can just using ajax and send the App key and token key to board.php page and using curl and after this you can fire board API.

    like this this

    <?php
    $token=$_GET['token'];
    $key=$_GET['key'];
    $cSession = curl_init(); 
    curl_setopt($cSession,CURLOPT_URL,"https://api.trello.com/1/members/me/boards?key=".$key."&token=".$token);
    curl_setopt($cSession,CURLOPT_RETURNTRANSFER,true);
    curl_setopt($cSession,CURLOPT_HEADER, false); 
    $result=curl_exec($cSession);
    curl_close($cSession);
    echo $result;
    ?>