How to remove Application link using a REST endpoint
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
The content on this page relates to platforms which are not supported. Consequently, Atlassian Support cannot guarantee providing any support for it. Please be aware that this material is provided for your information only and using it is done so at your own risk.
This article instructs how to remove an Application Link using a REST endpoint. The use case is when configuring a test or staging server with scripting, disabling the AppLink with a script is easier than removing it manually.
Solution
The below examples require an authenticated session, and also for websudo (secure sessions) to be disabled. Given this is for a test server this should be acceptable, and can be done as per Configuring secure administrator sessions.
Identify the Application Link(s) to be removed by performing a
GET
on<BASE_URL>/rest/applinks/1.0/listApplicationlinks
. This will provide something such as the below:1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
<?xml version="1.0"?> <list> <list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="linkAndAuthProviderEntity"> <application> <link href="http://captain-planet.example.com:60631/jira6312/rest/applinks/1.0/applicationlink/3e3c8fef-6f20-34c5-9e1f-624f0eacd943" rel="self"/> <id>3e3c8fef-6f20-34c5-9e1f-624f0eacd943</id> <typeId>confluence</typeId> <name>Confluence</name> <displayUrl>http://captain-planet.example.com:50587/conf5817</displayUrl> <iconUrl>http://captain-planet.example.com:60631/jira6312/s/en_US-qbihy0/6343/4/4.2.5/_/download/resources/com.atlassian.applinks.applinks-plugin:applinks-images/images/types/16confluence.png</iconUrl> <rpcUrl>http://captain-planet.example.com:50587/conf5817</rpcUrl> <isPrimary>true</isPrimary> <isSystem>false</isSystem> </application> <configuredOutboundAuthenticators>com.atlassian.applinks.api.auth.types.OAuthAuthenticationProvider</configuredOutboundAuthenticators> <configuredOutboundAuthenticators>com.atlassian.applinks.api.auth.types.TwoLeggedOAuthAuthenticationProvider</configuredOutboundAuthenticators> <configuredInboundAuthenticators>com.atlassian.applinks.api.auth.types.OAuthAuthenticationProvider</configuredInboundAuthenticators> <configuredInboundAuthenticators>com.atlassian.applinks.api.auth.types.TwoLeggedOAuthAuthenticationProvider</configuredInboundAuthenticators> <hasIncomingAuthenticationProviders>true</hasIncomingAuthenticationProviders> <hasOutgoingAuthenticationProviders>true</hasOutgoingAuthenticationProviders> <appLinkState>OK</appLinkState> <isSystem>false</isSystem> <entityTypeIdStrings>confluence.space</entityTypeIdStrings> </list> </list>
Retrieve the
id
from the above query, for example using XPath this is/list/list/application/id
.Use that to enter into the URL
<BASE_URL>/rest/applinks/2.0/applicationlink/<id>
, and send aDELETE
to that URL. If we use the example above this ishttp://captain-planet.example.com:60631/jira6312/rest/applinks/2.0/applicationlink/3e3c8fef-6f20-34c5-9e1f-624f0eacd943
.This will delete the Application Link.
This can be automated with something similar to the below Shell script, replacing admin:sphere with the username and password.
1
2
curl -u admin:sphere http://captain-planet.example.com:60631/jira6312/rest/applinks/1.0/listApplicationlinks | xmllint --xpath '/list/list/application/id/text()' - > id.txt
curl -u admin:sphere -X DELETE 'http://captain-planet.example.com:60631/jira6312/rest/applinks/2.0/applicationlink/'$(cat id.txt)
A successful result will be output something similar to the below. This does not delete the application link in the linked instance (in this example, Confluence).
1
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><status><status-code>200</status-code><message>Deleted application with id '3e3c8fef-6f20-34c5-9e1f-624f0eacd943'</message></status>
Was this helpful?