Issuing HTTP requests

Butler allows you to issue GET, POST, and PUT HTTP requests to external systems from Trello.

Screenshot_IssuingHttpRequest

In Butler Rules, Card Buttons, and Due Date commands, the getpost to, and put to actions are available on the Content tab.

Screenshot_SelectActionContent2

In Board Button and Calendar commands, these actions are available on the Other tab.

Screenshot_SelectActionOther

POST and PUT requests

POST and PUT requests allow to specify custom headers to send along with the request:

Screenshot_PostPut

Headers are specified as a JSON object, for example:

1 {"Content-Type": "text/plain", "X-My-Custom-Header": "My header value"}

The payload's content-type for POST and PUT requests is application/json by default, but you can override it by specifying a custom header.

Variables that are used in the URL are automatically URL-encoded to create valid URLs; variables used in the payload are automatically escaped to be part of a valid JSON string.

Response

After issuing an HTTP request with Butler, the results are stored in the {httpresponse} variable, which can be used as part of the next action(s) in the command. 

When the response is a JSON object, this variable offers an access notation to retrieve properties within the object. For example, {httpresponse.myproperty}.

Example:

The following Card Button command will post a comment with data extracted from a JSON file that is retrieved with a GET request:

1 2 get url "https://example.com/movie-search?q={cardname}", and post comment "Result count: {httpresponse.relatedMovies.length} \n\n First result: {httpresponse.relatedMovies[0].title}"

The {httpresponse} variable will contain the following:

1 2 3 4 5 6 { relatedMovies:[ {title: 'Movie 1'}, {title: 'Movie 2'}, ], };

After Butler executes the command, it will add the following comment to the card:

Screenshot_ActivityComment

Additional Help