Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,555,395
Community Members
 
Community Events
184
Community Groups

ScriptRunner (Groovy Script) to create remote link for an issue

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?

1 answer

1 vote
Aron Gombas _Midori_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Aug 17, 2022

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.

See: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-remote-links/#api-rest-api-3-issue-issueidorkey-remotelink-post

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

Suggest an answer

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

Atlassian Community Events