Resource: Script Packages ( /api/scriptpackages )
Script Packages collection resource
Root Relation: ScriptPackages
This resource supports the following methods: GET, POST
Methods
GET
Retrieves all (or a subset) of script packages that are visible to the user. 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/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).
| Status | Description |
|---|---|
| 200 - OK | Returned if the request was completed successfully. |
Retrieves packages matching a TQL query.
Request Headers
| Key | Value | Description |
|---|---|---|
| Accept | application/json |
Request Parameters
| Key | Value | Description |
|---|---|---|
| tql | Name ~ 'Report' | The TQL query to execute. |
| $top | 5 | The maximum number of results to return (defaults to 25). |
| $skip | 0 | The number of results to skip before return the $top number of results matching the query. |
Response Headers
| Key | Value | Description |
|---|---|---|
| Content-Type | application/json; charset=utf-8 |
Response Body
{
"Skip": 0,
"Top": 5,
"Total": 1,
"Items": [
{
"Id": "d009c056-6025-4a5e-a3b9-fc0fa8cf1f2e",
"ProjectId": "944aa658-8067-42cf-a6a6-ce71535a73bc",
"Name": "Reports",
"OrderNumber": 0,
"Expands": [
"Children",
"Parent",
"Project"
],
"Self": "http://localhost/api/scriptpackage/d009c056-6025-4a5e-a3b9-fc0fa8cf1f2e",
"Links": [
{
"Href": "http://localhost/api/scriptpackage/d009c056-6025-4a5e-a3b9-fc0fa8cf1f2e/children",
"Rel": "Children"
},
{
"Href": "http://localhost/api/project/944aa658-8067-42cf-a6a6-ce71535a73bc",
"Rel": "Project"
}
]
}
],
"Self": "http://localhost/api/api/scriptpackages?tql=Name~'Report'"
}
Status Code
200 - OK
Retrieves all packages, across all projects.
Request Headers
| Key | Value | Description |
|---|---|---|
| Accept | application/json |
Response Headers
| Key | Value | Description |
|---|---|---|
| Content-Type | application/json; charset=utf-8 |
Response Body
{
"Skip": 0,
"Top": 25,
"Total": 2,
"Items": [
{
"Id": "d009c056-6025-4a5e-a3b9-fc0fa8cf1f2e",
"ProjectId": "944aa658-8067-42cf-a6a6-ce71535a73bc",
"Name": "Reports",
"OrderNumber": 0,
"Expands": [
"Children",
"Parent",
"Project"
],
"Self": "http://localhost/api/scriptpackage/d009c056-6025-4a5e-a3b9-fc0fa8cf1f2e",
"Links": [
{
"Href": "http://localhost/api/scriptpackage/d009c056-6025-4a5e-a3b9-fc0fa8cf1f2e/children",
"Rel": "Children"
},
{
"Href": "http://localhost/api/project/944aa658-8067-42cf-a6a6-ce71535a73bc",
"Rel": "Project"
}
]
},
{
"Id": "7c8ffe51-c584-41d6-8739-8dbd56d5770f",
"ProjectId": "944aa658-8067-42cf-a6a6-ce71535a73bc",
"Name": "Data Import",
"OrderNumber": 0,
"Expands": [
"Children",
"Parent",
"Project"
],
"Self": "http://localhost/api/scriptpackage/7c8ffe51-c584-41d6-8739-8dbd56d5770f",
"Links": [
{
"Href": "http://localhost/api/scriptpackage/7c8ffe51-c584-41d6-8739-8dbd56d5770f/children",
"Rel": "Children"
},
{
"Href": "http://localhost/api/project/944aa658-8067-42cf-a6a6-ce71535a73bc",
"Rel": "Project"
}
]
}
],
"Self": "http://localhost/api/api/scriptpackages"
}
Status Code
200 - OK
POST
Create a new script package.
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).
| Status | Description |
|---|---|
| 201 - Created | Returned if the request was completed successfully. |
| 403 - Forbidden | Returned if the user does not have permission to create script packages in the target project. |
Create a new package (at root of project).
Request Headers
| Key | Value | Description |
|---|---|---|
| Accept | application/json |
Request Body
{
"Name": "New Package",
"ProjectId": "4545fe95-e9c2-40e9-8f4a-3f000d14526f"
}
Response Headers
| Key | Value | Description |
|---|---|---|
| Location | http://localhost/api/scriptpackage/4bb709c2-e0e7-4af3-9f60-a045016a9610 | |
| Content-Type | application/json; charset=utf-8 |
Response Body
{
"Id": "4bb709c2-e0e7-4af3-9f60-a045016a9610",
"ProjectId": "944aa658-8067-42cf-a6a6-ce71535a73bc",
"Name": "New Package",
"OrderNumber": 0,
"Expands": [
"Children",
"Parent",
"Project"
],
"Self": "http://localhost/api/scriptpackage/4bb709c2-e0e7-4af3-9f60-a045016a9610",
"Links": [
{
"Href": "http://localhost/api/scriptpackage/4bb709c2-e0e7-4af3-9f60-a045016a9610/children",
"Rel": "Children"
},
{
"Href": "http://localhost/api/project/944aa658-8067-42cf-a6a6-ce71535a73bc",
"Rel": "Project"
}
]
}
Status Code
201 - Created
Create a new package (as child of existing package).
Request Headers
| Key | Value | Description |
|---|---|---|
| Accept | application/json |
Request Body
{
"Name": "New Child Package",
"ParentId": "9bfeb244-06a6-4440-b6b6-a8bcc0847673"
}
Response Headers
| Key | Value | Description |
|---|---|---|
| Location | http://localhost/api/scriptpackage/4bb709c2-e0e7-4af3-9f60-a045016a9610 | |
| Content-Type | application/json; charset=utf-8 |
Response Body
{
"Id": "4bb709c2-e0e7-4af3-9f60-a045016a9610",
"ParentId": "9bfeb244-06a6-4440-b6b6-a8bcc0847673",
"Name": "New Child Package",
"OrderNumber": 0,
"Expands": [
"Children",
"Parent",
"Project"
],
"Self": "http://localhost/api/scriptpackage/4bb709c2-e0e7-4af3-9f60-a045016a9610",
"Links": [
{
"Href": "http://localhost/api/scriptpackage/4bb709c2-e0e7-4af3-9f60-a045016a9610/children",
"Rel": "Children"
},
{
"Href": "http://localhost/api/scriptpackage/9bfeb244-06a6-4440-b6b6-a8bcc0847673",
"Rel": "Parent"
}
]
}
Status Code
201 - Created