To attach a file to a defect in your project, you call the …/project/{ProjectId}/Bugs/{EntityId}/files (POST)
method. The EntityId parameter specifies the ID of the item to which you want to attach the file.
You attach files to items of other types (tests or requirements) in a similar way. Use the corresponding entity code (Tests or Requirements respectively) instead of the Bugs entity code.
Request
curl -v -i -u [email protected]:p@ssword POST -F file=@attachment.txt -F title="New Attachment" -F comments="New Comment" -H "Content-Type: application/json" -H "Accept: application/json" http://yourserver.com/rest-api/service/api/v1/projects/11873/Bugs/12/notes
This will attach the attachment.txt file to the specified defect.
Response
The server will return information on the attached file:
{
"attachment_type_code": "File",
"file_name": "attachment.txt",
"title": "New Attachment",
"comments": "New Comment",
"data_created": "2015-08-27T11:48:26.9370000",
"data_updated": "2015-08-27T11:48:26.9370000",
"entity_code": "Bugs",
"entity_id": 12,
"update_user_id": "24663",
"user_name": "Smith, John"
}
See Also
QAComplete REST API
/projects/{ProjectId}/{EntityCode}/{EntityId}/files (POST)