Alternative Methods of Deleting Application Links in Confluence

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

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

This article outlines alternative methods of removing Application Link configuration in your Confluence instance as it cannot be deleted with the conventional way via Confluence UI. 

Diagnosis

Before performing the steps from the Resolutions section, please first ensure that you've tried to delete the Application Link configuration from the Configure Application Links page (Confluence Administration page >> Application Links) as shown in the screenshot below.

If you are still unable to delete the configured Application Link, please then proceed to the Resolutions section of this KB.

Causes 

Due to some data corruption in the Confluence Database, Application Links then cannot be deleted from Confluence UI.

Resolutions

We suggest our customers follow the resolutions highlighted below in sequential order as the latter resolution is highly risky.


  • Remove Application Link by Using a REST Endpoint

  1. First, please run this curl command to identify the existing Application Links configured in your Confluence instance:

    curl -s -X GET -u <username>:<password> -H "Accept: application/json" <Confluence-Base-URL>/rest/applinks/1.0/listApplicationlinks | python -mjson.tool
    Sample Result
    {
        "list": [
            {
                "application": {
                    "displayUrl": "https://jiratest.com",
                    "iconUri": "http://localhost:8090/s/en_GB/6441/7d28db648b08c18ff79fe305b2da56665a84a1fc/5.2.2/_/download/resources/com.atlassian.applinks.applinks-plugin:applinks-images/images/config/logos/128x128/128jira.png",
                    "iconUrl": "http://localhost:8090/s/en_GB/6441/7d28db648b08c18ff79fe305b2da56665a84a1fc/5.2.2/_/download/resources/com.atlassian.applinks.applinks-plugin:applinks-images/images/types/16jira.png",
                    "id": "79f0263c-a3a5-323b-870c-aea1895cabeb",
                    "isPrimary": true,
                    "isSystem": false,
                    "link": [
                        {
                            "href": "http://localhost:8090/rest/applinks/1.0/applicationlink/79f0263c-a3a5-323b-870c-aea1895cabeb",
                            "rel": "self"
                        }
                    ],
                    "name": "JIRA (jiratest.com)",
                    "primary": true,
                    "rpcUrl": "https://jiratest.com",
                    "system": false,
                    "typeId": "jira"
                },
                "configuredInboundAuthenticators": [],
                "configuredOutboundAuthenticators": [
                    "com.atlassian.applinks.api.auth.types.TrustedAppsAuthenticationProvider"
                ],
                "entityTypeIdStrings": [
                    "jira.project"
                ],
                "hasIncomingAuthenticationProviders": true,
                "hasOutgoingAuthenticationProviders": true,
                "isSystem": false,
                "webItems": [],
                "webPanels": []
            }
        ]
    }
    
    

    (info) In the example above, the application link ID is: "79f0263c-a3a5-323b-870c-aea1895cabeb"


  2. Next, once you've identified the Application Link ID of the application that you'd like to remove, you may then run the following command to remove this Application Link configuration.

    curl -X DELETE -u <username>:<password> -H "Accept: application/json" <Confluence-Base-URL>/rest/applinks/1.0/applicationlink/<JIRA-ApplicationLink_ID>


    t

  • Manually Remove Application Link Directly through Confluence Database

    If you are unsure how to deal with the database, contact your DBA. Make sure to have the database backed up completely before going further. These SQL commands were tested in some environments and they worked as intended.

    However, it might not work in specific cases and newer versions of confluence as new constraints as changes may be done to confluence database structure. As such, a database backup is mandatory in case any issue arises and you'd need to rollback to the previous working state of Confluence Database.

  1. Make a note of the name of the link you want to delete, (e.g. JIRA in the example mentioned in the Diagnosis section above).
  2. Shut down Confluence
  3. Backup your database completely
  4. Find the Application link ID:

    SELECT * FROM BANDANA WHERE BANDANAKEY LIKE 'applinks%' and BANDANAVALUE like '%your link's name from Step 1%';

    (info) The application link ID will look like: "cfce37ac-1125-3e7f-93dd-17c643239204"

  5. Find all entries for the application link from step 4, replacing the ID with yours:

    SELECT * FROM BANDANA WHERE BANDANAKEY LIKE '%cfce37ac-1125-3e7f-93dd-17c643239204%';
  6. Remove entries for that application link id:

    DELETE FROM BANDANA WHERE BANDANAKEY LIKE '%application link id from Step 5%';
  7. Update applinks.global.application.ids to complete the removal:

    SELECT BANDANAVALUE FROM BANDANA WHERE BANDANAKEY = 'applinks.global.application.ids';

    Example of output:

     <list>
      <string>e0bea7ec-e080-35fd-b856-c942ed2f83cc</string>
      <string>cfce37ac-1125-3e7f-93dd-17c643239204</string>
      <string>034974ba-a91a-33aa-a715-aa15aa133374</string>
     </list>

    Remove the line containing the ID from step 5:

    UPDATE BANDANA SET 
    BANDANAVALUE = '<list>
      <string>e0bea7ec-e080-35fd-b856-c942ed2f83cc</string>
      <string>034974ba-a91a-33aa-a715-aa15aa133374</string>
     </list>'
    WHERE BANDANAKEY = 'applinks.global.application.ids';
  8. Restart Confluence.       
    Note: A restart is required, as flushing Confluence caches is not sufficient to avoid further problems with removed applinks.


If you are using Trusted Applications as the authentication method, you will also need to run the following steps:

Click here to expand...
  1. Locate TRUSTEDAPPs name to delete:

    select BANDANAKEY from BANDANA where BANDANAVALUE like '%your JIRA's name from Step 1%';

    The bandanakey will return a value similar to either of the entries below: 

    • "com.atlassian.oauth.serviceprovider.ServiceProviderConsumerStore.consumer.jira:16308251"; or 

    • "com.atlassian.oauth.serviceprovider.ServiceProviderConsumerStore.con66d3e071c01d166956f9d950ecf12ae5"

    (info) Make a note of the string in bold at the end. 

  2. Run these queries to remove the trusted application configuration, replacing the strings of numbers with yours:

    select * from TRUSTEDAPP where NAME like '%16308251%'; 
    // Make a note of the trustedappid of the link you are deleting and replace it in this query:
    select * from TRUSTEDAPPRESTRICTION where TRUSTEDAPPID = 12345;
    // confirm the above both returns what you expect, and when comfortable:
    delete from TRUSTEDAPPRESTRICTION where TRUSTEDAPPID = 12345;
    delete from TRUSTEDAPP where NAME like '%16308251%';
  3. Remove the keystore configuration, replacing the string of numbers with yours:

    select * from KEYSTORE where ALIAS like '%16308251%';
    // confirm this returns what you expect, and when comfortable:
    delete from KEYSTORE where ALIAS like '%16308251%';
  4. Remove the OAuth configuration, replacing the string of numbers with yours:

    select * from BANDANA where BANDANAVALUE like '%16308251%';
    select * from BANDANA where BANDANAKEY like '%16308251%';
    // confirm this returns what you expect, and when comfortable:
    delete from BANDANA where BANDANAVALUE like '%16308251%';
    delete from BANDANA where BANDANAKEY like '%16308251%';
Last modified on Jan 16, 2023

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.