You can create baselines through REST API.

The format for a Baseline Create call is as follows:

REST Call

HTTP POST  

<confluence-server>/plugins/servlet/baselinecreateservlet?space-key=<space-key>&baseline-name=<baseline-name>&creation-type=<creation-type>&baseline-keyword=<baseline-keyword>&baseline-date=<baseline-date>&selectAllPages=<selectAllPages>&fullySelectedPages=<fullySelectedPages>&partiallySelectedPages=<partiallySelectedPages>


ParameterDescriptionRequiredSample
confluence-serverThe full URL for your Confluence ServerYeshttp://192.168.0.71:6110/confluence611
space-keyThe key of the Confluence document space for which the baseline will be createdYesABC
baseline-nameThe name of the baseline that will be createdYesMy New Baseline
creation-type

How to pick page versions from each page's history. Two options:

  • date-based
  • version-based
Yes
  • date-based
  • version-based
baseline-keyword

(Optional) The keyword for the baseline. Any string works.

!!! Leave empty if you are not sure how to use this.



baseline-dateThe date and exact time for the baselineonly when creation-type = date-based2018-09-12 11:08:12
selectAllPages

Whether all pages in the space will be included in the baseline

Possible values:

  • true
  • false

  • true
  • false
partiallySelectedPages

Used if "selectAllPages" is false

A list of page ID's.

The pages in this list will be included in the baseline WITHOUT all their subpages. 

Can be defined in two formats:

  • Basic
    • This format is a simple comma-separated list of page ID's. Designed to be used when creation-type = date-based.
    • when creation-type = version-based, this format does not include page version information so the latest page version is assumed for each page. 
  • Advanced
    • This format is a JSON text that contains page ID's and version info. This format must be used if you want to explicitly define page versions (when creation-type = version-based)
    • For each page you can define a version explicitly or use the keyword "latest" to get the latest version of the page.
    • If version info is not present for a page, latest page version is assumed.


The basic format can be included in the URL as a query parameter but the advanced format is expected to be sent in request body encoded as "application/x-www-form-urlencoded"


Basic:

12345
12345,13564

Advanced:

[
   {
      "id":"12345",
      "version":"latest"
   },
   {
      "id":"13564",
      "version":"3"
   },
   {
      "id":"13564"
   }
]
fullySelectedPages

Used if "selectAllPages" is false

A list of page ID's.

The pages in this list will be included in the baseline WITH all their subpages. (Subpages will be included with their latest versions unless another version is explicitly defined)

Can be defined in two formats:

  • Basic
    • This format is a simple comma-separated list of page ID's. Designed to be used when creation-type = date-based.
    • when creation-type = version-based, this format does not include page version information so the latest page version is assumed for each page. 
  • Advanced
    • This format is a JSON text that contains page ID's and version info. This format must be used if you want to explicitly define page versions (when creation-type = version-based)
    • For each page you can define a version explicitly or use the keyword "latest" to get the latest version of the page.
    • If version info is not present for a page, latest page version is assumed.


The basic format can be included in the URL as a query parameter but the advanced format is expected to be sent in request body encoded as "application/x-www-form-urlencoded"


Basic:

12345
12345,13564

Advanced:

[
   {
      "id":"12345",
      "version":"latest"
   },
   {
      "id":"13564",
      "version":"3"
   },
   {
      "id":"13564"
   }
]







Sample Requests:
(HTTP POST) 

http://192.168.0.71:6110/confluence611/plugins/servlet/baselinecreateservlet?space-key=ds&baseline-name=My New Baseline 1&creation-type=date-based&baseline-date=2018-12-19 11:08:12&selectAllPages=true

http://192.168.0.71:6110/confluence611/plugins/servlet/baselinecreateservlet?space-key=ds&baseline-name=My New Baseline 2&creation-type=date-based&baseline-date=2018-12-19 11:08:12&selectAllPages=false&fullySelectedPages=65540,66534&partiallySelectedPages=63578,34527





Result

The REST call will return a JSON text either confirming the creation of the baselines or error messages about parameters.

{
    "message": "Baseline My New Baseline 1 created with 14 page(s) and 21 attachment(s)",
    "warnings": []
}