Skip to main content
1-Visitor
September 18, 2025
Question

Creating a tracker item with attachments (Image PNG , jpg) in description using rest API in V2/V3

  • September 18, 2025
  • 1 reply
  • 342 views

Hello Team,

I am working with Code beamer version 22.2.1.0 and trying to upload an image (PNG/JPG) as an attachment to a tracker item using the REST API.

I can list attachments successfully using:
GET /cb/rest/v3/items/{item Id}/attachments 

 

But when I try to upload using:

POST /cb/rest/v3/items/{ item_Id}/attachments
with multipart/form-data, I either receive 400/415 errors  or the request succeeds but no file appears under the "Attachments" tab in the UI.

 

Example I tried in Python:
```python
with open("test.png", "rb") as f:
   files = { "attachments": ("test.png", f, "image/png") }
   resp = session.post(f"{base_url}/v3/items/{item_id}/attachments", files=files)

1 reply

19-Tanzanite
September 18, 2025

Hi,

 

not exactly sure how the Python would look like but a corresponding cUrl command would look like this:

curl -X POST "https://<fqdn host>:<port>/cb/api/v3/items/<itemID>/attachments" -u "<user>:<password>" -H "accept: application/json" -H "Content-Type: multipart/form-data" -F "attachments=@Capture.PNG;type=image/png"

1-Visitor
September 19, 2025

Thanks for the guidance. My main requirement is to upload an image as an attachment to a tracker item using the REST API.
Could you please share an example of how this can be done in any programming language (preferably Python, Java, or even curl for Windows)? I’m specifically looking for a solution where the image is posted as an attachment along with the tracker item via the REST API.

19-Tanzanite
September 23, 2025

Above cUrl example already works attaching images as attachment. If it gives error, there may be something odd which needs to be investigated.