I just wanted to offer a brief counter-point to this feature request. I too was initially searching for a way to add attachments to test results via the API. But after some consideration, I now think it is far better to put would-be attachments on a secure web or file server -- under the full control of the TestRail user's organisation -- and then put a link to the file in the test result. Let me explain.
Think about how test result attachments are, or would need to be, implemented. Either:
The attachments are stored in the back-end database as binary blobs or encoded text. This increases the size of the back-end database, and MySQL isn't the right kind system for storing large amounts of binary data.
The attachments are stored on the TestRail server file system, or SAN connected to the server. This will make migrating databases difficult, and add complexity to the server architecture and components.
It's fine to have the ability to add an attachment manually, because you're unlikely to get a large number of attachments that way. But if a process is using the API, it's probably an automated system with the ability to quickly generate large amounts of data. QA staff -- we're generally careful and contentious people -- will want to store as much test data as possible, and keep all of it forever.
I want the Gurock brothers focused on building new test-specific features in TestRail, not dealing with corrupted, overloaded databases, or managing terabytes of stale data that no-one will ever look at. The ability to add attachments via the API will increase costs for all users, take attention away from genuinely useful features, and has serious potential to decrease system stability, increase bandwidth, degrade performance, and introduce security issues.
Tobias and Dennis, please do not add the ability to upload attachments to test results. Superficially, it does seem like a good idea, but it has the potential to become a nightmare, or disaster, for everyone.
As suggested in a reply above, it is best to upload test artefacts to a separate server directly under the user's control, such as a corporate local file server, web server, SharePoint server, or even Dropbox account -- then include a link in the test result comments. The linked files can still be accessed directly by the people using TestRail. The TestRail user's organisation maintains full control over the artefacts.
Let's keep TestRail focused, lean, and great.