Búsquedas recientes


No hay búsquedas recientes

Ticket API - Update Ticket to Assign to Group



Publicado 05 feb 2022

Hi all,

I am attempting to update a ticket via API to assign it to a group using the group ID.

def update_zd_ticket(url: str, user: str, token: str, zd_ticket: dict, jira_issue: str):

session = requests.Session()
session.auth = ("%s/token" % user, token)

url = f"{url}/api/v2/tickets/{zd_ticket.get('id')}"
jira_url = f"https://jira.mycompany.com/browse/{jira_issue}"
payload = {
"ticket": {
"comment": {
"body": f"Jira ticket created: {jira_url}", "public": True
},
"group_id": SOME_GROUP_ID_HERE_AS_NUMERIC,
"status": "open"
}
}

data = json.dumps(payload)

response = session.request("PUT", url, data=data)

The above code returns 200 status, but the expected update doesn't happen and I am not seeing any message as to why. I am new at this, so I fully expect a face-palm moment, but if some kind soul could please help me out before I lose the hair I have left, I would really appreciate it!

Thanks,
Bruber


0

1

1 comentario

Got it.

Added

session.headers = {
'Content-Type': 'application/json',
}

Not sure why it still returned a 200 when a required header was missing. That should have been an error status of some sort.

0


Iniciar sesión para dejar un comentario.

¿No encontró lo que buscaba?

Nueva publicación