问题
I'm trying to get all cards in a board assigned to a specific user, but the below returns all the cards in a board.
I did not find this solution anywhere; this is what I tried, and it returns cards assigned to all users:
https://api.trello.com/1/boards/${boardid}/cards?fields=name,shortLink&key=${applicationkey}&token=${userkey}
- ${boardid} = id of the board I want cards from
- ${applicationkey} = Trello Developer API Key
- ${userkey} = Trello User Token
Looks like a lot of people were able to do this, but there is no working documentation on this one.
回答1:
I was able to accomplish this (get all cards assigned to me), by using the Trello search API.
Query URL (Cards assigned to a member):
https://api.trello.com/1/search?query=label:green%20member:${memberid}%20board:${boardname}%20sort:edited&card_fields=name,shortLink&cards_limit=100&key=${applicationkey}&token=${userkey}
Query Pattern (regexp to read cards):
"name":"({Description}.+?)","shortLink":"({Id}.+?)"
Parameters used:
- ${applicationkey} = Developer API Key
- ${userkey} = User Token
- ${boardname} = Actual name of the board in Trello
- ${memberid} = member id of the Trello user
Get Developer API key and User Token: Click here
Get member id from here:
https://api.trello.com/1/search?query=is:open%20board:${boardname}%20sort:edited&card_fields=name,shortLink,member&cards_limit=100&key=APIKey&token=UserToken
来源:https://stackoverflow.com/questions/50395252/trello-api-get-all-cards-assigned-to-a-user-on-a-specific-board