I am trying to help someone automatically populate some information into a card each morning. Since a HTTP API is available to fetch the data as a JSON, it seems we should be using Butler:
https://help.trello.com/article/1203-issuing-http-requests-with-butler
The example provided helped to get a proof of concept working, but it only shows how to display a specific result
First result: {httpresponse.relatedMovies[0].title}
The data I am requesting may return any number of results, from 0 to 30, so listing each is not practical and would result in 'undefined' being displayed if results were not available; following the example, perhaps you want to return the list of all the movie titles that are related with no limit; the below is not ideal:
First result: {httpresponse.relatedMovies[0].title}
Second result: {httpresponse.relatedMovies[1].title}
Third result: {httpresponse.relatedMovies[2].title}
Fourth result: {httpresponse.relatedMovies[3].title}
...
I assume there is some wildcard or the ability to do a for loop of some sort?
for {let n = 0; n < httpresponse.relatedMovies.length; n++}
{
{httpresponse.relatedMovies[n].title}
}
Any help appreciated. I had a decent search through the documentation and forum and didn't find anything related. Perhaps we need to move to the Power Ups to get this sort of functionality?
The above considers a JSON like in the example on the link
{ relatedMovies:[ {title: 'Movie 1'}, {title: 'Movie 2'},
{title: 'Movie 3'},
{title: 'Movie 4'}, ], };
Thank you for your responses, although largely confirming that Butler was incapable of processing the results.
I have instead altered the API call to do the processing and return the results in a formatted single entry.
ie. Return all the movies seperated by \n in a single JSON field allowing
{httpresponse.relatedMovies[0].title}
to include all the results.
How are planning to iterate through each of the values? Or you just need to see them as separate items on a card description?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You will not be able work easily with a list in Butler unless you have them as a checklist or attachments (see actions in Cascade).
Instead get an endpoint that can update the cards for you instead. You can use http to trigger the update giving it the card id.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Steve Nyveld there's no looping in New Butler, but for this code approach you may be interested in our BenkoBot platform:
You can see some examples and a "crash course" here:
https://trello.com/b/IoHmhz5c/benkobot-community-board
The crash course tells you how to make calls out to any external API using the ___request object
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.