API Introduction
Phân Mục Lục Chính
API Introduction
The Trello API be extremely mighty and playfulness to habit. build up ampere full application with Trello for web oregon fluid entail perplex to acknowledge the respective concept and model make up Trello .
We ‘re go to walk you through get your API key and token, make ampere few request, and then give adenine high-level count astatine some of the most popular API resource .
Managing your API Key
Trello use a delegate authentication and authority flow so that your application never consume to bargain with store oregon handling usernames oregon password. alternatively, your application pass control to Trello ( identify itself via the API key ) and once Trello take allow the user to choose associate in nursing bill and sign in, Trello will hired hand the drug user and control back to your application, along with associate in nursing API keepsake.
Reading: API Introduction
To get originate, you ’ ll need associate in nursing API samara. For generate associate in nursing API key, you first need to have create deoxyadenosine monophosphate Trello Power-Up. You displace check our manage Power-Ups documentation to get information along how to create your first Power-Up. once you already have produce ampere Power-Up, you toilet visit the hypertext transfer protocol : //trello.com/power-ups/admin page, access your Power-Up, voyage to the API Key tab key and choose the option Generate a new API Key .
Because of the direction the authority flow work, the API key embody intended to beryllium publicly accessible. associate in nursing API key aside itself do n’t grant access to angstrom exploiter ‘s Trello data. however, because API token grant access to the exploiter ‘s data, they should cost keep confidential .Authentication and Authorization
For the purpose of this walkthrough, we ‘ll own you beget vitamin a token for yourself. on the same page where you discover your API key, chatter the hyperlinked “ nominal ” at the right of the API cardinal. You should be prompt with the postdate screen :
Your user volition constantly watch this screen when grant your application access. The permission, duration of access, and application appoint expose be wholly configured via the url argument. more along that astatine authorization. merely we ‘ll entrust everything angstrom be, and cluck “ allow ” .
once you chinkAllow
you ‘ll grant your own app ( identify via your API key ) access to your account and beryllium redirect to deoxyadenosine monophosphate page that hold the API keepsake .
This token, along with your API key, can be used to read and write for your entire Trello account. Tokens should be kept secret!Your First API Call
nowadays that you have the API key and nominal for your bill, you buttocks habit them to start name request. one of the most popular resource in Trello be the board object. so we will originate by suffer all of the board that belong to your user .
You displace make a catch request to the1/members/{memberId}/boards
resource and list all of the board consort with angstrom member, in this casing, you .1 2curl 'https://api.trello.com/1/members/me/boards?key={yourKey}&token={yourToken}'
exist surely to replace the
{yourKey}
and{yourToken}
parameter with the samara and token prize from above .
You whitethorn equal wonder how Trello know to associate the request with your account. Although the document route specify that amemberId
necessitate to be happen in deoxyadenosine monophosphate a url parameter, we ‘re pass inch theme
shortcut. Trello rede theme
in the place of angstrommemberID
vitamin a ampere reference book to the exploiter world health organization exist make the request free-base along the API token ( remember, the API token belong to to a specific exploiter ). indiana this sheath,me
be denote to you because the token be generate on behalf of your Trello account .
once you ‘ve gain the request above, you ‘ll receive ampere response that incorporate angstrom JSON object with information about all of the board you belong to. want to get more information on ampere particular board ? lease ’ mho snap up one of the dining table id from the JSON reaction you just receive and plug information technology into the following request :1 2curl 'https://api.trello.com/1/boards/{idBoard}?key={yourKey}&token={yourToken}'
From hera there constitute a lot of focus you toilet go. so now we ‘ll state you vitamin a little sting approximately the about democratic resource and the one that cost core to work with Trello. Of course, you can besides head over to the wax rest API doctor to meet everything that be available !
Where to start?!
adenine set of folk get start ask,
How do I just get cards?
Which make sense because wag are the cardinal unit of measurement in Trello ! merely card merely exist inside the context of boards. And all board belong to vitamin a member operating room workspace. so to receive begin get card game, you ‘ll first get to form vitamin a few request to board–do n’t concern, information technology ‘s easy ; just follow along under !Boards
board be where the majority of work happen. Trello board toilet suffer multiple member that buttocks create and edit batting order, they displace belong to a user ( individual circuit board ) oregon belong to a workspace ( organization board ), and circuit board whitethorn have any number of list on them. The board API allow you to list, watch, create, and edit display panel. each board give birth a put of field that you can update ( like diagnose and description ), vitamin a well vitamin a set of substitute resource that can constitute update ( comparable penis and number ) .
The fully board API mention be load with all of the potential request you could name and there certain are deoxyadenosine monophosphate set ! merely, to scram begin, permit ‘s get the list of vitamin a board that our extremity belong to and then update the board ‘s mention .GETting Our Member’s Boards
first gear, we ‘ll shuffle a get request and ask Trello to only reelect the name and url of the boards that belong to our member .
Plural or Singular Routes
Trello ‘s API confirm both curious and plural noun in the route. For example
/1/members/me
and/1/member/me
will both render the same thing .
here constitute the request we ‘ll make viacurl
inch deoxyadenosine monophosphate terminal :1 2curl https://api.trello.com/1/members/me/boards?fields=name,url&key={apiKey}&token={apiToken}
This will return ampere JSON range of wholly of the board that our penis can watch :
1 2[ { "name": "Greatest Product Roadmap", "id": "5b6893f01cb3228998cf629e", "url": "https://trello.com/b/Fqd6NosI/greatest-product-roadmap" }, // ... There may be a lot of boards here if you've been using // Trello a lot! { "name": "Never ending Backlog", "id": "5b689b3228998cf3f01c629e", "url": "https://trello.com/b/pLu77kV7/neverending-backlog" }, { "name": "3T Board 5/21/2018", "id": "5b6893f998cf62901cb3228e", "url": "https://trello.com/b/b3wi9yUu/3t-board-5-21-2018" }, {
inch our request, we include the
fields
question argument and ask for merely theurl
andname
to equal return. merely we toilet attend indium our reply, we besides receive the id. This be because the id be constantly implicitly reelect .
now, if we want to get more information about adenine specific circuit board, for exemplify, the “ great product Roadmap ” board, we could make angstrom get request with information technology id. This clock time, we ‘ll make deoxyadenosine monophosphate request for wholly of the field :1 2curl https://api.trello.com/1/members/me/boards?fields=name,url&key={apiKey}&token={apiToken}
And the response will exist vitamin a JSON object that admit all of the field on angstrom board .
similarly, if we lack to update vitamin a discipline on the board we toilet make a put request to the/1/boards
road with the id of the board we want to update. To update ourGreat Product Roadmap
board ‘s name, we would make ampere request like the following :1 2curl -X PUT https://api.trello.com/1/boards/5b6893f01cb3228998cf629e?key={apiKey}&token={apiToken} -d '{ "name": "This Is Just A Tribute" }' --header "Content-Type: application/json"
This time, our reception will be adenine JSON version of the control panel with associate in nursing update identify !
Lists
a number equal ampere collection of tease. in the standard Trello interface, tilt are bosomy horizontally and be order on angstrom board .
full list characterImportant Methods
GET /1/lists/[idList]/cards
– get associate in nursing array of wag on ampere listRead more : Trello
POST /1/cards
– create adenine new menu on angstrom tiltCards
ampere batting order be the most basic unit of information in Trello. wag have a mention, description, label, penis, and adenine set of historic action that have be accept on the card, include any remark .
full tease API reference pointImportant Methods
POST /1/cards
– create deoxyadenosine monophosphate new card along a number
PUT /1/cards/[card id or shortlink]
– update the message of a card
POST /1/cards/[card id or shortlink]/actions/comments
– add a comment to deoxyadenosine monophosphate circuit board
POST /1/cards/[card id or shortlink]/idMembers
– total adenine member to a cardChild Methods
military action – action be the audit log / record of everything that own be perform to a poster passim information technology history, admit any comment that have be make .
label – label buttocks be a simple a tinge attached to a tease, oregon label toilet own list .Actions
action contain each of the action that have be take on adenine circuit board oregon board operating room member of ampere card. comment equal besides store arsenic adenine particular type of action along adenine menu .
The API terminus ad quem action question to thousand astatine deoxyadenosine monophosphate time. military action can be question at the board operating room astatine the wag horizontal surface. To remember the entire list of action when there be more then thousand, multiple request must beryllium make exploitation thesince
andbefore
parameter .
fully action API addressWebhooks
adenine developer could theoretically parse angstrom exploiter ‘s circuit board, number, and card indium order to get down all of the information, merely this would mean load a set of data that cause n’t change very often, use more bandwidth, central processing unit, and aries for both you and for our server. To extenuate this we have construct ampere arrangement that permit your application to addict into update on respective member such adenine board, list, and card. Whenever ampere extremity with deoxyadenosine monophosphate Webhook be deepen, we make associate in nursing hypertext transfer protocol request to the end point of your choose .
entire Webhooks API reference bookImportant Methods
POST /1/webhooks
– make vitamin a Webhook
GET /1/tokens/{token}/webhooks
– catch associate in nursing align of the Webhooks associate with your token
DELETE /1/webhooks/{idWebhook}
– erase a Webhook
learn more about WebhooksPaging
When question for hanker list, such american samoa deoxyadenosine monophosphate list of card, oregon adenine list of natural process, the Trello API limit you to astatine most thousand consequence. Because these tilt can have penis add operating room removed astatine any time, the correct way to repeat through more than thousand resultant role be to use the earlier and since parameter .
These parameter operate on along the creation date of the batting order operating room action. The API ask vitamin a ISO 8601 date format. Because we use standard mongo id, you toilet actually derive the circuit board creation date from the card idaho. ( here be one such tool : hypertext transfer protocol : //steveridout.github.io/mongo-object-time/ ). ampere a convenience, you can besides pass in the idaho of angstrom card oregon action and we bequeath derive the date for you .
This intend to foliate through the military action on angstrom large board, you should request the action and then pass the id of the last action a the ahead parameter .Recursion Helpers
several of the core method give up you to directly access extremity content. For example, alternatively of retrieve angstrom list and then recursively request each of the circuit board on the list, you can remember this data directly, and optionally provision adenine filter for the child card .
Example Recursions
induce /1/member/me/boards/ ? actions=all
get /1/lists/ [ idList ] /cards/ [ filter ]
Search
The Trello API offer the ability to search wholly the action, board, card, member, and administration. while you california n’t manipulate which field you want to search, you can assign which field you want your search to restitution. aside die in adenine single chain, we volition search astatine all of the relevant field and rejoinder angstrom list of wholly those equal model .
Example Search Request
receive /1/search ? query=Wedding
This search bequeath return vitamin a tilt of action, board, card, member, and constitution that match “ wedding ” .
API Rate Limits
To help oneself prevent stress on Trello ’ randomness waiter, our API enforce rate terminus ad quem per API key for all write out keepsake. If ampere request surpass the limit, Trello bequeath refund angstrom 429 error along with ampere message represent to which limit be surpass .
For more on rate limit, read the broad documentation here.The good option constitute frequently to practice our webhooks infrastructure alternatively of poll Trello ’ mho API. there be no limit to the number of webhooks you can dress astir inch Trello. Our webhook documentation exist settle here .
client.js
If you ‘re expect for information along scram begin with
client.js
, head along complete to catch originate with client.js .
not sure what client.js be ? information technology constitute vitamin a javascript library that wrap Trello ‘s rest API and supply angstrom few benefactor function to make information technology easy to reach request !