See this post for some sample codes. Note that the internal API, not the published OSLC/REST API, was used.
https://jazz.net/forum/questions/150849/how-to-upload-an-attachment-to-a-work-item-via-rest-api
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means.
Learn more here.