Resource: Incidents ( /api/incidents )

Incidents collection resource

Root Relation: Incidents

Methods

GET


Retrieves all (or a subset) of incidents that are visible.

This method supports the TQL query parameters tql, $top, $take and $inlinecount. See TQL Topic for more details.

Required Permissions

  • TestManagement/View

Supported Expansions

  • FieldControls
  • FieldValues
  • Project
  • Comments

For more details on expansions, please see the Expand help topic.

Status Codes

These are the expected status codes returned by the service - in addition, some other status codes may be returned if either an internal error occurs or there is an authentication issue (such as an expired OAuth token).

StatusDescription
200 - OKReturned if the request was completed successfully.
403 - ForbiddenReturned if ET would not complete request (normally due to a validation failure or the necessary permissions to complete the request have not been met).

Example - GET (filtered by TQL Query)

Retrieves all incidents matching a TQL query.

Request Headers

KeyValueDescription
Acceptapplication/json

Request Parameters

KeyValueDescription
tqlName ~ 'Report'The TQL query to execute.
$top5Maximum number of results to return (defaults to 25).
$skip0Number of results to skip before return the $top number of results matching the query.

Response Headers

KeyValueDescription
Content-Typeapplication/json; charset=utf-8

Response Body

{
  "Skip": 0,
  "Top": 5,
  "Total": 1,
  "Items": [
    {
      "Id": "4bb709c2-e0e7-4af3-9f60-a045016a9610",
      "Summary": "Report pagination",
      "AssignedToId": "191375f2-ae6e-4b52-8bed-4192e34b6486",
      "AssignedTo": "joeb",
      "Description": "Check report pagination works correctly",
      "PriorityId": "fe92720f-3fbd-4e49-a3b2-309f6a0a062a",
      "StatusId": "62daf195-0a65-400f-af4b-7fda3d529acb",
      "TypeId": "cfe51645-8179-4fe5-ada3-c145a64d0a05",
      "ResolutionId": "47b4b0cc-22ee-4993-8ed5-ef1dec40a0d2",
      "AffectedVersionIds": null,
      "FixedVersionIds": null,
      "ComponentIds": null,
      "CreatedAt": "2012-01-01T14:04:05Z",
      "LastUpdatedAt": "2012-02-02T15:05:06Z",
      "CreatedById": "191375f2-ae6e-4b52-8bed-4192e34b6486",
      "CreatedBy": "joeb",
      "LastUpdatedById": "191375f2-ae6e-4b52-8bed-4192e34b6486",
      "LastUpdatedBy": "joeb",
      "ProjectId": "27dcaff0-1f8a-4dff-b49a-bb3d9f7153b3",
      "ProjectName": "Test Project",
      "IncidentNumber": 0,
      "InternalId": null,
      "HasAttachments": false,
      "Expands": [
        "FieldControls",
        "FieldValues",
        "Project"
      ],
      "Self": "http://localhost/api/incident/4bb709c2-e0e7-4af3-9f60-a045016a9610",
      "Links": [
        {
          "Href": "http://localhost/api/incident/4bb709c2-e0e7-4af3-9f60-a045016a9610/relationships",
          "Rel": "Relationships"
        },
        {
          "Href": "http://localhost/api/incident/4bb709c2-e0e7-4af3-9f60-a045016a9610/allrelationships",
          "Rel": "AllRelationships"
        },
        {
          "Href": "http://localhost/api/incident/4bb709c2-e0e7-4af3-9f60-a045016a9610/comments",
          "Rel": "Comments"
        },
        {
          "Href": "http://localhost/api/project/27dcaff0-1f8a-4dff-b49a-bb3d9f7153b3",
          "Rel": "Project"
        }
      ]
    }
  ],
  "Self": "http://localhost/api/api/incidents?tql=Name~'Report'&$top=5&$skip=0"
}

Status Code

200 - OK

Example - GET (no filter)

Retrieves all incidents.

Request Headers

KeyValueDescription
Acceptapplication/json

Request Parameters

KeyValueDescription
$top5Maximum number of results to return (defaults to 25).
$skip0Number of results to skip before return the $top number of results matching the query.

Response Headers

KeyValueDescription
Content-Typeapplication/json; charset=utf-8

Response Body

{
  "Skip": 0,
  "Top": 5,
  "Total": 2,
  "Items": [
    {
      "Id": "4bb709c2-e0e7-4af3-9f60-a045016a9610",
      "Summary": "Report pagination",
      "AssignedToId": "191375f2-ae6e-4b52-8bed-4192e34b6486",
      "AssignedTo": "joeb",
      "Description": "Check report pagination works correctly",
      "PriorityId": "fe92720f-3fbd-4e49-a3b2-309f6a0a062a",
      "StatusId": "62daf195-0a65-400f-af4b-7fda3d529acb",
      "TypeId": "cfe51645-8179-4fe5-ada3-c145a64d0a05",
      "ResolutionId": "47b4b0cc-22ee-4993-8ed5-ef1dec40a0d2",
      "AffectedVersionIds": null,
      "FixedVersionIds": null,
      "ComponentIds": null,
      "CreatedAt": "2012-01-01T14:04:05Z",
      "LastUpdatedAt": "2012-02-02T15:05:06Z",
      "CreatedById": "191375f2-ae6e-4b52-8bed-4192e34b6486",
      "CreatedBy": "joeb",
      "LastUpdatedById": "191375f2-ae6e-4b52-8bed-4192e34b6486",
      "LastUpdatedBy": "joeb",
      "ProjectId": "27dcaff0-1f8a-4dff-b49a-bb3d9f7153b3",
      "ProjectName": "Test Project",
      "IncidentNumber": 0,
      "InternalId": null,
      "HasAttachments": false,
      "Expands": [
        "FieldControls",
        "FieldValues",
        "Project"
      ],
      "Self": "http://localhost/api/incident/4bb709c2-e0e7-4af3-9f60-a045016a9610",
      "Links": [
        {
          "Href": "http://localhost/api/incident/4bb709c2-e0e7-4af3-9f60-a045016a9610/relationships",
          "Rel": "Relationships"
        },
        {
          "Href": "http://localhost/api/incident/4bb709c2-e0e7-4af3-9f60-a045016a9610/allrelationships",
          "Rel": "AllRelationships"
        },
        {
          "Href": "http://localhost/api/incident/4bb709c2-e0e7-4af3-9f60-a045016a9610/comments",
          "Rel": "Comments"
        },
        {
          "Href": "http://localhost/api/project/27dcaff0-1f8a-4dff-b49a-bb3d9f7153b3",
          "Rel": "Project"
        }
      ]
    },
    {
      "Id": "4bb709c2-e0e7-4af3-9f60-a045016a9610",
      "Summary": "Login",
      "AssignedToId": null,
      "AssignedTo": null,
      "Description": "Check report pagination works correctly",
      "PriorityId": "fe92720f-3fbd-4e49-a3b2-309f6a0a062a",
      "StatusId": "62daf195-0a65-400f-af4b-7fda3d529acb",
      "TypeId": "cfe51645-8179-4fe5-ada3-c145a64d0a05",
      "ResolutionId": "47b4b0cc-22ee-4993-8ed5-ef1dec40a0d2",
      "AffectedVersionIds": null,
      "FixedVersionIds": null,
      "ComponentIds": null,
      "CreatedAt": "2012-03-01T14:04:05Z",
      "LastUpdatedAt": "2012-03-02T15:05:06Z",
      "CreatedById": "191375f2-ae6e-4b52-8bed-4192e34b6486",
      "CreatedBy": "joeb",
      "LastUpdatedById": "191375f2-ae6e-4b52-8bed-4192e34b6486",
      "LastUpdatedBy": "joeb",
      "ProjectId": "27dcaff0-1f8a-4dff-b49a-bb3d9f7153b3",
      "ProjectName": "Test Project",
      "IncidentNumber": 0,
      "InternalId": null,
      "HasAttachments": false,
      "Expands": [
        "FieldControls",
        "FieldValues",
        "Project"
      ],
      "Self": "http://localhost/api/incident/4bb709c2-e0e7-4af3-9f60-a045016a9610",
      "Links": [
        {
          "Href": "http://localhost/api/incident/4bb709c2-e0e7-4af3-9f60-a045016a9610/relationships",
          "Rel": "Relationships"
        },
        {
          "Href": "http://localhost/api/incident/4bb709c2-e0e7-4af3-9f60-a045016a9610/allrelationships",
          "Rel": "AllRelationships"
        },
        {
          "Href": "http://localhost/api/incident/4bb709c2-e0e7-4af3-9f60-a045016a9610/comments",
          "Rel": "Comments"
        },
        {
          "Href": "http://localhost/api/project/27dcaff0-1f8a-4dff-b49a-bb3d9f7153b3",
          "Rel": "Project"
        }
      ]
    }
  ],
  "Self": "http://localhost/api/api/incidents?$top=5&$skip=0"
}

Status Code

200 - OK

POST


Creates a new test incident.

Required Permissions

  • TestManagement/ExecuteTests

Supported Expansions

  • FieldControls
  • FieldValues
  • Project
  • Comments

For more details on expansions, please see the Expand help topic.

Status Codes

These are the expected status codes returned by the service - in addition, some other status codes may be returned if either an internal error occurs or there is an authentication issue (such as an expired OAuth token).

StatusDescription
200 - OKReturned if the request was completed successfully.

Example - Create Incident with minimum required fields

Example of creating a new incident with the minimum required information.

Request Headers

KeyValueDescription
Acceptapplication/json
Content-typeapplication/json

Request Body

{
  "ProjectId": "27dcaff0-1f8a-4dff-b49a-bb3d9f7153b3",
  "Summary": "My New Incident",
  "PriorityId": "fe92720f-3fbd-4e49-a3b2-309f6a0a062a",
  "StatusId": "62daf195-0a65-400f-af4b-7fda3d529acb",
  "TypeId": "cfe51645-8179-4fe5-ada3-c145a64d0a05",
  "FieldControlValues": null,
  "FieldValues": null
}

Response Headers

KeyValueDescription
Locationhttp://localhost/api/incident/4bb709c2-e0e7-4af3-9f60-a045016a9610
Content-Typeapplication/json; charset=utf-8

Response Body

{
  "Id": "4bb709c2-e0e7-4af3-9f60-a045016a9610",
  "Summary": "My New Incident",
  "AssignedToId": null,
  "AssignedTo": null,
  "Description": null,
  "PriorityId": "fe92720f-3fbd-4e49-a3b2-309f6a0a062a",
  "StatusId": "62daf195-0a65-400f-af4b-7fda3d529acb",
  "TypeId": "cfe51645-8179-4fe5-ada3-c145a64d0a05",
  "ResolutionId": "47b4b0cc-22ee-4993-8ed5-ef1dec40a0d2",
  "AffectedVersionIds": null,
  "FixedVersionIds": null,
  "ComponentIds": null,
  "CreatedAt": "2012-01-01T14:04:05Z",
  "LastUpdatedAt": "2012-02-02T15:05:06Z",
  "CreatedById": "191375f2-ae6e-4b52-8bed-4192e34b6486",
  "CreatedBy": "joeb",
  "LastUpdatedById": "191375f2-ae6e-4b52-8bed-4192e34b6486",
  "LastUpdatedBy": "joeb",
  "ProjectId": "27dcaff0-1f8a-4dff-b49a-bb3d9f7153b3",
  "ProjectName": "Test Project",
  "IncidentNumber": 0,
  "InternalId": null,
  "HasAttachments": false,
  "Expands": [
    "FieldControls",
    "FieldValues",
    "Project"
  ],
  "Self": "http://localhost/api/incident/4bb709c2-e0e7-4af3-9f60-a045016a9610",
  "Links": [
    {
      "Href": "http://localhost/api/incident/4bb709c2-e0e7-4af3-9f60-a045016a9610/relationships",
      "Rel": "Relationships"
    },
    {
      "Href": "http://localhost/api/incident/4bb709c2-e0e7-4af3-9f60-a045016a9610/allrelationships",
      "Rel": "AllRelationships"
    },
    {
      "Href": "http://localhost/api/incident/4bb709c2-e0e7-4af3-9f60-a045016a9610/comments",
      "Rel": "Comments"
    },
    {
      "Href": "http://localhost/api/project/27dcaff0-1f8a-4dff-b49a-bb3d9f7153b3",
      "Rel": "Project"
    }
  ]
}

Status Code

201 - Created

Example - Create Incident with most fields populated

Example of creating an new Incident with most fields populated (including custom fields and comments) - Note: when performing a PUT or POST that includes comments, the comments Expand will be automatically applied to the response.

Request Headers

KeyValueDescription
Acceptapplication/json
Content-typeapplication/json

Request Parameters

KeyValueDescription
$expandFieldValuesExpand field (we expand the FieldValues to ensure that they are included in the response to creating a new incident.

Request Body

{
  "TemporaryId": "6cc26034-6514-44e0-907c-8f4f5eaa85b5",
  "ProjectId": "27dcaff0-1f8a-4dff-b49a-bb3d9f7153b3",
  "Number": 22,
  "Summary": "My New Incident",
  "AssignedToId": "191375f2-ae6e-4b52-8bed-4192e34b6486",
  "EstimatedDuration": "5m",
  "PriorityId": "fe92720f-3fbd-4e49-a3b2-309f6a0a062a",
  "StatusId": "62daf195-0a65-400f-af4b-7fda3d529acb",
  "TypeId": "cfe51645-8179-4fe5-ada3-c145a64d0a05",
  "ResolutionId": "47b4b0cc-22ee-4993-8ed5-ef1dec40a0d2",
  "Description": "description",
  "Comments": [
    {
      "Body": "This bug needs to be resolved before the next release."
    }
  ],
  "FieldControlValues": null,
  "FieldValues": {
    "Cycle": "V2.1 Cycle 1"
  }
}

Response Headers

KeyValueDescription
Locationhttp://localhost/api/incident/4bb709c2-e0e7-4af3-9f60-a045016a9610
Content-Typeapplication/json; charset=utf-8

Response Body

{
  "Id": "4bb709c2-e0e7-4af3-9f60-a045016a9610",
  "Summary": "My New Incident",
  "AssignedToId": "191375f2-ae6e-4b52-8bed-4192e34b6486",
  "AssignedTo": "joeb",
  "Description": "description",
  "PriorityId": "fe92720f-3fbd-4e49-a3b2-309f6a0a062a",
  "StatusId": "62daf195-0a65-400f-af4b-7fda3d529acb",
  "TypeId": "cfe51645-8179-4fe5-ada3-c145a64d0a05",
  "ResolutionId": "47b4b0cc-22ee-4993-8ed5-ef1dec40a0d2",
  "AffectedVersionIds": null,
  "FixedVersionIds": null,
  "ComponentIds": null,
  "CreatedAt": "2012-01-01T14:04:05Z",
  "LastUpdatedAt": "2012-02-02T15:05:06Z",
  "CreatedById": "191375f2-ae6e-4b52-8bed-4192e34b6486",
  "CreatedBy": "joeb",
  "LastUpdatedById": "191375f2-ae6e-4b52-8bed-4192e34b6486",
  "LastUpdatedBy": "joeb",
  "ProjectId": "27dcaff0-1f8a-4dff-b49a-bb3d9f7153b3",
  "ProjectName": "Test Project",
  "IncidentNumber": 0,
  "InternalId": null,
  "HasAttachments": true,
  "Expands": [
    "FieldControls",
    "Project"
  ],
  "FieldValues": {
    "Cycle": "V2.1 Cycle 1"
  },
  "Comments": [
    {
      "Id": "36f8985c-040e-44e6-9340-17a5ce68a086",
      "Body": "This bug needs to be resolved before the next release.",
      "CreatedById": "191375f2-ae6e-4b52-8bed-4192e34b6486",
      "CreatedByUserName": "joeb",
      "TicketCommentId": null,
      "LastUpdatedById": "191375f2-ae6e-4b52-8bed-4192e34b6486",
      "LastUpdatedByUserName": "joeb",
      "CreatedAt": "2012-02-02T15:05:06Z",
      "LastUpdatedAt": "2012-02-02T15:05:06Z",
      "Self": "http://localhost/api/incident/4bb709c2-e0e7-4af3-9f60-a045016a9610/comment/36f8985c-040e-44e6-9340-17a5ce68a086",
      "Links": [
        {
          "Href": "http://localhost/api/user/191375f2-ae6e-4b52-8bed-4192e34b6486",
          "Rel": "CreatedBy"
        },
        {
          "Href": "http://localhost/api/user/191375f2-ae6e-4b52-8bed-4192e34b6486",
          "Rel": "LastUpdatedBy"
        }
      ]
    }
  ],
  "Self": "http://localhost/api/incident/4bb709c2-e0e7-4af3-9f60-a045016a9610",
  "Links": [
    {
      "Href": "http://localhost/api/incident/4bb709c2-e0e7-4af3-9f60-a045016a9610/relationships",
      "Rel": "Relationships"
    },
    {
      "Href": "http://localhost/api/incident/4bb709c2-e0e7-4af3-9f60-a045016a9610/allrelationships",
      "Rel": "AllRelationships"
    },
    {
      "Href": "http://localhost/api/incident/4bb709c2-e0e7-4af3-9f60-a045016a9610/comments",
      "Rel": "Comments"
    },
    {
      "Href": "http://localhost/api/project/27dcaff0-1f8a-4dff-b49a-bb3d9f7153b3",
      "Rel": "Project"
    }
  ]
}

Status Code

201 - Created

  • No labels