Searching for pages that have a specific property on Confluence Cloud

I’m using properties to store information about a page - all through the API. I’m looking for a way to get a list of content items that have that property and where it’s value matches a given value. But I’m not seeing a way to do that so I’ve been relegated to using labels instead (since I can use CQL with labels). Is there some API that I’m not aware of that will allow me to search by property?

There is a way (kind of). Connect has a module called Content Property which allows you to index and search for custom content properties using CQL which should solve your use case. If you’re not familar with building Connect apps, however, this may be a deal-breaker.

1 Like

Thanks Richard! Actually, I’m developing this app in forge. Don’t suppose there’s a way within Forge to make this happen?

1 Like

Unfortunately, that particular module does not have an equivalent in Forge. You may be able to adopt that particular Connect module on Forge by following these instructions: How to adopt Forge from Connect

I haven’t tested it myself, however.

I tried using the connect-to-forge tool to convert a connect app which uses the content property module to Forge and it seems to work OK so maybe you’re in luck. The resulting Forge manifest looks something like this:

app:
  id: ...
  connect:
    key: net.customware.confluence.plugin.pageapproval
  runtime:
    name: nodejs18.x
connectModules:
  confluence:confluenceContentProperties:
    - key: page-approval-properties
      name:
        value: Page Approval Properties
      keyConfigurations:
        - propertyKey: net_servicerocket_pa_state
          extractions:
            - objectName: approved
              type: string
              alias: net_servicerocket_pa_state_approved
            - objectName: rejected
              type: string
              alias: net_servicerocket_pa_state_rejected
            - objectName: pendingBy
              type: string
              alias: net_servicerocket_pa_state_pendingBy
            - objectName: state
              type: string
              alias: net_servicerocket_pa_state_state
            - objectName: acknowledged
              type: string
              alias: net_servicerocket_pa_state_acknowledged
        - propertyKey: net_servicerocket_pa_settings
          extractions:
            - objectName: approvalList
              type: string
              alias: net_servicerocket_pa_settings_approvalList
            - objectName: dueDate
              type: date
              alias: net_servicerocket_pa_settings_dueDate
            - objectName: priority
              type: string
              alias: net_servicerocket_pa_settings_priority
            - objectName: acknowledgerList
              type: string
              alias: net_servicerocket_pa_settings_acknowledgerList
            - objectName: creator.accountId
              type: string
              alias: net_servicerocket_pa_settings_requester
              ...

Only other thing you would need to keep in mind is that all existing Confluence content with your desired custom properties will need to be reindexed before they get returned in your CQL search. If it’s just a few pages then you can just edit them in some way to trigger the reindex for that specific content. If it’s a larger number, then you may need to request Atlassian Support to do it for you. You can read more about this issue here.

2 Likes