API: Attachments
Use the following API methods to upload, retrieve and delete attachments.
The following headers must be used when uploading attachments via the TestRail API using POST requests:
| Content-Type | multipart/form-data |
The attachment should be submitted as form-data in the body of the request. Please review our Accessing the API documentation or TestRail’s bindings for examples of submitting an attachment.
THI SIS A NOTE FOR JUNO: After TestRail 7.1 release (cloud), the attachment management system has slightly changed. A new format for attachment ID has been introduced.
Info
This is an info block in Lotus
Please check here: Introduction to the TestRail API
add_attachment_to_case
This endpoint requires TestRail 6.5.2 or later.
Adds an attachment to a test plan. The maximum allowable upload size is set to 256MB.
POST index.php?/api/v2/add_attachment_to_case/{case_id}
Parameters
| Name | Type | Required | Description |
case_id |
integer | true | The ID of the test case the attachment should be added to |
Response content
Please see below for a typical response:
{
"attachment_id": 443
}
The following system fields are always included in the response:
| Name | Type | Description |
attachment_id |
integer | The ID of the attachment uploaded to TestRail |
Response codes
| Status Code | Description |
200 |
Success (the attachment ID is returned in the response) |
400 |
Invalid or unknown test case |
403 |
No access to the project |
429 |
TestRail Cloud only—Too many requests (see API rate limit) |
add_attachment_to_plan
This endpoint requires TestRail 6.3 or later.
Adds an attachment to a test plan. The maximum allowable upload size is set to 256MB.
POST index.php?/api/v2/add_attachment_to_plan/{plan_id}
Parameters
| Name | Type | Required | Description |
plan_id |
integer | true | The ID of the test plan the attachment should be added to |
Response content
Please see below for a typical response:
{
"attachment_id": 443
}
The following system fields are always included in the response:
| Name | Type | Description |
attachment_id |
integer | The ID of the attachment uploaded to TestRail |
Response codes
| Status Code | Description |
200 |
Success (the attachment ID is returned in the response) |
400 |
Invalid or unknown test plan |
403 |
No access to the project |
429 |
TestRail Cloud only—Too many requests (see API rate limit) |
add_attachment_to_plan_entry
This endpoint requires TestRail 6.3 or later.
Adds an attachment to a test plan entry. The maximum allowable upload size is set to 256MB.
POST index.php?/api/v2/add_attachment_to_plan_entry/{plan_id}/{entry_id}
Parameters
| Name | Type | Required | Description |
plan_id |
integer | true | The ID of the test plan containing the entry |
entry_id |
integer | true | The ID of the test plan entry the attachment should be added to |
Response content
Please see below for a typical response:
{
"attachment_id": 443
}
The following system fields are always included in the response:
| Name | Type | Description |
attachment_id |
integer | The ID of the attachment uploaded to TestRail |
Response codes
| Status Code | Description |
200 |
Success (the attachment ID is returned in the response) |
400 |
POST request not formatted properly or invalid ID parameter(s) |
403 |
No access to the project or insufficient permissions |
429 |
TestRail Cloud only—Too many requests (see API rate limit) |
Comments
0 comments
Please sign in to leave a comment.