Project

General

Profile

Rest api » History » Revision 24

Revision 23 (Jean-Philippe Lang, 2010-12-11 14:37) → Revision 24/102 (Jean-Philippe Lang, 2010-12-23 15:19)

h1. Redmine API 

 Redmine exposes some of its data through a REST API. This API provides access and basic CRUD operations (create, update, delete) for the resources described below. 

 h2. API Description 

 |_.Resource                       |_.Status       |_.Notes    |_.Availability| 
 |[[Rest_Issues|Issues]]           | Beta          | Usable with some bugs and rough edges.    | 1.0 | 
 |[[Rest_Projects|Projects]]       | Beta          | Usable with some bugs and rough edges.    | 1.0 | 
 |[[Rest_Users|Users]]             | Planned | | 1.1 | 
 |[[Rest_TimeEntries|TimeEntries]]             | Planned | | 1.1 | 
 |[[Rest_News|News]]               | Prototype, Planned | Prototype implementation for @index@ only | 1.1 | 
 |[[Rest_WikiPages|Wiki Pages]]    | Planned | | 1.2 | 

 Status legend: 

 * Stable - feature complete, no major changes planned 
 * Beta - usable for integrations with some bugs or missing minor functionality 
 * Alpha - major functionality in place, needs feedback from API users and integrators 
 * Prototype - very rough implementation, possible major breaking changes mid-version. *Not recommended for integration* 
 * Planned - planned in a future version, depending on developer availability 

 h2. General topics 

 h3. Authentication 

 Most of the time, the API requires authentication. To enable the API-style authentication, you have to check *Enable REST API* in Administration -> Settings -> Authentication. Then, authentication can be done in 2 different ways: 
 * using your regular login/password via HTTP Basic authentication. 
 * using your API key which is a handy way to avoid putting a password in a script. The API key may be attached to each request as a "key" parameter or it may be passed in as a username with a random password. You can find your API key on your account page ( /my/account ) when logged in, on the right-hand pane of the default layout. 


 h2. API Description 

 h3. Collection resources and pagination Status legend: 

 The response to a GET request on a collection ressources (eg. @/issues.xml@, @/users.xml@) generally won't return all the objets available in your database. Redmine version:1.1.0 introduces a common way to query such ressources using the following parameters: 

 * @offset@: the offset of the first object to retrieve Stable - feature complete, no major changes planned 
 * @limit@: the number of items to be present in the response (default is 25, maximum is 100) 

 Alternatively, you can use the @page@ parameter in conjunction Beta - usable for integrations with @limit@, instead of @offset@. 

 Examples: 

 <pre> some bugs or missing minor functionality 
 GET /issues.xml 
 => returns the 25 first issues 

 GET /issues.xml?limit=100 
 => returns the 100 first issues 

 GET /issues.xml?offset=30&limit=10 
 => returns 10 issues * Alpha - major functionality in place, needs feedback from the 30th 

 GET /issues.xml?page=3&limit=10 API users and integrators 
 => same as above * Prototype - very rough implementation, possible major breaking changes mid-version. *Not recommended for integration* 
 </pre> 

 Responses to GET requests * Planned - planned in a future version, depending on collection ressources provide information about the total object count available in Redmine developer availability 


 |_.Resource                       |_.Status       |_.Notes    |_.Availability| 
 |[[Rest_Issues|Issues]]           | Beta          | Usable with some bugs and the offset/limit used for the response. Examples: 

 <pre> rough edges.    | 1.0 | 
 GET /issues.xml 

 <issues type="array" total_count="2595" limit="25" offset="0"> 
   ... |[[Rest_Projects|Projects]]       | Beta          | Usable with some bugs and rough edges.    | 1.0 | 
 </issues> |[[Rest_Users|Users]]             | Planned | | 1.1 | 
 </pre> 

 <pre> |[[Rest_TimeEntries|TimeEntries]]             | Planned | | 1.1 | 
 GET /issues.json 

 { "issues":[...], "total_count":2595, "limit":25, "offset":0 } |[[Rest_News|News]]               | Prototype, Planned | Prototype implementation for @index@ only | 1.1 | 
 </pre> 

 Note: if you're using a REST client that does not support such top level attributes (total_count, limit, offset), you can set the @nometa@ parameter or @X-Redmine-Nometa@ HTTP header to 1 to get responses without them. Example: 

 <pre> 
 GET /issues.xml?nometa=1 

 <issues type="array"> 
   ... 
 </issues> 
 </pre> |[[Rest_WikiPages|Wiki Pages]]    | Planned | | 1.2 | 

 h2. API Usage in various languages/tools 

 * [[Rest_api_with_ruby|Ruby]] 
 * [[Rest_api_with_php|PHP]] 
 * [[Rest_api_with_python|Python]] 
 * [[Rest_api_with_curl|cURL]]