Eventhough Confluence has a good and well documented REST API for integration with other systems it is sometimes necessary to create a custom REST endpoint.
There are two ways you can do this as I see it:
- Build your Confluence add-on.
- Create a script REST endpoint with Scriptrunner add-on from Adaptavist.
I prefer option number two as I have Scriptrunner for Confluence installed. It is a extremely useful add-on for Confluence and JIRA. Very powerful. Check the documentation for Confluence REST endpoints here.
The REST endpoint will display a simple HTTP 200 with some JSON output if all is OK. All you have to do is call the endpoint as a HTTP get request which can be done from a browser. No need for authentication in this code as we do not display sensitive information when returning the response. Nice and simple.
REST endpoint configuration
Go to "REST Endpoints" in the Confluence administration interface.
- Click "Add New item".
- Click "Custom endpoint".
- Type a note and insert the code below.
- Click "Add"
Check screenshot to the right
Screenshot REST endpoint
The endpoint can now be accessed at "<confluencebaseurl>/rest/scriptrunner/latest/custom/health"