What is the difference between 'trello.com' and 'api.trello.com' from the API perspective?

Hello,

 

So lately I've been trying to shoot up my little tool with the API, but I've run into some obstacles.

First I found a tutorial which seemly is outdated and I can't find that page again, maybe it was shut down I am so confused I don't even know.

So to point out the problem, I've tried using simply the 'https://trello.com/1/ ... base as the api and I could get card details without any problem but I've run into obstacles if I tried to update a card's details with PUT. I had the correct permission and authentication, the fact that I could get information from a card could indicate that.

Anyways, I tried to follow the new? api documentation but I saw that the base for the api url had changed to 'https://api.trello.com/1/' and then I can't make it work again.

After the authorization I get a token with the same length, I use everything the same way (with checking the new? api documentation constantly) but it just not works. The results are different, if I use my api key in the url then it says invalid token, if I don't it says unauthorized ...

If any of this make sense for someone, can you help me point to a direction where I can smash my head into a wall and realize I'm a retarded?
Or if anything happened with the API lately and it's just a momentarily thing (which i doubt tho) and that causes these problems.

If needed, I will provide detailed urls and messages, but using the examples from the api doc and 'Trying out' stuff failing as well.

 

Thank you very much.

2 answers

2 accepted

0 votes
Accepted answer
Oscar Triscon Community Champion Jul 27, 2017

https://trello.com/1 is still working perfectly fine, and I haven't heard anything from Trello about any changes there. It's true that the new documentation has some mentions of api.trello.com but most of the examples are https://trello.com. The documentation was released recently and seems to have a few bugs.

I'm certain your problem arises from elsewhere. I would go back to using trello.com and making sure that the PUT request has a valid payload.

If you give me more details about your requests and responses I may be able to help.

Thank you Oscar, I will put everything under knife again tomorrow and try to focus on getting the https://trello.com/1 work with PUT.

0 votes
Accepted answer

So I tried to do it again with the old 'api'-less url and here are the results:

 

https://trello.com/1/cards/my_card_id/desc?value=some_text

in the request body I put the followings:


token=token_from_authorization
key=my_api_key

For this setup I get "Invalid key", if I remove the key from the list it stills the same.

If I'm not using the request body and use the following url:

https://trello.com/1/cards/my_card_id/desc?value=some_text&key=my_api_key&token=token_from_authorization
Result: "Invalid key"

The key/token has to be valid since I got through the authorization and got token data from a user and could get a card description.

Do you have any idea what is wrong with my urls or data?

 

Edit:

Another try with mixed order of parameters in the url:

Oscar Triscon Community Champion Jul 28, 2017

Try this instead:

Issue a PUT request to

https://trello.com/1/cards/my_card_id/desc?key=my_api_key&token=token_from_authorization

with payload:

{ "value": "some_text" }

and a header with:

 Content-Type: application/json

If this still returns Invalid key, it's most likely because the format of the key is wrong.

Make sure you're not reversing the key and the token. The API key is 32 hexadecimal characters and the token is 64 hexadecimal characters.

I've seen this statement in which the token is longer than the API key, but for me they are the same length.

I am getting the key from the user through this url:

https://trello.com/1/authorize?key=my_api_key&...

After the user clicks on Allow, a screen with 32 bit hex token appears in which it says:

You have granted access to your Trello information.
To complete the process, please give this verification code:
4ebcc7dd27fde13868433c5fbc3a2dc2

 (the token is useless now)

And as I've said earlier getting card/member information isn't a problem at all with said token.

Also I tried the PUT request as you've suggested and the result is:

invalid token

Oscar Triscon Community Champion Jul 28, 2017

You need to make sure your authorization response is a token, not a verification code:

https://trello.com/1/authorize?expiration=never&scope=read,write,account&response_type=token&name=My%20App%20Name&key=APP_KEY

Wonderful, it seems I somehow had in the authorization url the 'callback_method=postMessage' which I can see now why it caused the problem.

After deleting said parameter I got the 'Please give ... token' instead of verification.

Thank you for your help and sorry for this nonsense.

PS:

The card update works flawlessly.

Oscar Triscon Community Champion Jul 28, 2017

Great! Glad we could figure it out.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Friday in Jira Service Desk

Looking for anyone who has switched from Zendesk to Jira Service Desk

Hi Community! The Jira Service Desk marketing team is looking for customers who have successfully switched from Zendesk to Jira Service Desk!   We’d love to hear your thoughts on the pros and ...

153 views 8 3
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you