automationpostmantestrail

How to add an attachment to Testrail using the Testrail API


I have tried the following API endpoint to add an attachment to Testrail via their API. But it is not very clear how to name the said file attachment (I am using Postman)

API endpoint:

[POST]
https:///{{testrail link}}/index.php?/api/v2/add_attachment_to_result/449

Headers:

{
    "Content-Type","value":"multipart/form-data"
}

What must the body params be?

I have currently selected the file and multipart/form-data for Content-type. Please help!

The error right now on Postman:

{
    "error": "No file attached or upload size was exceeded."
}

The upload size is just fine (under 256 MB).


Solution

  • using postman you need to pass the file through the body by adding a file type key named 'attachment' and value:{select your file}

    eg: key: attachment | value:myfile.txt