I am experimenting with Trello's API using their provided library, client.js:
Here is my current code:
<script src="./js/jQuery.js"></script>
<script src="https://api.trello.com/1/client.js?key=myAPIInsertedHere"></script>
<script>
$(document).ready(function(){
Trello.authorize({
interactive: true,
type: "popup",
expiration: "never",
name: "surveyrequest",
persist: "true",
success: function() { onAuthorizeSuccessful(); },
error: function() { onFailedAuthorization(); },
scope: { read: true, write: true},
});
function onAuthorizeSuccessful() {
var token = Trello.token();
today = new Date("December 25, 2015 12:00:00");
var thisUrl = encodeURL = "http://www.google.com/";
console.log(token);
Trello.post("cards", { name: "Card created for test", desc: "this is a test", idlist: "myIDListInsertedHere", due: today, urlSource: thisUrl});
}
function onFailedAuthorization() {
console.log("Authorization failed.");
}
});
</script>
The placeholders 'myAPIInsertedHere' and 'myIDListInsertedHEre' should be replaced with actual values.
Although the console log displays a valid token value, I am encountering an issue with the POST command getting rejected. The error message reads as follows: POST 400 (Bad Request)
Upon reviewing the documentation (), it seems like the formatting is correct. Any insights on what might be going wrong?