You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
I am trying to create remote web link using Groovy Script via ScriptRunner with the following:
post("/rest/api/3/issue/${issue}/remotelink")
.header('Content-Type','application-json')
.body(
[
title: 'weblink',
url: 'https://a.b.com/'
])
.asString().body
But nothing happens, when I look at the Script Runner log, I saw the following:
2022-08-16 13:48:51.115 INFO - POST /rest/api/3/issue/JIRATEST2-225/remotelink asString Request Duration: 254ms 2022-08-16 13:48:51.116 WARN - POST request to /rest/api/3/issue/JIRATEST2-225/remotelink returned an error code: status: 400 - Bad Request body: <html> <head> <title>Bad Request (400)</title> <!--[if IE]><![endif]--> <script type="text/javascript" > var contextPath = ''; var DeferScripts = { deferState: 'disabled' }; </script>
Why it is a bad request and POST body is empty?
Looking at the documentation of the REST API end-point you're trying to call, it seems to me that your request body contains only 2 fields, but the end-points expects much more details.
When I use RestAPI tool (postman) to call the Jira Cloud API directly, i was able to create the remote link correctly with the following body
{
"object": {
"title": "TestTitle",
"url": "https://a.b.com"
}
}
The API endpoint is: https://xxx.atlassian.net/rest/api/3/issue/{issueId}/remotelink
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.