You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
I'm trying to move pages programatically from one place in the hierarchy to another. Some claim this can't be done and others claim to have done it with something like this;
url = "https://foobar.atlassian.net/wiki/rest/api/content/1147126"
payload = json.dumps(
{"id":1147126,
"type":"page",
"title":"My page 8",
"ancestors":[{"id":1378762}],
"space":{"key":"CD"},
"version":{"number":4}})
headers = {
"Accept": "application/json",
"Content-Type": "application/json"
}
r = requests.request("PUT", url, data=payload, headers=headers, auth=auth)
print(r.ok , r.status_code , r.reason, r.url)
jl = json.loads(r.text)
jl
When I run this, I get:
True 200 OK https://foobar.atlassian.net/wiki/rest/api/content/1147126
But, in fact, the page is still in the same place when I refresh.
Can anybody help?
After expending several hours with experiments, I got it to work, sort of.
The title has to be changed.
payload = json.dumps(
{"id":1147126,
"type":"page",
"title": "new page 8",
"ancestors":[{"id":1378762}],
"space":{"key":"CD"},
"version":{"number":4}})
Then the version number can be bumped, and the title can be changed back.
payload = json.dumps(
{"id":1147126,
"type":"page",
"title":"My page 8",
"ancestors":[{"id":1378762}],
"space":{"key":"CD"},
"version":{"number":5}})
It's not how I would have designed it.
I remember - the version need to be increased manually - I expected this to be done automatically like when you update a page with the browser ...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The version must be increased TWICE.
In my one week's experience with the REST API, it appears to me that it is ALWAYS necessary to get the page, extract the version, and increase the version in any update.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear rdwyer@metabolon.com ,
at first view the request seems fine. Content update with a new ancestors id. Consider following:
So long
Thomas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Folks, I was able to replicate the issue and created a bug: https://jira.atlassian.com/browse/CONFCLOUD-67046
Meanwhile I would recommend you to try using the workaround of changing page title
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.