Problem updating Trello card with its Javascript API

0

I am trying to modify the values of a trello card through its API, in this case I am trying to modify its name, the call offered by the API is as follows:

PUT /1/cards/{id}/{property}?value={newValue} 

link

I'm trying it in the following way, and I get the error [object Object]

HTML:

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

<div id="loggedin">
    <div id="header">
        Logged in to as <span id="fullName"></span> 
        <a id="disconnect" href="#">Log Out</a>
    </div>

    <div id="output"></div>
</div>    

Javascript:

var onAuthorize = function() {
    updateLoggedIn();
    $("#output").empty();

    Trello.members.get("me", function(member){
        $("#fullName").text(member.fullName);

        var id= "5ab7c3c631a2019c50b701c8";
        //Change name

        //tambien he probado con esta URL 'cards/5ab7c3c631a2019c50b701c8/name?
        //value=nombrecito'
        Trello.put('/boards/me/cards/5ab7c3c631a2019c50b701c8/name?value=nombrecito', function () {
            alert("funciona bien")
        }, function(err) {
            alert(err)
        });
    });
};

var updateLoggedIn = function() {
    var isLoggedIn = Trello.authorized();
    $("#loggedout").toggle(!isLoggedIn);
    $("#loggedin").toggle(isLoggedIn);        
};

var logout = function() {
    Trello.deauthorize();
    updateLoggedIn();
};

Trello.authorize({
    interactive:false,
    success: onAuthorize
});

$("#connectLink")
.click(function(){
    Trello.authorize({
        type: "popup",
        success: onAuthorize
    })
});

$("#disconnect").click(logout);
    
asked by Silvia 05.04.2018 в 23:19
source

0 answers