Create REST Datasource
We will first query the Confluence search API. Go to the datasources in the PocketQuery administration and add a new one with the type "REST Basic". Give it a reasonable name and set the parameters:
- URL: The URL where your Confluence instance is running followed by /rest/api
- Test URL: The test query, that will be used to check if the datasource is set up correctly. In this case use content/search?cql=creator=admin where "admin" is an existing Confluence user.
- User and Password: Enter the Confluence login credentials of a user.
Test your connection and save it.
Create REST Query
Go to Queries, add a new one and select your new REST datasource as datasource.
- Choose a name.
- REST URL: Enter content/search?cql=creator=:creator. This URL path will be appended to the URL we set up for the datasource. As you can see by the colon it contains a parameter called "creator".
- JSON Path: Use $.results for this. The JSON Path specifies where the data you are looking for is located inside the JSON returned as an response.
If you want to check whether the request is correct, try to paste the complete URL into a browser with an existing username instead of the :creator parameter. An URL likeshould return a large JSON, that on the first level includes an element named "results" - given you are currently logged in to Confluence, otherwise you will get statuscode 403 (authorized: false). When PocketQuery sends the call it includes the user credentials you set while adding the datasource.
Save your query. If you add it to a Confluence page now, you will see a large table containing all the pages created by the user given as parameter.