Resource: Script's Assignments ( /api/script/{scriptId}/assignments )

Script Assignments collection resource (for a single script)

This resource supports the following methods: GET, POST

Methods

GET


Retrieves all (or a subset) of script assignments that are visible. This method takes a TQL query.

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

Required Permissions

  • TestManagement/ManageExecutions/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.

Example - GET (filtered by TQL Query)

Retrieves script assignments matching a TQL query.

Request Headers

KeyValueDescription
Acceptapplication/json

Request Parameters

KeyValueDescription
tqlPackage = 'Cycle 1'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
{scriptId}c6173eab-f684-4d35-8ca7-62851b8df0e1Unique identifier of the script to retrieve assignments for

Response Headers

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

Response Body

{
  "Skip": 0,
  "Top": 5,
  "Total": 1,
  "Items": [
    {
      "Id": "3fa6ec13-3939-45b6-beb1-dd03e00a83f9",
      "ScriptId": "c6173eab-f684-4d35-8ca7-62851b8df0e1",
      "Name": "Report output paging",
      "Status": "Not Run",
      "AssignedTo": "joeb",
      "AssignedToId": "b2a74983-e374-41d4-bf49-bc3c9a5f0e89",
      "PackageId": "fd363396-3d6b-46f4-b876-40958c6738d3",
      "Expands": [
        "Package"
      ],
      "Self": "http://localhost/api/scriptassignment/3fa6ec13-3939-45b6-beb1-dd03e00a83f9",
      "Links": [
        {
          "Href": "http://localhost/api/scriptassignment/3fa6ec13-3939-45b6-beb1-dd03e00a83f9/allrelationships",
          "Rel": "AllRelationships"
        },
        {
          "Href": "http://localhost/api/executionpackage/fd363396-3d6b-46f4-b876-40958c6738d3",
          "Rel": "ExecutionPackage"
        },
        {
          "Href": "http://localhost/api/scriptassignment/3fa6ec13-3939-45b6-beb1-dd03e00a83f9/relationships",
          "Rel": "Relationships"
        },
        {
          "Href": "http://localhost/api/scriptassignment/3fa6ec13-3939-45b6-beb1-dd03e00a83f9/runs",
          "Rel": "Runs"
        },
        {
          "Href": "http://localhost/api/script/c6173eab-f684-4d35-8ca7-62851b8df0e1",
          "Rel": "Script"
        }
      ]
    }
  ],
  "Self": "http://localhost/api/api/script/C6173EAB-F684-4D35-8CA7-62851B8DF0E1/assignments?tql=Package = 'Cycle 1'"
}

Status Code

200 - OK

Example - GET (no TQL query)

Retrieves all packages, across all projects.

Request Headers

KeyValueDescription
Acceptapplication/json

Response Headers

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

Response Body

{
  "Skip": 0,
  "Top": 25,
  "Total": 2,
  "Items": [
    {
      "Id": "3fa6ec13-3939-45b6-beb1-dd03e00a83f9",
      "ScriptId": "c6173eab-f684-4d35-8ca7-62851b8df0e1",
      "Name": "Report output paging",
      "Status": "Not Run",
      "AssignedTo": "joeb",
      "AssignedToId": "b2a74983-e374-41d4-bf49-bc3c9a5f0e89",
      "PackageId": "fd363396-3d6b-46f4-b876-40958c6738d3",
      "Expands": [
        "Package"
      ],
      "Self": "http://localhost/api/scriptassignment/3fa6ec13-3939-45b6-beb1-dd03e00a83f9",
      "Links": [
        {
          "Href": "http://localhost/api/scriptassignment/3fa6ec13-3939-45b6-beb1-dd03e00a83f9/allrelationships",
          "Rel": "AllRelationships"
        },
        {
          "Href": "http://localhost/api/executionpackage/fd363396-3d6b-46f4-b876-40958c6738d3",
          "Rel": "ExecutionPackage"
        },
        {
          "Href": "http://localhost/api/scriptassignment/3fa6ec13-3939-45b6-beb1-dd03e00a83f9/relationships",
          "Rel": "Relationships"
        },
        {
          "Href": "http://localhost/api/scriptassignment/3fa6ec13-3939-45b6-beb1-dd03e00a83f9/runs",
          "Rel": "Runs"
        },
        {
          "Href": "http://localhost/api/script/c6173eab-f684-4d35-8ca7-62851b8df0e1",
          "Rel": "Script"
        }
      ]
    },
    {
      "Id": "8be49e2e-590c-485e-a713-ef3e8353e1d5",
      "ScriptId": "c6173eab-f684-4d35-8ca7-62851b8df0e1",
      "Name": "Report output paging",
      "Status": "Passed",
      "AssignedTo": "joeb",
      "AssignedToId": "b2a74983-e374-41d4-bf49-bc3c9a5f0e89",
      "PackageId": "26aff7af-1e07-4201-b54d-f94baee82fc7",
      "Expands": [
        "Package"
      ],
      "Self": "http://localhost/api/scriptassignment/8be49e2e-590c-485e-a713-ef3e8353e1d5",
      "Links": [
        {
          "Href": "http://localhost/api/scriptassignment/8be49e2e-590c-485e-a713-ef3e8353e1d5/allrelationships",
          "Rel": "AllRelationships"
        },
        {
          "Href": "http://localhost/api/executionpackage/26aff7af-1e07-4201-b54d-f94baee82fc7",
          "Rel": "ExecutionPackage"
        },
        {
          "Href": "http://localhost/api/scriptassignment/8be49e2e-590c-485e-a713-ef3e8353e1d5/relationships",
          "Rel": "Relationships"
        },
        {
          "Href": "http://localhost/api/scriptassignment/8be49e2e-590c-485e-a713-ef3e8353e1d5/runs",
          "Rel": "Runs"
        },
        {
          "Href": "http://localhost/api/script/c6173eab-f684-4d35-8ca7-62851b8df0e1",
          "Rel": "Script"
        }
      ]
    }
  ],
  "Self": "http://localhost/api/api/scriptassignments"
}

Status Code

200 - OK

POST


Creates a new test script assignment.

Required Permissions

  • TestManagement/ManageExecutions/ExecuteAllTests
  • TestManagement/ManageExecutions/ExecuteOnlyMyTests

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 script assignment was created successfully.
403 - ForbiddenReturned if the request could not be completed successfuly (normally due to lack of permissions or validation failure).

Example - POST (no assignee)

Create a new test script assignment, with no assignee.

Request Headers

KeyValueDescription
Acceptapplication/json

Request Body

{
  "PackageId": "f6ed1282-bd89-4f8f-8e94-47e344bba905",
  "ScriptId": "5ef6c545-6ef8-472e-bae7-b1cc3d3fbab0"
}

Response Headers

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

Response Body

{
  "Id": "4bb709c2-e0e7-4af3-9f60-a045016a9610",
  "ScriptId": "5ef6c545-6ef8-472e-bae7-b1cc3d3fbab0",
  "Name": "My Script",
  "Status": "Not Run",
  "AssignedTo": null,
  "AssignedToId": null,
  "PackageId": "f6ed1282-bd89-4f8f-8e94-47e344bba905",
  "Expands": [
    "Package"
  ],
  "Self": "http://localhost/api/scriptassignment/4bb709c2-e0e7-4af3-9f60-a045016a9610",
  "Links": [
    {
      "Href": "http://localhost/api/scriptassignment/4bb709c2-e0e7-4af3-9f60-a045016a9610/allrelationships",
      "Rel": "AllRelationships"
    },
    {
      "Href": "http://localhost/api/executionpackage/f6ed1282-bd89-4f8f-8e94-47e344bba905",
      "Rel": "ExecutionPackage"
    },
    {
      "Href": "http://localhost/api/scriptassignment/4bb709c2-e0e7-4af3-9f60-a045016a9610/relationships",
      "Rel": "Relationships"
    },
    {
      "Href": "http://localhost/api/scriptassignment/4bb709c2-e0e7-4af3-9f60-a045016a9610/runs",
      "Rel": "Runs"
    },
    {
      "Href": "http://localhost/api/script/5ef6c545-6ef8-472e-bae7-b1cc3d3fbab0",
      "Rel": "Script"
    }
  ]
}

Status Code

201 - Created

Example - POST (with assignee)

Create a new test script assignment, with the assignee set.

Request Headers

KeyValueDescription
Acceptapplication/json

Request Body

{
  "PackageId": "f6ed1282-bd89-4f8f-8e94-47e344bba905",
  "AssignedToId": "5bb78013-222a-45a8-b639-ac0ce0a8a505",
  "ScriptId": "5ef6c545-6ef8-472e-bae7-b1cc3d3fbab0"
}

Response Headers

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

Response Body

{
  "Id": "4bb709c2-e0e7-4af3-9f60-a045016a9610",
  "ScriptId": "5ef6c545-6ef8-472e-bae7-b1cc3d3fbab0",
  "Name": "My Script",
  "Status": "Not Run",
  "AssignedTo": "joeb",
  "AssignedToId": "5bb78013-222a-45a8-b639-ac0ce0a8a505",
  "PackageId": "f6ed1282-bd89-4f8f-8e94-47e344bba905",
  "Expands": [
    "Package"
  ],
  "Self": "http://localhost/api/scriptassignment/4bb709c2-e0e7-4af3-9f60-a045016a9610",
  "Links": [
    {
      "Href": "http://localhost/api/scriptassignment/4bb709c2-e0e7-4af3-9f60-a045016a9610/allrelationships",
      "Rel": "AllRelationships"
    },
    {
      "Href": "http://localhost/api/executionpackage/f6ed1282-bd89-4f8f-8e94-47e344bba905",
      "Rel": "ExecutionPackage"
    },
    {
      "Href": "http://localhost/api/scriptassignment/4bb709c2-e0e7-4af3-9f60-a045016a9610/relationships",
      "Rel": "Relationships"
    },
    {
      "Href": "http://localhost/api/scriptassignment/4bb709c2-e0e7-4af3-9f60-a045016a9610/runs",
      "Rel": "Runs"
    },
    {
      "Href": "http://localhost/api/script/5ef6c545-6ef8-472e-bae7-b1cc3d3fbab0",
      "Rel": "Script"
    }
  ]
}

Status Code

201 - Created

  • No labels