I encountered an error while migrating to the new version API (/api/v1/testcase/upload-attachment/:id ). I’m not sure if I missed any parameters or if there’s any prerequisite work that needs to be done before calling this API.
Please make sure that your api key has at least “Editor” permissions, without it, you cannot add attachments to test cases (the error message is a little misleading)
To upload attachments to a test result in a specific run, use
/api/v1/testrun/upload-attachment/:trId/:tcId
instead
If you are importing automated test results, you might want to use our new “Automation” feature instead:
This provides tooling and comprehensive API to import automated test reports (e.g. like JUnit)
Thanks for your reply. The API endpoint /api/v1/testrun/upload-attachment/:trId/:tcId
is working now, but we’re unable to view the uploaded attachments in Testiny.
Yeah, but I can’t find any images in “comments” tab. It’s only show a link of an image, but we can’t open it after download it.
Please make sure that you are uploading the attachment data (in your case the image) “as is” in the request body, not wrapped in json (or base64 encoded).
The meta data values like mime_type(if not present the request content type will be used), filename, title should be in the query params:
Even after a successful request, we still can’t open/view the image. Could you help me troubleshoot what might be causing this issue? You can see my cURL from attachment:
As said above, you need to use binary data, not base64. So the data options should look like this, with “filename” being the name of the file you want to upload:
curl ... --data @filename
Make sure to use the @
sign to signal a file name.
Best regards,
Alex
It works now, thanks so much!