Is it possible to create a Trello post using the client.js API?

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?

Answer №1

The ID list parameter in the post request is displaying an incorrect value due to the lowercase "L" in the parameter name. Simply capitalize the "L" and the request should function correctly.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Tracking mouse movements in Angular

I have created a custom directive where I am trying to capture the $document.mousemove event to adjust the position of a div for the purpose of implementing a number slider (e.g. sliding numbers between 1 to 100). <div ng-mousedown="handleDown($event)" ...

Error message in JS/Ajax alert box

I keep receiving an alert box saying "Image uploaded" even when the variable $imagename is empty. Below is the script in question: <script> function ajax_post1(ca){ var cat = ca; var name = document.getElementById("name").value; var ...

A guide on transforming HTML into a variable using JavaScript

Having trouble converting HTML to a JavaScript variable. This is my HTML code: <div onclick="openfullanswer('2','Discription part','This is the code part');"> I want to create this HTML code dynamically, but I&apo ...

Consider replacing the custom attribute directive in Angular with a different directive

I am currently working on a custom attribute directive to handle a src-like attribute that represents a relative path to a directory. The directory path is stored in a global variable (let's call it mydir). This attribute should be replaced with an ...

Certain browsers have difficulty running CSS keyframes animations

As I work on my website, I have integrated a CSS keyframes animation that is triggered by clicking a link connected to a JavaScript function. Here is an excerpt from my CSS file: #banner { background-color: #00BBD2; position: absolute; width: 100%; heigh ...

Creating a horizontal scroll effect using jQuery when the widths of the items are not

I am working on a jQuery gallery that showcases images in a horizontal layout. Below the images, there are "left" and "right" buttons which allow users to scroll through the pictures. There are many tutorials and plugins available for this type of function ...

PHP is unable to receive data from ajax requests

My goal is to detect which reply button I click and send its index to a PHP script. In jQuery: $(".reply").each(function (index5) { $(".reply_button").each(function (index_b) { if(index_b==index5){ $(this).on("click",functio ...

Tips on customizing data labels using Jquery Highcharts in column charts

Is there a way to change the positioning of data labels in a column chart? Currently, my data labels appear within the columns, but I'd like to adjust their position. I've tried changing the code below, but nothing seems to work. The colors chang ...

Navigating asynchronous URL parsing in NodeJS

I am still fairly new to the world of Node.js and Javascript, so I appreciate your patience with my confusion around the callback mechanism Bacchanalia. The Issue at Hand I'm currently working on a basic Node.js application that is responsible for h ...

Save the JSON response from JavaScript to a different file extension in a visually appealing layout

I've created a script to generate both the CSR and private key. The response displayed in the <textarea> is well-formatted with newline characters (assuming familiarity with the correct CSR/Private key format). However, I'm encountering a ...

AngularJs code snippet: Iterating over each element in the arrayValue using ng-repeat directive

Here is an example of an array: var date = { '2015': [{ 'month': 'Januar', 'day': 31 }, { 'month': 'Februar', 'day': 28 }] }; I am trying to use ng-repea ...

What is the best method to assign each key in an Object to the corresponding value in another Object?

Suppose I have an object called data: { first: 'Zaaac', last: 'Ezzell', title: 'Mrs', mail: '<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="83ece6f9f9e6efefb3c3f1e6e7e7eaf7ade ...

The outputs of base64(sha256(data)) from nodejs crypto and CryptoJS are showing discrepancies

In my setup, I have a node server and a react-native app. The node server utilizes the crypto module for all cryptographic operations, while the react-native app relies on the crypto-js library due to the unavailability of crypto. You can find a sample co ...

Exploring the world of functional programming within nested arrays

I have been shifting towards functional programming over imperative programming recently. Imagine I have a nested array data structure and my goal is to update the values of the innermost arrays. What approach would be most effective? Here is the imperat ...

Localhost app engine meets online session

Currently using stripes in combination with Google App Engine. When testing locally, everything runs smoothly. However, when the application is hosted online, a series of issues arise: The use of getContext().getMessages().add(new SimpleMessage(...)) fun ...

Achieve immediate feedback without delaying for asynchronous function

As I develop an API to handle requests and execute a complex function using Puppeteer, I am faced with the challenge of not wanting the API to wait for the function to finish before sending a success response since it is primarily a submit API. The curren ...

Issue: Child actions in ASP.NET MVC 3 with Razor are not permitted to execute redirect actions

After coming across this specific question on SO, I thought it might hold the answer to my problem. However, it didn't quite do the trick. The issue arises with my ASP.NET MVC 3 + Razor application running smoothly on IIS5 on my development PC and th ...

Locating an adjacent input element upon clicking a span (using the onclick event)

Having trouble retrieving a nearby input element using the closest() function, as it's returning an error stating that closest is not a recognized function... Check out this JSFiddle for reference: http://jsfiddle.net/1mvc76fv/ HTML: <div> ...

Utilizing arrays in JavaScript alongside jQuery's methods such as $.inArray() and .splice()

I am currently dealing with an array that is limited to containing 12 values, ranging from 1 to 12. These values can be in any order within the array. My task is to iterate through the array and identify the first unused value, assigning it to a variable. ...

Analyzing a tweet containing unique characters

I am currently working on extracting links from tweets, particularly hashtags and mentions. However, I have encountered an issue when the tweets contain special characters like " ...