pythonconfluence

Calendar info using confluence API


I have a Confluence page which has a Calendar inside it (please check photo below). Calendar I am trying to pull information from this calendar, like how many events in each day. Nothing more.

I used a code from Stack Overflow that reads Confluence page using API. But the JSON response does not contain any data about the calendar inside the page.

`import requests
import json
from requests.auth import HTTPDigestAuth
confluence_host = "https://confluence.tools.mycompany.com"
url = confluence_host + '/rest/api/content/'
page_id = "36013799"
page = requests.get(url=url + page_id,
                       params={'expand': 'body.storage'},
                   auth=('my_user', 'my_password') ).json()`

Even if I write, HTML = page['body']['storage']['value'] and check its output, it only gives this:

name="calendar" ac:schema-version="1" ac:macro-id="99a26d73-abaa-45a1-92cc-0edafec567f5"><ac:parameter ac:name="id">72da4ae5-4888-46dd-9078-0299b51ab815,743a55b4-7b3b-4e00-b102-90d95916de8d</ac:parameter></ac:structured-macro>

Is there any way to get the calendar info?


Solution

  • You are using Team Calendar in your page and Team Calendar is a plugin in your page. Technically, /rest/api/content only gives you the content of the page not the Content of the Plugins. As far as I know, Team Calendar doesn't have Public Rest API as you can see on CONFSERVER-51323 but you can get the data that you want from the database instead of REST API since Team Calendar has already creates couple of AO Tables in your database.