Is there a way to create button to retrieve old card description via Butler?
Asked by Joanna:

According to [this article,](https://help.trello.com/article/783-recovering-the-description-of-a-card-that-has-been-changed) there is a way to recover the card description using Trello's API. I wanted to automate this and tried to create a \`Restore previous description\` card button using Butler. I was hoping it would be possible to do it using \`issue HTTP request\` action and then update the description from the response. However, when I run the card button, I always receive a following error:

\`\`\`

There was an error requesting the URL \[Trello API url here\]

`401 invalid key`

\`\`\`

The URL is generated properly using the {cardid} variable and works when copied over to another browser tab. Is there any way to get around this and access card's previous description?


Answers:
author: Iain Dooley
body: [@Joanna](/t5/user/viewprofilepage/user-id/4396922) can you take a screenshot of your rule? You should be able to issue an HTTP request to grab the content, but be aware it will be in a big ugly JSON format. You might be better off just auto generating the URL and attaching it to the card so that you can manually click on it and copy/paste the most recent description because you won't be able to parse the JSON from Butler.

If you did want to create an API tool to auto generate the URL, fetch the JSON from it then parse the JSON and set the description to it's immediate predecessor then you could use my BenkoBot platform:

<https://app.benkobot.com/>

This code would recover the description on a card when you add the "Recover Description" label:

<https://gist.github.com/iaindooley/15d82b4344d83d5f64885563f275034d>

comments: author: Joanna
body: [@Iain Dooley](/t5/user/viewprofilepage/user-id/1416112)sure, here's a screenshot:

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/143793i3CF583135D0330C1/image-size/large?v=v2&px=999 "image.png")

I am aware that the response is a blob of JSON, but according to [this documentation](https://help.trello.com/article/1203-issuing-http-requests-with-butler):
> 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}" 
> ```

So I would expect it's ok to retrieve the data from the response in a way that is presented on the screenshot.

Anyway, by looking on the Butler logs, I think it never gets to the response. Here's the Butler log if that's helpful:

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/143794iBB0413CF9EA10E8F/image-size/large?v=v2&px=999 "image.png")

I checked out your platform and the gist you posted, and while it looks neat, I'm not in liberty of using third parties on the target board.


author: Iain Dooley
body: [@Joanna](/t5/user/viewprofilepage/user-id/4396922) hey that's neat I didn't know that about the json response thing.

It looks to me as though the problem is that there's no session data passed in with the URL, so you're not authenticated to view the card when requesting as Butler.

Fortunately you can just put your API key and token into the URL:

get url "[https://trello.com/1/cards/{cardid}/actions?filter=updateCard:desc\&key=YOURKEYHERE\&token=YOURTOKENHERE](https://trello.com/1/cards/{cardid}/actions?filter=updateCard:desc&key=YOURKEYHERE&token=YOURTOKENHERE)", and set the card's description to "{httpresponse\[0\].data.old.desc}"

Note that it's "desc" not "description".

You can grab your API key by clicking this link:

<https://trello.com/1/appKey/generate>

You can then grab a token by putting that key into the following URL where I have KEYGOESHERE and then going to the URL:

```
https://trello.com/1/authorize?key=KEYGOESHERE&name=RecoverDescription&expiration=never&response_type=token&scope=read,write?
```

Replace YOURKEYHERE and YOURTOKENHERE with the key and token you generated with those two links, and viola, your Recover Description button will work! It's pretty cool actually I might use it :)


author: Joanna
body: [@Iain Dooley](/t5/user/viewprofilepage/user-id/1416112)ahh yes, I was suspecting this is an authentication issue.

I checked out your API key/token instructions - works like a charm!

Thanks for your help! :)


author: Dasha Shakov
body: Hey Joanna!

I'm not able to suggest a DIY way to view your version history of card descriptions, I'd recommend checking out the Backups for Trello Power-Up.

Backups for Trello is an on-demand backup \& recovery app. Your Trello data gets saved in the Rewind Vault. In the coming months, we will be releasing a feature where you can see the version history of all your cards. You'll also be able to use our Power-Up to restore cards back to their previous versions.

You can check out the Power-Up listing here: <https://trello.com/power-ups/5f68db5b510db84238769710>.

Let me know if you have any questions!


Tags: butler