Not able to upload attachment using script runner

Sourav tulsyan
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 16, 2024

I am trying to upload data using the below api but geeting the error as stated at the bottom

 

def uploadResponse = post("/rest/api/2/issue/${sourceIssueKey}/attachments")
        .header("X-Atlassian-Token", "no-check")
        .header("Content-Type", "multipart/form-data")
        .field("file", fileData.body, attachmentFilename)
        .asObject(Map)

 

POST request to /rest/api/2/issue/FP-48/attachments returned an error code: status: 500 - Server Error (530) (proxy status: 530)
body: java.lang.RuntimeException: com.fasterxml.jackson.core.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
 at [Source: (String)"<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><title>Oops - an error has occurred</title><link type='text/css' rel='stylesheet' href='/static-assets/metal-all.css' media='all'><script src='/static-assets/metal-all.js'></script><meta name="decorator" content="none" /></head><body class=" error-page error500"><script type="text/javascript">document.body.className += " js-enabled";</script><div id="page"><header id="header" role="ban"[truncated 1136 chars]; line: 1, column: 1]

 

0 answers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events