How to get Space creation date with Rest API
Asked by Elia Rampi:

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](https://community.atlassian.com/t5/Confluence-questions/list-of-space-by-create-date/qaq-p/1927833), 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](https://docs.atlassian.com/ConfluenceServer/rest/7.19.0/#space/{spaceKey}/property) and property/{key} are identical.  

Could someone share some insights? Thank you in advance


Answers:
author: Cyrille Martin
body: Hi [@Elia Rampi](/t5/user/viewprofilepage/user-id/5419037)

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

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

Regards

comments: author: Elia Rampi
body: Hi, could you provide more details please? in the Expand of which Endpoint? what is the exact query on the endpoint?


author: Cyrille Martin
body: 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>


author: Elia Rampi
body: 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


author: Cyrille Martin
body: Ok,

Did you try to make this call ?

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


author: Elia Rampi
body: 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": ""
}
}
```


Tags: confluence-data-center

confluence-server

server