Going Stellar

Home/Atlassian REST API reference

Jira and Confluence Cloud REST API

Jira remote links with the REST API

POST /rest/api/3/issue/{issueIdOrKey}/remotelink attaches a URL with a title to a work item and answers 201 with a numeric id. The list endpoint answers a bare JSON array, not a paged object. DELETE by link id answers 204.

Endpoints

MethodPathWhat it does
POST/rest/api/3/issue/{issueIdOrKey}/remotelinkCreates or updates a remote link.
GET/rest/api/3/issue/{issueIdOrKey}/remotelinkLists the remote links of a work item.
DELETE/rest/api/3/issue/{issueIdOrKey}/remotelink/{linkId}Deletes a remote link by id.

Examples

Attach a URL with a title. Only object.url and object.title are needed.

curl

curl -X POST \
  -u "you@example.com:$ATLASSIAN_API_TOKEN" \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  --data '{
  "object": {
    "url": "https://example.com/spec",
    "title": "Example spec"
  }
}' \
  'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}/remotelink'

Python (requests)

import os
import requests

EMAIL = "you@example.com"
r = requests.post(
    'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}/remotelink',
    auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
    headers={'Accept': 'application/json'},
    json={'object': {'url': 'https://example.com/spec', 'title': 'Example spec'}},
)
print(r.status_code, r.text)

Response: HTTP 201

{
 "id": 10001,
 "self": "https://your-domain.atlassian.net/rest/api/3/issue/WEB-55/remotelink/10001"
}

Response headers

Location: https://your-domain.atlassian.net/rest/api/3/issue/WEB-55/remotelink/10001

Sent to Atlassian Cloud on .

List the links. The body is a JSON array, and application and icon are empty objects.

curl

curl \
  -u "you@example.com:$ATLASSIAN_API_TOKEN" \
  -H 'Accept: application/json' \
  'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}/remotelink'

Python (requests)

import os
import requests

EMAIL = "you@example.com"
r = requests.get(
    'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}/remotelink',
    auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
    headers={'Accept': 'application/json'},
)
print(r.status_code, r.text)

Response: HTTP 200

[
 {
  "id": 10001,
  "self": "https://your-domain.atlassian.net/rest/api/3/issue/WEB-55/remotelink/10001",
  "application": {},
  "object": {
   "url": "https://example.com/spec",
   "title": "Example spec",
   "icon": {},
   "status": {
    "icon": {}
   }
  }
 }
]

Sent to Atlassian Cloud on .

Delete the link by its numeric id.

curl

curl -X DELETE \
  -u "you@example.com:$ATLASSIAN_API_TOKEN" \
  -H 'Accept: application/json' \
  'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}/remotelink/{remoteLinkId}'

Python (requests)

import os
import requests

EMAIL = "you@example.com"
r = requests.delete(
    'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}/remotelink/{remoteLinkId}',
    auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
    headers={'Accept': 'application/json'},
)
print(r.status_code, r.text)

Response: HTTP 204

No response body.

Sent to Atlassian Cloud on .

How it behaves

  • The create call answered 201 with id as a number (10001) and a self URL; the same URL was in the Location header.
  • The list answered a JSON array with one element per link, not an object with values.
  • Elements carried empty application, icon and status.icon objects when only url and title were sent.
  • Delete by link id answered 204.

Pitfalls

  • The spec says a globalId in the body makes POST update an existing link, and fields left out are set to null. Send the full object when updating.
  • The link id is a number, while work item ids are strings. Compare types carefully in typed clients.
  • Remote links need issue linking enabled; the spec lists 403 when it is disabled.
  • A work item has a per-item limit on remote links, and the spec answers 413 once it is reached.

Questions and answers

How is a remote link different from a work item link?

A work item link joins two work items on the site. A remote link points at an external URL and carries a title, icon and optional global id.

Sources

  1. The Jira Cloud platform REST API v3 (Atlassian Developer)
  2. Create or update remote issue link (Jira REST API v3)
  3. Get remote issue links (Jira REST API v3)
  4. Delete remote issue link by ID (Jira REST API v3)

Markdown version · All REST API pages