It's all about the answers!

Ask a question

How can I Obtain an Attachment ID Programmatically through the OSLC/REST API?


Brandie Collins (612) | asked May 28 '14, 1:06 p.m.

Our team is trying to determine the best way to obtain the attachment ID of an item that is posted via the API.  We have no problem posting the attachment itself, but as far as we can tell there is no response info that contains the attachment ID of the item after we post it.

These are the steps that are currently being used by our team to obtain an attachment ID immediately after it is posted:

1.       Use a GET request to get back a feed of all attachments
2.       Find the URL for the last page of attachments
3.       Use a GET request to obtain the last page of attachment
4.       Search those results to get the attachment ID based on the name of the attachment

 
We are hoping for a much easier way to obtain an attachment ID.  Ideally this would be indicated in the response, but it is not a requirement.  We are just hoping for fewer steps to be able to obtain this ID -- perhaps based on name and/or other information that we would have on hand after posting an attachment.

Thanks! 

One answer



permanent link
Donald Nong (14.5k614) | answered May 29 '14, 12:55 a.m.
Check out this post. It appears that after you call the com.ibm.team.workitem.service.internal.rest.IAttachmentRestService service, you should get an UUID for the newly upload attachment. And from there, you can get the identifier of the attachment. Not sure whether you are using the same two steps to upload attachment though.
https://jazz.net/forum/questions/150849/how-to-upload-an-attachment-to-a-work-item-via-rest-api

Comments
Brandie Collins commented May 30 '14, 5:36 p.m.

I am not using a two part approach to upload attachments, however I will look at this question and see if there's any information I can take away from it that will help me.  Thank you for taking the time to answer me -- if it helps me get to my answer then I will come back and mark it as accepted.

Your answer


Register or to post your answer.


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.