confluencebuilder
confluencebuilder copied to clipboard
Confluence API Calls always assume "rest/api" at the end of the API URL
My company's instance of Confluence has its normal "rest/api" URL disabled, and instead the IT created a separate URL gateway that receives the API calls and redirect them somehow internally.
Long-Story-Short: The URL, that I can use for API calls, doesn't end with "rest/api". I need a parameter in conf.py where I can decide whether to add "rest/api" automatically to my server URL or not.
Here's how the first line of the "get" function looks like (where API_REST_BIND_PATH is "rest/api"):
rest_url = self.url + API_REST_BIND_PATH + '/' + key
P.S: I already created a local branch and tested my theory, and it's working. If possible, I'd like to contribute with a PR but I don't seem to have access to create a branch. If not, I simply just need that conf parameter.
Thanks in advance.
Ah, nice suggestion. It would be great to add support for this (for your use case and possibly others).
You're free to submit a pull request yourself, if you do desired. You can fork the project (top-right), prepare your branch and you should be able to submit a pull request to this project. Please make sure you take a glace a the CONTRIBUTING documentation, if you haven't done so already.
Some comments:
- Add configuration in sphinxcontrib/confluencebuilder/init.py under the "advanced publishing" section (maybe call it
confluence_publish_bind_pathor use an alternative you may think is better). - Ensure existing
API_REST_BIND_PATHusages can handle a user-provided path (looks like the only odd case would be trying to deal withnormalize_base_url). - Ensure you add a respective configuration check and maybe handle the default bind point in the defaults-configuration implementation.
- It would be nice add a simple configuration unit-test.
- Add the configuration item to the documentation under the "Advanced publishing configuration" section.
- And if you're feeling like a completionist, you could also add a publisher unit test to verify the setting of a custom bind path somewhere in test_publisher_connect.py (or its own file).
And if this is not really something you would like to do at this time, let me know. There is a planned release soon and I could try to take a look at this this upcoming weekend (if time permitted).
I just did so, please have a look when you have time: https://github.com/sphinx-contrib/confluencebuilder/pull/626/
Changes to support this capability have been added via #661 (over #626). It was unknown if this original pull request would have the sign-off's set on the commits. Since this issue outlines a valid issue to resolve, changes were addressed (along with some additional unit testing and documentation) in the new pull request. Thanks for presenting this issue and providing an additional pull request example -- it provided useful information to support this user case. The new pull request was performed since their was a window of maintenance time to commit to this extension.
This change has been added into the main branch and should be made available next stable release. If users wish to use this capability before a release is made, the development version of this extension can be installed.
v1.9 is now available on PyPI -- marking as closed.