Getting List ID for Trello API

So the MangoBlogger onboarding task required me to add a card to my trello board using the Google App Script,

https://script.google.com/

But after some fiddling around with the Trello API, I found that I missed a key component of the Code required in the API,

That is the ListId-List id ensures that the Card is added to a particular list in the trello board.

https://developers.trello.com/reference#cards-2

As you can see it is a required field!!

TRELLO–> BOARD–>LISTS–>CARDS

Above is the Hierarchy, with unique id’s associated with each member at each step.

This this is how I did it,

METHOD-1

I used the POSTMAN app(Chrome Plugin) [Chrome Extension, Desktop App]

and sent an url GET request to the page, parsed the incoming data as JSON, and I got all the data I would ever need, boardID, listId etc.

So from there on it was simple cmd+f , and I got it.

url used:

Before using the following URL, be sure that you have the cardId, because this is the code for retrieving data from a trello card and uses a GET request for the same.

https://api.trello.com/1/cards/[card id]?attachments=false&attachment_fields=all&checklists=none&checklist_fields=all&sticker_fields=all&key=[“key-insert your key here”]&token=[“token-insert your token here”]

As you can see,

The 30th line contains idBoard,

32nd line containd idList, which we want!

A much clutter free way to do it→

METHOD-2

I also wrote another NodeJS API to parse the data as JSON, and give any relevant details I ask for, It worked much better as there was no Clutter this time around.

Here is the code for the same:

***************************************************

//NodeJS script to retrieve relevant details from the Trello //Board api

//Make sure you have the cardId of atleast one card from //the list whoose id you want to know

var options = { method: ‘GET’,

 url: ‘https://api.trello.com/1/cards/snNbR6TF’,

 qs:

  { attachments: ‘false’,

attachment_fields: ‘all’,

checklists: ‘none’,

checklist_fields: ‘all’,

sticker_fields: ‘all’,

key: [Key],

token: [Token] } };

  request(options, function (error, response, body) {

    if (error) throw new Error(error);

    else{

//Parse the incoming body as JSON data as it is in a String     //Format!  

      var obj = JSON.parse(body);

//Mention here the parameter you want to retireve from the //Massive incoming body

             console.log(“idList : “+obj.idList);

}

});

***************************************************

OUTPUT:

Thank you for reading!

FAQ’s

  1. Where do I find my User Specific Token/Key?
  2. Where do I find the cardID, boardId etc.?

ANSWER:

It’s a challenge.

Hint: Use the internet.


Related Posts

Employee Onboarding App

How to hire with little or no money

If you are trying to hire employees with little or no money than it could be because, in a business, there are just so many things to do! There is marketing, sales, product, user experience, Read more…

backend

How to schedule functions in Google AppScipts?

I was assigned a task of creating an application that could be scheduled periodically in Google AppScripts.  This application should appear as a Modal Window in a spreadsheet whenever the user requests for it from Read more…

Careers

My experience interning remotely with MangoBlogger

A lot of companies offer remote internships to spread their reach around the world, and it’s pretty easy to see why. After all, they’re convenient, save office space, and broaden their applicant pool in ways Read more…