Hi David,
Thank you for you quick response first of all.
I followed your suggestion and tried to use both V2 and V3 API but im still cant get it to upload the file to my custom field.
For both of the examples i was trying to upload to the field an attachment that is already been uploaded before as an attachment.
When trying to use V2 what the output was the this line was just printed as a string into the field:
Here is the V2 API code:
import requests
# Set the URL of the Jira instance and the issue key
url = "https://xxxxxx.atlassian.net/rest/api/2/issue/TO-10066"
# Set the authentication credentials
auth = ("xxxxxxx", "xxxxxxxxx")
# Set the headers
headers = {
"Content-Type": "application/json"
}
# Set the custom field ID and value
custom_field_id = "customfield_10680"
value = "<ac:image><ac:attachment><ri:attachment ri:filename=\"UploadedByAutomation.png\" /></ac:attachment></ac:image>"
# Set the payload
payload = {
"fields": {
custom_field_id: value
}
}
# Send the request to update the custom field with attachment reference
response = requests.put(url, auth=auth, headers=headers, json=payload)
# Check if the request was successful
if response.status_code == 204:
print("Custom field updated successfully!")
else:
print("Failed to update custom field.")
Here is what i got after running it. Its just printing the value to the field as str:
When using V3 API… well it just didnt worked at all 
Here is the code ive been using:
import requests
# Set the URL of the Jira instance and the issue key
url = "https://xxxxxx.atlassian.net/rest/api/3/issue/TO-10066"
# Set the authentication credentials
auth = ("xxxxxx", "xxxxx")
response = requests.get(url, auth=auth)
# Set the headers
headers = {
"Content-Type": "application/json"
}
# Set the custom field ID and value
custom_field_id = "customfield_10006"
value = {
"type": "doc",
"version": 1,
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "Here is your attachment:"
},
{
"type": "media",
"attrs": {
"id": "410806",
"type": "attachment",
"collection": "410799",
"width": 100,
"height": 100
}
}
]
}
]
}
# Send the request to update the custom field with attachment reference
response = requests.put(url, auth=auth, headers=headers, json={"fields": {custom_field_id: value}})
# Check if the request was successful
if response.status_code == 204:
print("Custom field updated successfully!")
else:
print("Failed to update custom field.")
Am i missing something?
Im a little bit new to Jira API and untill now used it for more simple tasks.
The file im trying to upload is a png file if it makes any difference.
Thanks in advance for any help.