Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Info
titleProgrammers only

This documentation is only designed for programmers. It is provided as is, and programmers are expected to be good enough to solve problems.

REST API in Confluence

Info
titleExperimental API

Our API is subject to changes.

  • When we annotate @Public, we attempt with "best effort" to keep the API backwards-compatible for as long as possible.
    • If we want to deprecate, we will annotate with @Deprecated for a few versions, then remove it in the major version (in "platform.major.micro" versioning scheme, for example in 2.2.0).
    • We may add parameters, not remove them.
  • When we annotate @Internal, we don't even try to keep it stable, it usually changes from 1 micro version to another. Those APIs are tightly couples with the Javascript.
  • When we don't annotate, please consider it as @Internal.

This documentation is only designed for programmers. It is provided as is, and programmers are expected to be good enough to solve problems.

How to build the URL?

The "base URL" is the address of Confluence. It could be:

...

All other information is available in the REST API Browser.



REST API in Jira

Verb and URLComments and query string arguments
GET /rest/reqs/1/api

Displays generic information about this REST resource. Also displays the current user's name.

  • ?applinkId={the applink id}
  • ?url={the applink url}
  • Both arguments above display whether the Applink was recognized.

Anonymous-allowed.

POST /rest/reqs/1/api

Posts messages from Confluence to Jira.

Messages are encoded in JSON:

Code Block
titleQueue message, APIv4
{
	id: an arbitrary integer, local to this request,
    type: "UPDATED" or "DELETED" or "MOVED" or "LINK",
    // If the message is sent using a technical user, this contains
    // the Confluence author details
    authorKey, authorName,
    
    // Related to the Confluence requirement
    spaceKey, key, baseline,
    
    // Related to the Jira issue
    estate: "_", // Always "_" for Jira,
    objectKey: "the issue key"
    
    // Related to both
    relationship,

    // Data
    newHtmlExcerpt,
    newSpaceKey,
    newKey,
    newBaseline,
    newUrl
}
PUT /rest/reqs/1/api/{applinkId}/modeChanges the API mode. The body must be a string between quotes: AUTO, MANUAL, DISABLED, sent with a JSON content type.
PUT /rest/reqs/1/api/{applinkId}/version

Changes the API version. The body is an integer, sent with a JSON content type.

The API changes the version and tells the user which version was accepted (in case Jira doesn't support that version).

GET /rest/reqs/1/issuelinks

Not implemented, returns a fixed string.

GET /rest/reqs/1/issuelinks/{issueKey} (lightbulb)Returns the links on an issue. A ?relationship= parameter can be specified.
POST /rest/reqs/1/issuelinks/{issueKey} (lightbulb)

Creates issue links. Body is JSON:

Code Block
[{
    // Primary key of the requirement in Confluence
	applinkId: the applink ID of Confluence,
    spaceKey,
    key,
    baselineNumber,
    // Part of the primary key for Jira: issue-relationship-requirement
    relationship,
    
    // More details of the requirement
    genericUrl: the URL of the requirment, relative to the baseURL of Confluence,
    htmlExcerpt: the excerpt, in HTML format. It will be sanitized, but not escaped.   
}, ...]

The HTML is updated for this requirement in Jira, which means if another Jira issue has a link to the same requirement, its text will be updated.

PUT /rest/reqs/1/issuelinks/{issueKey} Same as POST, but removes all existing links on this issue before. Can be scoped using ?relationship=...
DELETE /rest/reqs/1/issuelinks/{issueKey}

List of links to delete from this issue:

Code Block
[{ applinkId, spaceKey, key, baselineNumber, relationship }, ...]
PUT /rest/reqs/1/sync?issues=PROJ-2,PROJ-1

Ask Jira to resynchronize those issues with Confluence:

  • Jira will ask Confluence for the latest HTML of the requirements,
  • Jira will tell Confluence what are the correct links between requirements and Jira issues. 

All links of all requirements linked with the specified issues are synced. It means:

  • if you synchronize JIRA-1 which has REQ-001 and REQ-002,
  • and if REQ–2 is also on JIRA-2, even though it is not in the list of synchronized requirements,
  • Then it will send the 3 relationships to Confluence.