Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to get Space creation date with Rest API

Elia Rampi January 31, 2024

Hi,

I'm nruning Confluence Data Center 7.19 and I need to retrieve Spaces creation date and the user that created it with Resti API.
I was checking this post, but I don't get useful informations from that endpoint:

curl -k -X GET https://confluence.site.com/rest/api/space?status=current
{
"id": 281444356,
"key": "PRJ0011599",
"name": "CRM & Marketing Platform",
"type": "global",
"_links": {
"webui": "/display/PRJ0011599",
"self": "https://confluence.si.tecom/rest/api/space/PRJ0011599"
},
"_expandable": {
"metadata": "",
"icon": "",
"description": "",
"retentionPolicy": "",
"homepage": "/rest/api/content/278664854"
}
}

 I also tried to check documentation of Rest api, but seems like the documentation for the endpoints property and property/{key} are identical.

Could someone share some insights? Thank you in advance

1 answer

0 votes
Cyrille Martin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 31, 2024

Hi @Elia Rampi 

In the Expand you should have access to the "history" in which you will have the createdDate

... "history": { "createdDate": "<string>", ....

Regards

Elia Rampi January 31, 2024

Hi, could you provide more details please? in the Expand of which Endpoint? what is the exact query on the endpoint? 

Cyrille Martin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 31, 2024

Hi,
In your case for DC : 

http://example.com/confluence/rest/api/space?spaceKey=xxx

 You will have in return 

{ "id": "https://docs.atlassian.com/jira/REST/schema/page-response-of-space#", "title": "Page Response of Space", "type": "array", "items": { "$ref": "#/definitions/space" }, "definitions": { "anonymous": { "title": "Anonymous", "type": "object", "properties": { "profilePicture": { "$ref": "#/definitions/icon" }, "displayName": { "type": "string" }, "type": { "type": "string" } }, "additionalProperties": false }, "content": { "title": "Content", "type": "object", "properties": { "id": { "title": "Content Id", "type": "object" }, "type": { "title": "Content Type", "type": "object" }, "status": { "title": "Content Status", "type": "object" }, "title": { "type": "string" }, "space": { "type": "array", "items": { "$ref": "#/definitions/space" } }, "history": { "type": "array", "items": { "title": "History", "type": "object", "properties": { "previousVersion": { "type": "array", "items": { "$ref": "#/definitions/version" } }, "nextVersion": { "type": "array", "items": { "$ref": "#/definitions/version" } }, "lastUpdated": { "type": "array", "items": { "$ref": "#/definitions/version" } }, "latest": { "type": "boolean" }, "createdBy": { "$ref": "#/definitions/person" }, "createdDate": { "type": "string"

Structure :
Definitions -> Content -> properties -> history -> items -> properties -> createdDate

link to the documentation : https://docs.atlassian.com/ConfluenceServer/rest/8.7.2/#api/space-spaces 

 

Elia Rampi January 31, 2024

Thank you, problem is that it doesn't:

curl -s -k -X GET https://confluence.site.com/rest/api/space?spaceKey=Change | jq
{
"results": [
{
"id": 4554755,
"key": "Change",
"name": "ChangeManagement",
"type": "global",
"_links": {
"webui": "/display/Change",
"self": "https://confluence.site.com/rest/api/space/Change"
},
"_expandable": {
"metadata": "",
"icon": "",
"description": "",
"retentionPolicy": "",
"homepage": "/rest/api/content/4522249"
}
}
],
"start": 0,
"limit": 25,
"size": 1,
"_links": {
"self": "https://confluence.site.com/rest/api/space?spaceKey=Change",
"base": "https://confluence.site.com",
"context": ""
}
}

I'm using 7.19, not the latest, as previously stated.
Thank you

Cyrille Martin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 31, 2024

Ok,

Did you try to make this call ?

curl -s -k -X GET https://confluence.site.com/rest/api/space/{spaceKey}/property?expand=history

 

Elia Rampi January 31, 2024

Hi, yes, but it's not returning anything:

curl -s -k -X GET https://confluence.site.com/rest/api/space?spaceKey=Change/property?expand=history  | jq
{
"results": [],
"start": 0,
"limit": 25,
"size": 0,
"_links": {
"self": "https://confluence.site.com/rest/api/space?spaceKey=Change/property?expand=history",
"base": "https://confluence.site.com",
"context": ""
}
}

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events