Issuing HTTP requests with Butler
Butler offers the ability to issue HTTP requests to external systems from Trello.
You can issue GET, POST and PUT requests:
Headers
POST and PUT requests allow to specify custom headers to send along with the request:
Headers are specified as a JSON object, e.g.:
{"Content-Type": "text/plain", "X-My-Custom-Header": "My header value"}
Notes:
- For POST and PUT requests, the payload's content-type is application/json by default, but this can be overriden by specifying a custom header.
- Variables 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, e.g.: {httpresponse.myproperty}
For example, the following command in a card button will post a comment with data extracted from a JSON file retrieved with a GET request:
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}"