<%@ include file="/common/taglibs.jsp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <link href="${ctx}/styles/api/styling.css?<fmt:message key="webapp.version"/>" type="text/css" rel="stylesheet"/>
    <link href="${ctx}/styles/api/prettify.css?<fmt:message key="webapp.version"/>" type="text/css" rel="stylesheet"/>
    <script type="text/javascript" src="${ctx}/scripts/prettify.js?<fmt:message key="webapp.version"/>"></script>
    <title>fixx API - Version <fmt:message key="webapp.version"/></title>


</head>

<body onload="prettyPrint()">

<div class="container">
    <div id="header"></div>
</div>

<div class="band">
    <h1>fixx API - Version <fmt:message key="webapp.version"/></h1>
</div>

<div class="container">
<div class="content">

<h2>Introduction</h2>

<p>The fixx API is based on the concepts of <a
        href="http://en.wikipedia.org/wiki/Representational_State_Transfer">REST</a> and supports four key verbs to
    perform operations on fixx objects.</p>

<p>Example :</p>
<ul>
    <li>GET /api/issues - Retrieve all issue objects</li>
    <li>GET /api/issues/1 - Retrieve issue 1</li>
    <li>POST /api/issues - Create a new issue by posting the values</li>
    <li>PUT /api/issues/1 - Edit/modify an existing issue by posting new values</li>
    <li>DELETE /api/issues/1 - Delete issue 1</li>
</ul>
<p>
    The fixx API currently supports 2 output formats, <strong><a
        href="http://en.wikipedia.org/wiki/XML">XML</a></strong> and <strong><a
        href="http://en.wikipedia.org/wiki/JSON">JSON</a></strong>.
    You can control the format the data is returned in by setting the <strong>Accept</strong> and </strong><strong>Content-Type</strong>
    HTTP Header in your HTTP Request to either <strong>application/xml</strong> or <strong>application/json</strong>.
</p>

<h2>Authentication</h2>

<p>Authentication to the fixx API is currently performed using an existing user account. The user account used to access
    the API will determine the permissions and objects you have access to. For example, if you
    authenticate with an administrator account, you will have the option to access and read any project or issue in the
    system, where as, if you authenticate with a client account, you get to see only projects/issues the client has
    access to.</p>

<p>fixx currently supports <a href="http://en.wikipedia.org/wiki/Basic_access_authentication">HTTP Basic
    Authentication</a>, which means each HTTP request needs to be accompanied by the username and password to access
    fixx.</p>

<p>Note: Browser-based tools that access the API can use the JSESSIONID cookie but this is not officially documented nor
    supported.</p>

<p>Here is how you would authenticate using <em>curl</em>:</p>
    <pre class="prettyprint lang-sh">
        curl -H 'Accept: application/xml' -H 'Content-Type: application/xml' \
        -u user:password http://localhost:9000/api/projects  
    </pre>

<h2>Projects</h2>

<h3>Get projects</h3>

<p><strong>GET /api/projects</strong></p>

<p>Returns all available projects for the logged in user.</p>
    <pre class="prettyprint lang-xml">
        &lt;projects&gt;
            &lt;project&gt;
                .........
            &lt;/project&gt;
            &lt;project&gt;
                .........
            &lt;/project&gt;
            &lt;project&gt;
                .........
            &lt;/project&gt;
        &lt;/projects&gt;
    </pre>

<h3>Get specific project</h3>

<p><strong>GET /api/projects/{project_id}</strong></p>

    <pre class="prettyprint lang-xml">
        &lt;project&gt;
            &lt;id&gt;1&lt;/id&gt;
            &lt;name&gt;fixx&lt;/name&gt;
            &lt;description&gt;bug tracking and issue tracking for the enterprise&lt;/description&gt;
            &lt;projectLead&gt;Sarat Pediredla&lt;/projectLead&gt;
            &lt;forceUsersToLogTime&gt;false&lt;/forceUsersToLogTime&gt;
            &lt;hideTimeLogsFromClient&gt;false&lt;/hideTimeLogsFromClient&gt;
            &lt;restricted&gt;false&lt;/restricted&gt;
            &lt;archived&gt;false&lt;/archived&gt;
        &lt;/project&gt;
    </pre>

<h3>Update a project</h3>

<p>Update an existing project. To update a project without losing it's data, you need to ensure all the following
    attributes are included in the PUT request. Any other attribute not mentioned in the list below will be ignored or set to defaults.</p>
<p>Returns the updated project if the put is successful.</p>

<p><strong>PUT /api/projects/{project_id}</strong></p>
<pre class="prettyprint lang-xml">
        &lt;project&gt;
            &lt;id&gt;1&lt;/id&gt;
            &lt;name&gt;fixx&lt;/name&gt;
            &lt;description&gt;bug tracking and issue tracking for the enterprise&lt;/description&gt;
            &lt;projectLead&gt;Sarat Pediredla&lt;/projectLead&gt;
            &lt;forceUsersToLogTime&gt;false&lt;/forceUsersToLogTime&gt;
            &lt;hideTimeLogsFromClient&gt;false&lt;/hideTimeLogsFromClient&gt;
            &lt;restricted&gt;false&lt;/restricted&gt;
            &lt;archived&gt;false&lt;/archived&gt;
        &lt;/project&gt;
    </pre>


<h2>Resolutions</h2>

<h3>Get all resolutions for a project</h3>

<p><strong>GET /api/projects/{project_id}/resolutions</strong></p>
    <pre class="prettyprint lang-xml">
        &lt;resolutions&gt;
            &lt;resolution&gt;
                &lt;id&gt;1&lt;/id&gt;
                &lt;name&gt;Resolved - Won't fix&lt;/name&gt;
            &lt;/resolution&gt;
            &lt;resolution&gt;
                ..........
            &lt;/resolution&gt;
        &lt;/resolutions&gt;
    </pre>

<h3>Issue Types</h3>

<h3>Get all issue types for a project</h3>

<p><strong>GET /api/projects/{project_id}/issue-types</strong></p>
    <pre class="prettyprint lang-xml">
        &lt;issueTypes&gt;
            &lt;issueType&gt;
                &lt;id&gt;1&lt;/id&gt;
                &lt;name&gt;Bug&lt;/name&gt;
                &lt;description&gt;A problem&lt;/name&gt;
            &lt;/issueType&gt;
            &lt;issueType&gt;
                ..........
            &lt;/issueType&gt;
        &lt;/issueTypes&gt;
    </pre>

<h2>Areas</h2>

<h3>Get all areas for a project</h3>

<p><strong>GET /api/projects/{project_id}/areas</strong></p>
    <pre class="prettyprint lang-xml">
        &lt;areas&gt;
            &lt;area&gt;
                &lt;id&gt;1&lt;/id&gt;
                &lt;name&gt;Java&lt;/name&gt;
                &lt;description&gt;Java-related problems&lt;/name&gt;
            &lt;/area&gt;
            &lt;area&gt;
                ..........
            &lt;/area&gt;
        &lt;/areas&gt;
    </pre>

<h2>Versions</h2>

<h3>Get all versions for a project</h3>

<p><strong>GET /api/projects/{project_id}/versions</strong></p>
    <pre class="prettyprint lang-xml">
        &lt;versions&gt;
            &lt;version&gt;
                &lt;id&gt;1&lt;/id&gt;
                &lt;name&gt;0.1&lt;/name&gt;
                &lt;released&gt;false&lt;/released&gt;
            &lt;/version&gt;
            &lt;version&gt;
                ..........
            &lt;/version&gt;
        &lt;/version&gt;
    </pre>

<h3>Get only released versions for a project</h3>

<p><strong>GET /api/projects/{project_id}/versions?type=fixfor</strong></p>
    <pre class="prettyprint lang-xml">
        &lt;versions&gt;
            &lt;version&gt;
                &lt;id&gt;1&lt;/id&gt;
                &lt;name&gt;0.1&lt;/name&gt;
                &lt;released&gt;true&lt;/released&gt;
            &lt;/version&gt;
            &lt;version&gt;
                ..........
            &lt;/version&gt;
        &lt;/version&gt;
    </pre>

<h2>Issues</h2>

<h3>Get all issues for a project</h3>

<p><strong>GET /api/projects/{project_id}/issues</strong></p>

<p>Returns all issues for a project identified by project_id</p>

      <pre class="prettyprint lang-xml">
          &lt;issues&gt;
            &lt;issue&gt;
                .........
            &lt;/issue&gt;
            &lt;issue&gt;
                .........
            &lt;/issue&gt;
            &lt;issue&gt;
                .........
            &lt;/issue&gt;
          &lt;/issues&gt;
      </pre>

<h3>Get specific issue</h3>

<p><strong>GET /api/issues/{issue_id}</strong></p>

<p>Returns a specific issue identified by issue_id</p>

      <pre class="prettyprint lang-xml">
            &lt;issue&gt;
                &lt;id&gt;1&lt;/id&gt;
                &lt;title&gt;Alpha issue in fixx&lt;/title&gt;
                &lt;description&gt;A test description&lt;/description&gt;
                &lt;assignedTo&gt;1&lt;/assignedTo&gt;
                &lt;type&gt;1&lt;/type&gt;
                &lt;priority&gt;1&lt;/priority&gt;
                &lt;area&gt;1&lt;/area&gt;
                &lt;dueOn&gt;2008-01-14T00:02:00Z&lt;/dueOn&gt;
                &lt;createdBy&gt;1&lt;/createdBy&gt;
                &lt;estimatedTime&gt;0&lt;/estimatedTime&gt;
                &lt;closed&gt;false&lt;/closed&gt;
            &lt;/issue>
      </pre>

<h3>Create a new issue</h3>

<p><strong>POST /api/issues</strong></p>

<p>Create a new issue. Any attributes that are not passed in the post are set to defaults.</p>

<p>Returns the newly created issue if the post is successful.</p>

      <pre class="prettyprint lang-xml">
            &lt;issue&gt;
                &lt;title&gt;.......&lt;/title&gt;
                &lt;description&gt;.........&lt;/description&gt;
                &lt;assignedTo&gt;1&lt;/assignedTo&gt;
                &lt;type&gt;1&lt;/type&gt;
                &lt;priority&gt;1&lt;/priority&gt;
                &lt;area&gt;1&lt;/area&gt;
                &lt;dueOn&gt;2008-01-14T00:02:00Z&lt;/dueOn&gt;
                &lt;estimatedTime&gt;0&lt;/estimatedTime&gt;
                &lt;affected&gt;1&lt;/affected&gt;
                &lt;fixfor&gt;2&lt;/fixfor&gt;
                &lt;closed&gt;false&lt;closed&gt;
            &lt;/issue&gt;
      </pre>

<h3>Update an existing issue</h3>

<p><strong>PUT /api/issues</strong></p>

<p>Update an existing issue. To update an issue without losing it's data, you need to ensure all the following
    attributes are included in the PUT request. Any attributes from the following list that are not passed in the put
    request are set to null. Any other attribute not mentioned in the list below will be ignored or set to defaults.</p>

<p>Returns the updated issue if the put is successful.</p>

      <pre class="prettyprint lang-xml">
            &lt;issue&gt;
                &lt;title&gt;.......&lt;/title&gt;
                &lt;description&gt;.........&lt;/description&gt;
                &lt;assignedTo&gt;1&lt;/assignedTo&gt;
                &lt;type&gt;1&lt;/type&gt;
                &lt;priority&gt;1&lt;/priority&gt;
                &lt;area&gt;1&lt;/area&gt;
                &lt;dueOn&gt;2008-01-14T00:02:00Z&lt;/dueOn&gt;
                &lt;estimatedTime&gt;0&lt;/estimatedTime&gt;
                &lt;affected&gt;1&lt;/affected&gt;
                &lt;fixfor&gt;2&lt;/fixfor&gt;
                &lt;resolution&gt;1&lt;/resolution&gt;
                &lt;resolvedBy&gt;1&lt;/resolvedBy&gt;
                &lt;resolvedOn&gt;2008-01-14T00:02:00Z&lt;/resolvedOn&gt;
                &lt;closed&gt;false&lt;closed&gt;
                &lt;closedOn&gt;2008-01-14T00:02:00Z&lt;/closedOn&gt;
            &lt;/issue&gt;
      </pre>

<h3>Delete an existing issue</h3>

<p>Delete an existing issue if it exists. Returns HTTP Status 200 if successful.</p>

<p><strong>DELETE /api/issues/{issue_id}</strong></p>

<h2>Comments</h2>

<h3>Get all comments for an issue</h3>

<p><strong>GET /api/issues/{issue_id}/comments</strong></p>

<p>Returns all comments for an issue identified by issue_id</p>

      <pre class="prettyprint lang-xml">
          &lt;comments&gt;
            &lt;comment&gt;
                &lt;id&gt;3&lt;/id&gt;
                &lt;text&gt;
                    This bug was reported by 2 people over the last week.
                &lt;/text&gt;
                &lt;createdAt&gt;2008-12-23T18:35:02.045Z&lt;/createdAt&gt;
                &lt;createdBy&gt;1&lt;/createdBy&gt;
                &lt;issue&gt;1&lt;/issue&gt;
            &lt;/comment&gt;
            &lt;comment&gt;
              ............
            &lt;/comment&gt;
            &lt;comment&gt;
              ............
            &lt;/comment&gt;
         &lt;/comments&gt;
      </pre>

<h3>Add a comment to an issue</h3>

<p><strong>POST /api/issues/{issue_id}/comments</strong></p>

<p>Create a new comment on the issue specified by issue_id. Only the follow attributes are accepted on comment creation.
    Any other attribute will be ignored or set to defaults.</p>

<p>Returns the newly created comment if the post is successful.</p>

      <pre class="prettyprint lang-xml">
            &lt;comment&gt;
                &lt;text&gt;Adding a comment through the API&lt;/text&gt;
            &lt;/comment&gt;
      </pre>

<h3>Delete an existing comment</h3>

<p>Delete an existing comment if it exists. Returns HTTP Status 200 if successful.</p>

<p><strong>DELETE /api/issues/{issue_id}/comments/{comment_id}</strong></p>

<h2>Timelogs</h2>

<h3>Get all timelogs for an issue</h3>

<p><strong>GET /api/issues/{issue_id}/timelogs</strong></p>

<p>Returns all timelogs for an issue identified by issue_id</p>

      <pre class="prettyprint lang-xml">
          &lt;timelogs&gt;
            &lt;timelog&gt;
                &lt;id&gt;3&lt;/id&gt;
                &lt;effort&gt;2&lt;/effort&gt;
                &lt;description&gt;Added new CSS code for this view&lt;/description&gt;
                &lt;issue&gt;1&lt;/issue&gt;
                &lt;createdAt&gt;2008-12-23T18:35:02.045Z&lt;/createdAt&gt;
                &lt;createdBy&gt;1&lt;/createdBy&gt;
            &lt;/timelog&gt;
            &lt;timelog&gt;
              ............
            &lt;/timelog&gt;
            &lt;timelog&gt;
              ............
            &lt;/timelog&gt;
         &lt;/timelogs&gt;
      </pre>

<h3>Add a timelog to an issue</h3>

<p><strong>POST /api/issues/{issue_id}/timelogs</strong></p>

<p>Create a new timelog on the issue specified by issue_id. Only the follow attributes are accepted on timelog creation.
    Any other attribute will be ignored or set to defaults.</p>

<p>Returns the newly created timelog if the post is successful.</p>

      <pre class="prettyprint lang-xml">
            &lt;timelog&gt;
                &lt;effort&gt;2.5&lt;/effort&gt;
                &lt;description&gt;Did something interesting&lt;/description&gt;
            &lt;/timelog&gt;
      </pre>

<h3>Delete an existing timelog</h3>

<p>Delete an existing timelog from an issue if it exists. Returns HTTP Status 200 if successful.</p>

<p><strong>DELETE /api/issues/{issue_id}/timelogs/{timelog_id}</strong></p>


<h2>Tags</h2>

<h3>Get all tags for an issue</h3>

<p><strong>GET /api/issues/{issue_id}/tags</strong></p>

<p>Returns all tags for an issue identified by issue_id</p>

      <pre class="prettyprint lang-xml">
          &lt;tags&gt;
            &lt;tag&gt;
                &lt;id&gt;2&lt;/id&gt;
                &lt;label&gt;how to&lt;/label&gt;
            &lt;/tag&gt;
            &lt;tag&gt;
              ............
            &lt;/tag&gt;
            &lt;tag&gt;
              ............
            &lt;/tag&gt;
         &lt;/tags&gt;
      </pre>

<h3>Add a tag to an issue</h3>

<p><strong>POST /api/issues/{issue_id}/tags</strong></p>

<p>Create a new tag on the issue specified by issue_id. If the tag already exists, fixx will re-use it. Only the follow
    attributes are accepted on tag creation. Any other attribute will be ignored or set to defaults.</p>

<p>Returns the newly created tag if the post is successful.</p>

          <pre class="prettyprint lang-xml">
                &lt;tag&gt;
                    &lt;label&gt;bug&lt;/label&gt;
                &lt;/tag&gt;
          </pre>

<h3>Delete an existing tag</h3>

<p>Delete an existing tag from an issue if it exists. Returns HTTP Status 200 if successful.</p>

<p><strong>DELETE /api/issues/{issue_id}/tags/{tag_id}</strong></p>

<h2>Changelogs</h2>

<h3>Get all changelogs for an issue</h3>

<p><strong>GET /api/issues/{issue_id}/changelogs</strong></p>
        <pre class="prettyprint lang-xml">
            &lt;changelogs&gt;
                &lt;changelog&gt;
                    &lt;id&gt;1&lt;/id&gt;
                    &lt;event&gt;COMMENT_CREATED&lt;/event&gt;
                    &lt;comment&gt;This has been reassigned to Mark.&lt;/comment&gt;
                    &lt;createdAt&gt;2008-12-23T19:59:06.923Z&lt;/createAt&gt;
                    &lt;createdBy&gt;1&lt;/createdBy&gt;
                &lt;/changelog&gt;
                &lt;changelog&gt;
                    ..........
                &lt;/changelog&gt;
            &lt;/changelogs&gt;
        </pre>

<h2>Users</h2>

<h3>Get all users in the system</h3>

<p><strong>GET /users</strong></p>
    <pre class="prettyprint lang-xml">
        &lt;users&gt;
            &lt;user&gt;
                &lt;id&gt;1&lt;/id&gt;
                &lt;firstName&gt;Sarat&lt;/firstName&gt;
                &lt;lastName&gt;Pediredla&lt;/lastName&gt;
                &lt;username&gt;sarat&lt;/username&gt;
                &lt;email&gt;sarat@email.com&lt;/email&gt;
                &lt;openid&gt;&lt;/openid&gt;
                &lt;phoneNumber&gt;111111&lt;/phoneNumber&gt;
                &lt;website&gt;http://hedgehoglab.com&lt;/website&gt;
                &lt;enabled&gt;true&lt;/enabled&gt;
            &lt;/user&gt;
            &lt;user&gt;
                ..........
            &lt;/user&gt;
        &lt;/users&gt;
    </pre>

<h3>Get a specific user in the system</h3>
<p>Allows you to pass either a user id or username to retrieve details.</p>

<p><strong>GET /users/{user_id}</strong> or <strong>GET /users/{username}</strong></p>
    <pre class="prettyprint lang-xml">
            &lt;user&gt;
                &lt;id&gt;1&lt;/id&gt;
                &lt;firstName&gt;Sarat&lt;/firstName&gt;
                &lt;lastName&gt;Pediredla&lt;/lastName&gt;
                &lt;username&gt;sarat&lt;/username&gt;
                &lt;email&gt;sarat@email.com&lt;/email&gt;
                &lt;openid&gt;&lt;/openid&gt;
                &lt;phoneNumber&gt;111111&lt;/phoneNumber&gt;
                &lt;website&gt;http://hedgehoglab.com&lt;/website&gt;
                &lt;enabled&gt;true&lt;/enabled&gt;
            &lt;/user&gt;
    </pre>

<h3>Get all users assigned specifically to a project (only applicable to restricted projects)</h3>

<p><strong>GET /api/projects/{project_id}/users</strong></p>
    <pre class="prettyprint lang-xml">
        &lt;users&gt;
            &lt;user&gt;
                &lt;id&gt;1&lt;/id&gt;
                &lt;firstName&gt;Sarat&lt;/firstName&gt;
                &lt;lastName&gt;Pediredla&lt;/lastName&gt;
                &lt;username&gt;sarat&lt;/username&gt;
                &lt;email&gt;sarat@email.com&lt;/email&gt;
                &lt;openid&gt;&lt;/openid&gt;
                &lt;phoneNumber&gt;111111&lt;/phoneNumber&gt;
                &lt;website&gt;http://hedgehoglab.com&lt;/website&gt;
                &lt;enabled&gt;true&lt;/enabled&gt;
            &lt;/user&gt;
            &lt;user&gt;
                ..........
            &lt;/user&gt;
        &lt;/users&gt;
    </pre>

<h3>Get all clients assigned to a project</h3>

<p><strong>GET /api/projects/{project_id}/clients</strong></p>
    <pre class="prettyprint lang-xml">
        &lt;users&gt;
            &lt;user&gt;
                &lt;id&gt;1&lt;/id&gt;
                &lt;firstName&gt;Sarat&lt;/firstName&gt;
                &lt;lastName&gt;Pediredla&lt;/lastName&gt;
                &lt;username&gt;sarat&lt;/username&gt;
                &lt;email&gt;sarat@email.com&lt;/email&gt;
                &lt;openid&gt;&lt;/openid&gt;
                &lt;phoneNumber&gt;111111&lt;/phoneNumber&gt;
                &lt;website&gt;http://hedgehoglab.com&lt;/website&gt;
                &lt;enabled&gt;true&lt;/enabled&gt;
            &lt;/user&gt;
            &lt;user&gt;
                ..........
            &lt;/user&gt;
        &lt;/users&gt;
    </pre>

<h3>Get all users watching an issue</h3>

<p><strong>GET /api/issues/{issue_id}/watchers</strong></p>
        <pre class="prettyprint lang-xml">
            &lt;users&gt;
                &lt;user&gt;
                    &lt;id&gt;1&lt;/id&gt;
                    &lt;firstName&gt;Sarat&lt;/firstName&gt;
                    &lt;lastName&gt;Pediredla&lt;/lastName&gt;
                    &lt;username&gt;sarat&lt;/username&gt;
                    &lt;email&gt;sarat@email.com&lt;/email&gt;
                    &lt;openid&gt;&lt;/openid&gt;
                    &lt;phoneNumber&gt;111111&lt;/phoneNumber&gt;
                    &lt;website&gt;http://hedgehoglab.com&lt;/website&gt;
                    &lt;enabled&gt;true&lt;/enabled&gt;
                &lt;/user&gt;
                &lt;user&gt;
                    ..........
                &lt;/user&gt;
            &lt;/users&gt;
        </pre>

<h3>Subscribe a user to watch issue notifications</h3>
<p><strong>PUT /api/issues/{issue_id}/watchers/{watcher_id}</strong></p>

<p>Returns the updated list of watchers if successful.</p>

<h2>Priorities</h2>

<h3>Get all priorities in the system</h3>

<p><strong>GET /priorities</strong></p>
        <pre class="prettyprint lang-xml">
            &lt;priorities&gt;
                &lt;priority&gt;
                    &lt;id&gt;1&lt;/id&gt;
                    &lt;name&gt;Minor&lt;/name&gt;
                    &lt;description&gt;Minor task&lt;/description&gt;
                    &lt;weight&gt;sarat&lt;/weight&gt;
                &lt;/priority&gt;
                &lt;priority&gt;
                    ..........
                &lt;/priority&gt;
            &lt;/priorities&gt;
        </pre>

<h3>Get a specific priority in the system</h3>

<p><strong>GET /priorities/{priority_id}</strong></p>
        <pre class="prettyprint lang-xml">
                &lt;priority&gt;
                    &lt;id&gt;1&lt;/id&gt;
                    &lt;name&gt;Minor&lt;/name&gt;
                    &lt;description&gt;Minor task&lt;/description&gt;
                    &lt;weight&gt;sarat&lt;/weight&gt;
                &lt;/priority&gt;
        </pre>


</div>

</div>

<div class="footer">

</div>

</body>
</html>
