REST API - Space

Available since v. 2.3.0

  • Get space

  • Get all spaces

Available since v. 2.11.0

  • Change space key


Get space

Available only for Confluence Administrators and Space Administrators

This API supports optional parameters

Method type: GET

URL: {CONFLUENCE_URL}/rest/extender/1.0/space/getSpace/{SPACE_KEY}

Parameters:

  • dateFormat - define date format for parameters creationDateFrom, creationDateTo and for JSON output fields creationDateString, lastModificationDateString - default format ‘yyyy-MM-dd'

Example URL:

  • {CONFLUENCE_URL}/rest/extender/1.0/space/getSpace/MYSPACE?dateFormat=MM/dd/yyyy

  • {CONFLUENCE_URL}/rest/extender/1.0/space/getSpace/DEMO?dateFormat=MM.dd.yyyy

Response format: JSON

Example response:

1 2 3 4 5 6 7 8 9 { "creationDateString": "05-14-2020 14:53:21", "lastModificationDate": 1589460802858, "lastModificationDateString": "05-14-2020 14:53:22", "creatorName": "admin", "name": "Space A", "creationDate": 1589460801648, "key": "SPACEA" }

 


Get all spaces

Available only for Confluence Administrators

This API supports Pagination

This API supports optional parameters

Method type: GET

URL: {CONFLUENCE_URL}/rest/extender/1.0/space/getAllSpaces

Parameters:

  • creationDateFrom - filter spaces by created date (creation date >= this date)

  • creationDateTo - filter spaces by created date (creation date <= this date)

  • dateFormat - define date format for parameters creationDateFrom, creationDateTo and for JSON output fields creationDateString, lastModificationDateString - default format ‘yyyy-MM-dd'

Example URL:

  • {CONFLUENCE_URL}/rest/extender/1.0/space/getAllSpaces?creationDateTo=2020-05-14

  • {CONFLUENCE_URL}/rest/extender/1.0/space/getAllSpaces?creationDateFrom=12/01/2019&dateFormat=MM/dd/yyyy

  • {CONFLUENCE_URL}/rest/extender/1.0/space/getAllSpaces?creationDateTo=03.01.2020&creationDateFrom=01.01.2020&dateFormat=MM.dd.yyyy

Response format: JSON

Example response:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 { "total": 2, "maxResults": 100, "spaces": { "SPACEA": { "creationDateString": "05-14-2020 14:53:21", "lastModificationDate": 1589460802858, "lastModificationDateString": "05-14-2020 14:53:22", "creatorName": "admin", "name": "Space A", "creationDate": 1589460801648, "key": "SPACEA" }, "ds": { "creationDateString": "09-25-2018 11:05:32", "lastModificationDate": 1573637171250, "lastModificationDateString": "11-13-2019 10:26:11", "creatorName": "not exist", "name": "Demonstration Space", "creationDate": 1537866332331, "key": "ds" } }, "startAt": 0 }

 

Change space key

Experimental API

Available only for Confluence Administrators

Method type: PUT

URL: {CONFLUENCE_URL}/rest/extender/1.0/space/changeSpaceKey

Request format: JSON

Example request:

1 2 3 4 5 { "currentSpaceKey": "KEYA", "newSpaceKey": "NEWKEY", "reindexSpace": true }
1 2 3 4 { "currentSpaceKey": "KEYA", "newSpaceKey": "NEWKEY" }

currentSpaceKey - required - key of the space you want to modify

newSpaceKey - required - new key for modified space

reindexSpace - optional - (true or false - default value: false) - reindex flag

Space reindex is synchronous, if you set it to true, the response time will depend on the amount of contents in the space.

If you do not set the reindex flag, the search results in the application will return pages with the old space key, in this situation you have to reindex content manually Content Index Administration

 

Response format: JSON

 


Pagination

This REST API uses pagination to improve performance for all Jira users. Pagination is enforced for methods that could return a large collection of items. When you make a request to a paged API, the response will wrap the returned array of values in a JSON object with paging metadata, for example:

1 2 3 4 5 6 7 8 9 10 {     "startAt" : 0,     "maxResults" : 10,     "total": 200,     "objects": [         { /* result 0 */ },         { /* result 1 */ },         { /* result 2 */ }     ] }

Where:

  • startAt is the index of the first item returned in the page of results.

  • maxResults is the maximum number of items that can be returned per page. Each API endpoint may have a different limit for the number of items returned, and these limits may change without notice. (default value - 100)

  • total is the total number of items contained in all pages. This number may change as the client requests the subsequent pages, therefore the client should always assume that the requested page can be empty.