Resource: Agile Run Step Attachments ( /api/agilerun/{runId}/step/{stepId}/attachments )

Agile Run Step Attachments (collection) resource for fetching attachments associated with an agile run step, or adding new attachments to the agile run step.

This resource supports the following methods: GET, POST

Methods

GET


Retrieves list of attachments for the agile run step.

This method supports the OData parameters $filter, $top, $take, $orderby and $inlinecount. See OData Topic for more details.

Required Permissions

  • TestManagement/View

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 you have insufficient permissions to list attachments for this agile run step.
404 - NotFoundReturned if run or step does not exist.

Example - GET

Retrieves a list of all attachments associated with a step result.

Request Headers

KeyValueDescription
Acceptapplication/json

Request Parameters

KeyValueDescription
{runId}b716ac5e-61a3-4394-9b50-a13014129864The unique identifier (GUID) of the agile run.
{stepId}cbd88178-5e33-43b4-8172-01beaf5bdb75The unique identifier (GUID) of the agile run step.

Response Headers

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

Response Body

{
  "Items": [
    {
      "RunId": "b716ac5e-61a3-4394-9b50-a13014129864",
      "Id": "9b02c840-c330-4725-b743-b40181420bc2",
      "StepId": "cbd88178-5e33-43b4-8172-01beaf5bdb75",
      "Name": "screenshot 1",
      "FileName": "screenshot1.png",
      "ContentType": "image/png",
      "CreatedAt": "2012-01-01T14:04:05Z",
      "CreatedById": "2b364daa-0dff-4a6f-8554-f5963d3011be",
      "Size": 122454,
      "Self": "http://localhost/api/stepresult/b716ac5e-61a3-4394-9b50-a13014129864/step/cbd88178-5e33-43b4-8172-01beaf5bdb75/attachment/9b02c840-c330-4725-b743-b40181420bc2",
      "Content": "http://localhost/api/attachment/9b02c840-c330-4725-b743-b40181420bc2/contents"
    },
    {
      "RunId": "b716ac5e-61a3-4394-9b50-a13014129864",
      "Id": "5669f517-5ef4-40b6-856f-dbd488319da6",
      "StepId": "cbd88178-5e33-43b4-8172-01beaf5bdb75",
      "Name": "notes.txt",
      "FileName": "notes",
      "ContentType": "text/plain",
      "CreatedAt": "2012-01-01T14:04:05Z",
      "CreatedById": "2b364daa-0dff-4a6f-8554-f5963d3011be",
      "Size": 3,
      "Self": "http://localhost/api/stepresult/b716ac5e-61a3-4394-9b50-a13014129864/step/cbd88178-5e33-43b4-8172-01beaf5bdb75/attachment/5669f517-5ef4-40b6-856f-dbd488319da6",
      "Content": "http://localhost/api/attachment/5669f517-5ef4-40b6-856f-dbd488319da6/contents"
    }
  ]
}

Status Code

200 - OK

POST


Upload one or more attachments for this agile run step.

Required Permissions

  • TestManagement/ExecuteTests

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 attachments were uploaded successfully.
403 - ForbiddenReturned if the multipart request did not contain any files.
415 - UnsupportedMediaTypeReturned if the request is not mime multipart.

Example - POST

Uploads one or more files using a mime multipart request (this example shows a response where two files were uploaded).

Request Headers

KeyValueDescription
Content-Typemultipart/mixed; boundary=65bf6b94-c91c-442c-abe7-f41444d7c71f

Request Parameters

KeyValueDescription
{runId}b716ac5e-61a3-4394-9b50-a13014129864The unique identifier (GUID) of the agile run.
{stepId}cbd88178-5e33-43b4-8172-01beaf5bdb75The unique identifier (GUID) of the agile run step.

Request Body

--65bf6b94-c91c-442c-abe7-f41444d7c71f
Content-Disposition: attachment; filename=screenshot1.png; name="screenshot 1"; size=122454
Content-Type: image/png
Content-Length: 3
...
--65bf6b94-c91c-442c-abe7-f41444d7c71f
Content-Disposition: attachment; filename=notes.txt; name=notes; size=3
Content-Type: text/plain
Content-Length: 3
ABC
--65bf6b94-c91c-442c-abe7-f41444d7c71f--

Response Headers

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

Response Body

{
  "Items": [
    {
      "RunId": "b716ac5e-61a3-4394-9b50-a13014129864",
      "Id": "9b02c840-c330-4725-b743-b40181420bc2",
      "StepId": "cbd88178-5e33-43b4-8172-01beaf5bdb75",
      "Name": "screenshot 1",
      "FileName": "screenshot1.png",
      "ContentType": "image/png",
      "CreatedAt": "2012-01-01T14:04:05Z",
      "CreatedById": "2b364daa-0dff-4a6f-8554-f5963d3011be",
      "Size": 122454,
      "Self": "http://localhost/api/stepresult/b716ac5e-61a3-4394-9b50-a13014129864/step/cbd88178-5e33-43b4-8172-01beaf5bdb75/attachment/9b02c840-c330-4725-b743-b40181420bc2",
      "Content": "http://localhost/api/attachment/9b02c840-c330-4725-b743-b40181420bc2/contents"
    },
    {
      "RunId": "b716ac5e-61a3-4394-9b50-a13014129864",
      "Id": "5669f517-5ef4-40b6-856f-dbd488319da6",
      "StepId": "cbd88178-5e33-43b4-8172-01beaf5bdb75",
      "Name": "notes.txt",
      "FileName": "notes",
      "ContentType": "text/plain",
      "CreatedAt": "2012-01-01T14:04:05Z",
      "CreatedById": "2b364daa-0dff-4a6f-8554-f5963d3011be",
      "Size": 3,
      "Self": "http://localhost/api/stepresult/b716ac5e-61a3-4394-9b50-a13014129864/step/cbd88178-5e33-43b4-8172-01beaf5bdb75/attachment/5669f517-5ef4-40b6-856f-dbd488319da6",
      "Content": "http://localhost/api/attachment/5669f517-5ef4-40b6-856f-dbd488319da6/contents"
    }
  ]
}

Status Code

201 - Created

  • No labels