REST API Checklists

Listing checklists

GET /issues/1/checklists.xml

Returns list of checklist items for issue #1.

Response:

<checklists total_count="7" type="array">
  <checklist>
    <id>1</id>
    <issue_id>572</issue_id>
    <subject>Search for company activity for last year</subject>
    <is_done>true</is_done>
    <position>1</position>
    <created_at>2014-09-10T10:58:32Z</created_at>
    <updated_at>2014-09-10T10:59:20Z</updated_at>
  </checklist>
  ...
</checklists>

Creating a checklist

POST /issues/1/checklists.[format]

Parameters:

  • checklist - A hash of the checklist attributes:
    • subject
    • is_done
    • position
    • issue_id

Examples:

POST /checklists.xml
<?xml version="1.0"?>
<checklist>
  <issue_id>1</issue_id>
  <subject>New checklist item</subject>
  <is_done>0</is_done>
</checklist>
POST /checklists.json
{
  "checklist": {
    "issue_id": 1,
    "subject": "New checklist item",
    "is_done": 0
  }
}

Creating issue with a checklist

POST /issues.json
{
  "issue": {
    "project_id": 1,
    "subject": "Example",
    "priority_id": 4,
    "checklists_attributes": [
      {
        "is_done"=>"0", 
        "subject"=>"First" 
      },
      {
        "is_done"=>"0", 
        "subject"=>"Second" 
      }
    ]
  }
}

Curl examples

Update checklist item

curl -v -H “Accept: application/json” -H "Content-Type: application/json" -X PUT http://localhost:3000/checklists/1 -u admin:admin -d "{\"checklist\": {\"subject\":\"Item_changed\"}}" 

Create checklist item

curl -v -H "Content-Type: application/xml" -X POST -d "<checklist><issue_id>1</issue_id><subject>New checklist item</subject><is_done>0</is_done></checklist>" -u admin:admin http://localhost:3000/issues/1/checklists.xml
Was this article helpful? Yes  No
551 from 588 found this helpful