Resource: Scripts ( /api/scripts )

Test Scripts collection resource

Root Relation: Scripts

This resource supports the following methods: GET, POST

Methods

GET


Retrieves all (or a subset) of scripts that are visible to the user.

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

Required Permissions

  • TestManagement/View

Supported Expansions

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 you don't have the necessary permissions to complete the request).

Example - GET (filtered by TQL Query)

Retrieves scripts matching a TQL query.

Request Headers

KeyValueDescription
Acceptapplication/json

Request Parameters

KeyValueDescription
tqlName ~ 'Report'The TQL query to execute.
$top5The maximum number of results to return (defaults to 25).
$skip0The number 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",
      "Name": "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",
      "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",
      "Objective": null,
      "PreCondition": null,
      "PostCondition": null,
      "Number": 1,
      "EstimatedDuration": null,
      "PackageId": "0f2c3a76-bbd1-4370-8faa-6aacb52f1a01",
      "OrderNumber": 0,
      "ProjectId": "27dcaff0-1f8a-4dff-b49a-bb3d9f7153b3",
      "ProjectName": "Test Project",
      "PackageName": "Cycle 1",
      "ChangeComment": null,
      "Notes": null,
      "VersionNumber": 0,
      "HasAttachments": false,
      "Expands": [
        "FieldControls",
        "FieldValues",
        "Package",
        "Assignments"
      ],
      "Self": "http://localhost/api/script/4bb709c2-e0e7-4af3-9f60-a045016a9610",
      "Links": [
        {
          "Href": "http://localhost/api/script/4bb709c2-e0e7-4af3-9f60-a045016a9610/relationships",
          "Rel": "Relationships"
        },
        {
          "Href": "http://localhost/api/script/4bb709c2-e0e7-4af3-9f60-a045016a9610/allrelationships",
          "Rel": "AllRelationships"
        },
        {
          "Href": "http://localhost/api/script/4bb709c2-e0e7-4af3-9f60-a045016a9610/assignments",
          "Rel": "Assignments"
        }
      ]
    }
  ],
  "Self": "http://localhost/api/api/scripts?tql=Name~'Report'"
}

Status Code

200 - OK

Example - GET (no filter)

Retrieves all scripts

Request Headers

KeyValueDescription
Acceptapplication/json

Request Parameters

KeyValueDescription
$top5The maximum number of results to return (defaults to 25).
$skip0The number 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",
      "Name": "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",
      "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",
      "Objective": null,
      "PreCondition": null,
      "PostCondition": null,
      "Number": 1,
      "EstimatedDuration": null,
      "PackageId": "0f2c3a76-bbd1-4370-8faa-6aacb52f1a01",
      "OrderNumber": 0,
      "ProjectId": "27dcaff0-1f8a-4dff-b49a-bb3d9f7153b3",
      "ProjectName": "Test Project",
      "PackageName": "Cycle 1",
      "ChangeComment": null,
      "Notes": null,
      "VersionNumber": 0,
      "HasAttachments": false,
      "Expands": [
        "FieldControls",
        "FieldValues",
        "Package",
        "Assignments"
      ],
      "Self": "http://localhost/api/script/4bb709c2-e0e7-4af3-9f60-a045016a9610",
      "Links": [
        {
          "Href": "http://localhost/api/script/4bb709c2-e0e7-4af3-9f60-a045016a9610/relationships",
          "Rel": "Relationships"
        },
        {
          "Href": "http://localhost/api/script/4bb709c2-e0e7-4af3-9f60-a045016a9610/allrelationships",
          "Rel": "AllRelationships"
        },
        {
          "Href": "http://localhost/api/script/4bb709c2-e0e7-4af3-9f60-a045016a9610/assignments",
          "Rel": "Assignments"
        }
      ]
    },
    {
      "Id": "4bb709c2-e0e7-4af3-9f60-a045016a9610",
      "Name": "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",
      "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",
      "Objective": null,
      "PreCondition": null,
      "PostCondition": null,
      "Number": 1,
      "EstimatedDuration": null,
      "PackageId": "0f2c3a76-bbd1-4370-8faa-6aacb52f1a01",
      "OrderNumber": 0,
      "ProjectId": "27dcaff0-1f8a-4dff-b49a-bb3d9f7153b3",
      "ProjectName": "Test Project",
      "PackageName": "Cycle 1",
      "ChangeComment": null,
      "Notes": null,
      "VersionNumber": 0,
      "HasAttachments": false,
      "Expands": [
        "FieldControls",
        "FieldValues",
        "Package",
        "Assignments"
      ],
      "Self": "http://localhost/api/script/4bb709c2-e0e7-4af3-9f60-a045016a9610",
      "Links": [
        {
          "Href": "http://localhost/api/script/4bb709c2-e0e7-4af3-9f60-a045016a9610/relationships",
          "Rel": "Relationships"
        },
        {
          "Href": "http://localhost/api/script/4bb709c2-e0e7-4af3-9f60-a045016a9610/allrelationships",
          "Rel": "AllRelationships"
        },
        {
          "Href": "http://localhost/api/script/4bb709c2-e0e7-4af3-9f60-a045016a9610/assignments",
          "Rel": "Assignments"
        }
      ]
    }
  ],
  "Self": "http://localhost/api/api/scripts"
}

Status Code

200 - OK

POST


Creates a new test script.

Required Permissions

  • TestManagement/ManageScripts

Supported Expansions

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
201 - CreatedReturned if the request was completed successfully.
403 - ForbiddenReturned if the request could not be satisified (normally due to insufficient permissions, or a missing required field).

Example - Create script run (minimum required fields)

An example of creating a new script run with the minimum required information.

Request Headers

KeyValueDescription
Acceptapplication/json
Content-typeapplication/json

Request Body

{
  "PackageId": "0f2c3a76-bbd1-4370-8faa-6aacb52f1a01",
  "Name": "My New Script",
  "PriorityId": "fe92720f-3fbd-4e49-a3b2-309f6a0a062a",
  "StatusId": "62daf195-0a65-400f-af4b-7fda3d529acb",
  "TypeId": "cfe51645-8179-4fe5-ada3-c145a64d0a05",
  "Steps": [
    {
      "Description": "Do this",
      "ExpectedResult": "Expect that",
      "Notes": null,
      "Data": null,
      "OrderNumber": 0
    }
  ],
  "FieldControlValues": null,
  "FieldValues": null
}

Response Headers

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

Response Body

{
  "Id": "4bb709c2-e0e7-4af3-9f60-a045016a9610",
  "Name": "My New Script",
  "AssignedToId": null,
  "AssignedTo": null,
  "Description": null,
  "PriorityId": "fe92720f-3fbd-4e49-a3b2-309f6a0a062a",
  "StatusId": "62daf195-0a65-400f-af4b-7fda3d529acb",
  "TypeId": "cfe51645-8179-4fe5-ada3-c145a64d0a05",
  "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",
  "Objective": null,
  "PreCondition": null,
  "PostCondition": null,
  "Number": 1,
  "EstimatedDuration": null,
  "PackageId": "0f2c3a76-bbd1-4370-8faa-6aacb52f1a01",
  "OrderNumber": 0,
  "ProjectId": "27dcaff0-1f8a-4dff-b49a-bb3d9f7153b3",
  "ProjectName": "Test Project",
  "PackageName": "Cycle 1",
  "ChangeComment": null,
  "Notes": null,
  "VersionNumber": 0,
  "HasAttachments": false,
  "Expands": [
    "FieldControls",
    "FieldValues",
    "Package",
    "Assignments"
  ],
  "Self": "http://localhost/api/script/4bb709c2-e0e7-4af3-9f60-a045016a9610",
  "Links": [
    {
      "Href": "http://localhost/api/script/4bb709c2-e0e7-4af3-9f60-a045016a9610/relationships",
      "Rel": "Relationships"
    },
    {
      "Href": "http://localhost/api/script/4bb709c2-e0e7-4af3-9f60-a045016a9610/allrelationships",
      "Rel": "AllRelationships"
    },
    {
      "Href": "http://localhost/api/script/4bb709c2-e0e7-4af3-9f60-a045016a9610/assignments",
      "Rel": "Assignments"
    }
  ]
}

Status Code

201 - Created

Example - Create script run (with most fields populated)

An example of creating a new script with most fields populated (including custom fields).

Request Headers

KeyValueDescription
Acceptapplication/json
Content-typeapplication/json

Request Parameters

KeyValueDescription
$expandFieldValuesExpand field (we expand the FieldValues to ensure we get it back in the response to creating a new script

Request Body

{
  "TemporaryId": "6cc26034-6514-44e0-907c-8f4f5eaa85b5",
  "PackageId": "0f2c3a76-bbd1-4370-8faa-6aacb52f1a01",
  "Number": 22,
  "Name": "My New Script",
  "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",
  "Description": "description",
  "Objective": "objective",
  "PostCondition": "post condition",
  "PreCondition": "pre condition",
  "Notes": "notes",
  "Steps": [
    {
      "Description": "Do this",
      "ExpectedResult": "Expect that",
      "Notes": "some notes",
      "Data": "Some data",
      "OrderNumber": 0
    },
    {
      "Description": "Then Do this",
      "ExpectedResult": "and expect that",
      "Notes": "some more notes",
      "Data": "Some more data",
      "OrderNumber": 1
    }
  ],
  "ChangeComment": "Script created via my API",
  "OrderNumber": 2,
  "FieldControlValues": null,
  "FieldValues": {
    "Cycle": "V2.1 Cycle 1"
  }
}

Response Headers

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

Response Body

{
  "Id": "4bb709c2-e0e7-4af3-9f60-a045016a9610",
  "Name": "My New Script",
  "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",
  "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",
  "Objective": "objective",
  "PreCondition": "pre condition",
  "PostCondition": "post condition",
  "Number": 1,
  "EstimatedDuration": "5 minutes",
  "PackageId": "0f2c3a76-bbd1-4370-8faa-6aacb52f1a01",
  "OrderNumber": 22,
  "ProjectId": "27dcaff0-1f8a-4dff-b49a-bb3d9f7153b3",
  "ProjectName": "Test Project",
  "PackageName": "Cycle 1",
  "ChangeComment": "Script created via my API",
  "Notes": "notes",
  "VersionNumber": 1,
  "HasAttachments": true,
  "Expands": [
    "FieldControls",
    "FieldValues",
    "Package",
    "Assignments"
  ],
  "Self": "http://localhost/api/script/4bb709c2-e0e7-4af3-9f60-a045016a9610",
  "Links": [
    {
      "Href": "http://localhost/api/script/4bb709c2-e0e7-4af3-9f60-a045016a9610/relationships",
      "Rel": "Relationships"
    },
    {
      "Href": "http://localhost/api/script/4bb709c2-e0e7-4af3-9f60-a045016a9610/allrelationships",
      "Rel": "AllRelationships"
    },
    {
      "Href": "http://localhost/api/script/4bb709c2-e0e7-4af3-9f60-a045016a9610/assignments",
      "Rel": "Assignments"
    }
  ]
}

Status Code

201 - Created

  • No labels