79122048

Date: 2024-10-24 13:15:01
Score: 1.5
Natty:
Report link

It looks like the URI you are using resolves to a path that doesn't exist. Based on JIRA Service Desk REST API Reference it looks like the URI for uploading an attachment to a ticket, looks a bit like this: /rest/servicedeskapi/request/{issueIdOrKey}/attachment

It might be different based on environments, but this is as close as I could get it based on the provided information.

Suggest you try editing these two lines:

$jiraRestUrl = "http://xxxxxxx/jira/rest/api/2"

"$jiraRestUrl/issue/$jiraID/attachments"

To:

$jiraRestUrl = "http://xxxxxxx/rest/servicedeskapi/request/"

"$jiraRestUrl/$jiraID/attachment/"

Maybe you need to play around a bit with the API to figure out what works, maybe start by just retrieving a ticket based on the Jira Ticket ID?

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Low reputation (0.5):
Posted by: Marc H