There are two endpoints regarding attachments in Xray.


Get attachment

/api/v1/attachments/{attachmentId}

Add attachment

/api/v1/attachments


Get attachment

To get attachments, you can use the following endpoint:


 GET /api/v1/attachments/{attachmentId}

Get an attachment

Request

PARAMETERS

parameter

type

description

attachmentIdString

- id of the attachment to get.


Example:

Example Request

curl -H "Content-Type: application/json" -X GET -H "Authorization: Bearer $token" https://xray.cloud.xpand-it.com/api/v1/attachments/7e0073ec-cc9a-44fa-a2da-9d8c163caeae

Responses

200 OK : octet/stream : Successful. The attachment is retrieved.

400 BAD_REQUEST : application/json : The attachment could not be retrieved.
Example Output

{
    "error": "No such file"
}



401 UNAUTHORIZED: application/json:
The API token is invalid.


Add attachment

 To add attachments, you can use the following endpoint:


 POST /api/v1/attachments

Add attachment

Request

Example

Example Request

curl -H "Content-Type: multipart/form-data" -X POST -F attachment=@report.pdf -H "Authorization: Bearer $token" https://xray.cloud.xpand-it.com/api/v1/attachments

Responses

200 OK : application/json : Successful. The attachment was added.

Example Output
{
  "id": "7e0073ec-cc9a-44fa-a2da-9d8c163caeae",
  "filename": "report.pdf",
  "created": "2020-06-28T16:59:33.051Z",
  "size": 123446
}


400 BAD_REQUEST : application/json : The attachment information was not provided.

Example Output
{
  "error": "No file found."
}


401 UNAUTHORIZED : application/json : The Xray license is not valid.

  • No labels