Attention! This page is marked as deprecated, use it as reference only if you are sure you need these specific information.
You are looking at an old revision of the page API. This revision was created by William Martin.
Indefero - Application Programming Interface
!!! WORK IN PROGRESS !!!
Introduction
Indefero use a Representational State Transfer (REST) API.
Thoses APIs are a conbination of an URL and an HTTP methods, so for each URL you can use one of thoses methods :
- GET
- POST
All methods are not available for each URL. Available conbination are described is the documentation below.
All the answer form the API use JSON standard and is UTF-8 encoded.
You can learn more about REST on Wikipedia
How to access to the API ?
You can access it by using the same URL you are using for the web interface but with the /api/ prefix.
This url return an HTML answer : http://www.example.com/p/myproject/issues/
This url return an JSON answer : http://www.example.com/api/p/myproject/issues/issues.
How to authenticate the queries ?
Authentication is really simple and is optional.
If you do not authenticate your queries, you will have the same rights as an anonymous user visiting the normal web interface.
If you authenticate your queries, your rights are depending of each projecs access rights.
To authenticate your query, you need to provide 3 parameters to your requests, the parameters are the followings:
- _login: your login.
- _salt: a random salt string.
- _hash: the sha1 hash created from the concatenation of the random salt string and the API key. Ex: sha1(_salt + your_key)
Please note that the 3 parameters are all starting with the underscore "_" character.
Example
curl http://projects.ceondo.com/api/p/indefero/issues/
curl -d "_login=foobar&_salt=123456&_hash=1234567890123456789012345678901234567890" http://projects.ceondo.com/api/p/indefero/issues/
In the list of API below, we don't add those authentication parameters in each example. So, example will be more easy to read.
List of API
Project - List
Get the list of project on the forge.
Project - Create
Create a project on the forge.
This API is restrited to authentificated access with admin rights.
URL : http://<host>/api/admin/projects/create/
Project - Delete
Delete a project on the forge.
This API is restrited to authentificated access with admin rights.
Issue - List
List issue for a specified project.
URL : http://<host>/api/p/<project>/issues/
Action :
- GET : Return a list of open issue (anonymous access available)
- POST : Not supported
Get example :
curl http://projects.ceondo.com/api/p/indefero/issues/
Get Output :
{
"project":"indefero",
"open":152,
"closed":372,
"issues":[
{"id":618,"summary":"Invalid markup with table of content JS","status":1,"modif_dtime":"2011-02-28 08:34:34"},
{"id":617,"summary":"Arch linux AUR package defaults cause an unwanted depreciation error.","status":1,"modif_dtime":"2011-02-27 15:11:52"},
....
]}
Issue - Create
Create an issue for a specified project.
URL : http://<host>/api/p/<project>/issues/create/
Action :
- GET : Return a list of available status for issue creation
- POST : Send the issue creation form and retrieve an acknowledge answer.
Get example :
curl http://projects.ceondo.com/api/p/indefero/issues/create
Get Output :
{
"doc":"A POST request against this url will allow you to create a new issue.",
"status":[
"New",
"Accepted",
"WaitingForAnswer",
"Started"
]}
Post form content
- summary
- content
- status
- owner (optional)
- label1 (optional)
- label2 (optional)
- label3 (optional)
- label4 (optional)
- label5 (optional)
- label6 (optional)
Post example :
curl -d "summary=foo&content=bar" http://127.0.0.1/index.php/api/p/a/issues/create/
Post Output on error :
{
"mess":"error",
"errors":{
"summary":["This field is required."],
"content":["This field is required."]
}}
Post Output on success :
{
"mess":"success",
"issue":29
}
Issue - Update
Update an issue for a specified project.
URL : http://<host>/api/p/<project>/issues/<issue_number>/