How to retrieve an attachmentID via rest API

Sravya Bandari
Sravya Bandari
  • Updated

Author: Sravya Bandari

Date: 20 May 2025

Audience: Everyone

Environmental details: KOTS Self-Hosted and Cloud

Summary

When you have an attachment URL like https://xxx/attachment/270/Jama_test.png, where 270 is not the actual attachment ID. While this URL works in a browser, using it in the Jama REST API results in “attachment not found.”

Note: The number in the URL section (e.g., 270) represents the attachment value, not the actual item ID of the attachment

 

Solution

To fetch an attachment ID using the API when you only have the URL:

  • Using the GET /itemtypes endpoint, you can retrieve the itemtype ID for attachments. 
    Example: In my instance - the Itemtype ID for attachments is 22.
"data": [
{
"id": 22,
"typeKey": "ATT",
"display": "Attachment",
"displayPlural": "Attachments",
"description": "Attachment Type",
"image": "https://xxx/img/tree/attach.png",
"category": "ATTACHMENT",
"widgets": [
{
"name": "HISTORY",
"synchronize": false

 

  • The GET /abstractitems API allows you to get all attachments in a project. Then, you can make a GET request to the abstract items API with the project ID and the itemtype ID as parameters. This will return all attachments for that specific project, including the AttachmentID you’re looking for.

  • You can then use the GET /attachments/{attachementID}/file to download attachment file from the attachment with the specified ID.

References

 

Please feel free to leave feedback in the comments below.

 

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.