I just tried the new v2 Get space endpoint. As per the documentation, the createdDate property wasn’t returned.
GET https://{{Instance}}/wiki/api/v2/spaces/254705666
{
"name": "David Bakkers",
"key": "~496279867",
"id": 254705666,
"type": "personal",
"homepageId": 254705737,
"icon": null,
"description": null,
"status": "current"
}
So, I took a chance and tried the new v2 Get space properties in space endpoint to get either the createdAt or version.createdAt properties that the documentation says is supposed to be returned, but the endpoint returned an empty results
array.
GET https://{{Instance}}/wiki/api/v2/spaces/254705666/properties
{
"results": [],
"_links": {}
}
which I now know is expected, as @scott.dudley has pointed out below.
The v1 Get space endpoint has no problem returning the createdDate when the history
is expanded. It seems like there is no obvious way to get the same information via a v2 endpoint.
I believe the new V2 APIs you are calling are intended to retrieve space properties (content properties) that you have manually created and saved to a space, rather than an innate property of the space itself. They will return the createdAt of a property that you have saved, but it looks like there are not any such properties, hence the empty results array.
As for as how to get the createdDate of a space itself in the V2 API, that’s a question that only someone from Atlassian can answer.
1 Like
Ahh, OK, I get it. Space properties are just abstract metadata about the space. Thanks for the clarity.
I created a test property in the space and then read the properties. The JSON returned by the GET request was this:
{
"results": [
{
"id": 887029761,
"key": "Test property",
"value": "This is a test",
"createdAt": "2023-05-02T21:26:31.746Z",
"authorId": "5efea30ea115ac0bb540e9cb", <-- THIS SHOULD BE createdBy
"version": {
"createdAt": "2023-05-02T21:26:31.746Z",
"authorId": "5efea30ea115ac0bb540e9cb", <-- THIS SHOULD BE createdBy
"number": 1
}
}
],
"_links": {}
}
There’s errata in the documentation, as the name of object returned for the creator of the property was authorId, but the documentation says it should be createdBy. Oh well, at least that bit of information’s there instead of nothing.
That just leaves trying to find how to get the createdDate for the space. I’ve updated the thread topic to focus on that.
Thanks for the feedback here! We’ll get the documentation updated to reflect the authorId
, I apologize for the mistake here.
I’ll add createdDate
for a space as a valid gap in the V1 → V2 migration.
1 Like
Thanks @SimonKliewer
Also, if I’m being pedantic about errata in the documentation, the Create space property in space examples only shows the request body as requiring:
{"key": "<string>"}
But without supplying a value for that key, that request would be incomplete and would generate a 400 response “INVALID_REQUEST_BODY. value: may not be null”
The examples really should show the minimum for the request body to be valid, IE:
{"key": "<string>", "value": "<any>"}
1 Like