Created
September 18, 2020 14:39
-
-
Save ThomasTheFourth/4b41e1c3a25194e73ee49c82dad5b6e4 to your computer and use it in GitHub Desktop.
es6 to retrieve a random card from any list on a Trello board
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let key=''; | |
let token=''; | |
let boardid=''; | |
fetch('https://api.trello.com/1/boards/' + boardid + '/lists?key=' + key + '&token=' + token + '') | |
.then(response => response.json()) | |
.then(data => { | |
randomList = data[Math.floor(Math.random()*data.length)]; | |
console.log(randomList); | |
fetch('https://api.trello.com/1/lists/' + randomList.id + '/cards?key=' + key + '&token=' + token + '') | |
.then(response => response.json()) | |
.then(data => { | |
console.log(data[Math.floor(Math.random()*data.length)].name); | |
}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment