Ticket API - Update Ticket to Assign to Group



2022년 2월 05일에 게시됨

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개

      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


      댓글을 남기려면 로그인하세요.

      원하는 정보를 못 찾으셨나요?

      새 게시물