Upload file (attachment)
Upload a file as a work item attachment via the generic request endpoint. The request body is the file (binary); the response includes an attachment ID and URL. Use that URL when adding the attachment as a link to a work item (e.g. with the "Add link to existing work item" example). Replace the Body path with your file path and set your organization and project in the URL.
SELECT *
FROM generic_request
WITH(
Url='YOUR_ORGANIZATION/YOUR_PROJECT/_apis/wit/attachments?api-version=7.0',
RequestMethod='POST',
RequestContentTypeCode='ApplicationOctetStream', --//Binary upload
--Headers='Content-Type: application/octet-stream', --//same as above
Body='@c:\temp\screenshot-1.png',
IsMultiPart=1,
Meta='id:string(100);url:string(500)' --response columns you like to display
)