Help & Support
Follow

LeanKit API Version 1.0 Basics

Introduction

The LeanKit API provides a REST-like** interface for retrieving data about boards, cards, and recent history, as well as methods for moving cards, adding and updating cards, and deleting cards.

** It doesn't strictly follow the rules of REST. For example, we use only the GET and POST HTTP verbs, and the method calls aren't strictly resource-based in every case. But the basic structure and ease of use of a REST API are approximated, without all of the ceremony.

Your Account Url

Each account in LeanKit has its own unique url. When you sign up for an account, you'll choose a hostname that will form part of the url. If, for example, you choose "myaccount" as your hostname, the url to your LeanKit account will be https://myaccount.leankit.com. In all the API documentation and examples, we'll use "myaccount" as the example url for your account. When making your API calls, simply replace this part of the url with the url to your LeanKit account. Example Url:

https://myaccount.leankit.com

Your API Url

Your LeanKit API url is built based on your account url. So, if your account url is https://myaccount.leankit.com, your LeanKit API Url would be:

https://myaccount.leankit.com/kanban/api/

Each Method in the API will be appended onto your base API Url as shown in the examples below.

Your Board ID

Most of the calls to the LeanKit API are specific to a Board. In order to make an API call, then, you'll need to determine the BoardId for your Board. When viewing your Board in your web browser, you can see the Board ID in the url. So, for example, if your url when viewing your board is https://myaccount.leankit.com/Boards/View/101000#workflow-view, then your board ID is 101000. For most API calls, then your API url would be appended with /board/{id}, like this:

https://myaccount.leankit.com/kanban/api/board/101000/

Basic Authentication

LeanKit API calls all use Basic Authentication. In Basic Authentication the username and password are base64-encoded and appended to the header of each HTTP request. You could do this manually, base64-encoding the username and password and adding an Authentication header to the request, but most likely you will use a utility provided by whatever programming language you are using to access the API. 

GET example using cURL

curl -H "Authorization: Basic Zzxxyy" https://myaccount.leankit.com/kanban/api/board/101000/getboardidentifiers

POST example using cURL

curl -H "Content-Type: application/json" -H "Authorization: Basic Zzxxyy" -X POST -d '{"Title":"My New Card","TypeId":102788,"Description":"This is the new card","Priority":0,"Size":2,"IsBlocked":false}' https://myaccount.leankit.com/kanban/api/board/101000/AddCard/Lane/102052/Position/0

Example using C#

var request = (HttpWebRequest)WebRequest.Create("https://myaccount.leankit.com/kanban/api/board/101000/GetBoardIdentifiers");
request.Method = "GET";
request.Credentials = new NetworkCredential("myusername@mydomain.com", "mypassword");
request.PreAuthenticate = true;

Example using Python

import httplib2

http = httplib2.Http()
http.add_credentials(username, password)

HTTP GET and HTTP POST

Each LeanKit API request is either an HTTP GET or an HTTP POST. As an oversimplification, the difference is in how the data is passed to the server. With GET, the request data is passed as part of the url. Whenever you are making a an API call that simply retrieves data based on the parameters in the API URL, you will use a GET request. With POST, the request data is passed as part of the request body. Whenever you are making an API call that updates data, such as adding or editing a Card, you will POST the data to be updated as part of the request body.

Sending data with HTTP POST

When sending data to the LeanKit API, data must be formatted as JavaScript Object Notation (JSON), and the request must include the Content-Type header value "application/json".

ReplyCode, ReplyText, and ReplyData

Each response from a LeanKit API call is returned as JavaScript Object Notation (JSON). Responses are returned in a standard format with three top-level elements:

{
  "ReplyCode": 200,
  "ReplyText": "Some message about what just happened",
  "ReplyData": [   ]
}

The ReplyCode is a success or failure code appropriate to the given API request. The ReplyText is a short message about the result of the API request. ReplyData, if applicable, will include JSON data, such as board or card information.

Possible ReplyCode values:

NoData=100,
DataRetrievalSuccess = 200,
DataInsertSuccess = 201,
DataUpdateSuccess = 202,
DataDeleteSuccess = 203,
SystemException = 500,
MinorException = 501,
UserException = 502,
FatalException = 503,
ThrottleWaitResponse = 800,
WipOverrideCommentRequired = 900,
ResendingEmailRequired = 902,
UnauthorizedAccess = 1000
Was this article helpful?
8 out of 9 found this helpful
Have more questions? Submit a request

Comments