Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
658 views
in Technique[技术] by (71.8m points)

jira - How to create a Child Page via Confluence REST API with only Parent Page Title

I'm trying to use the "Send web request" option in JIRA's Project Automation to generate a Confluence Page via REST API.

I'm able to use the following code but I don't know how to force Confluence to create a child page under a Parent Page for which I will only have the Parent Page Title available.

Since I've already automated the process of generating the parent pages, and the child page is to be generated based on a certain status, I will not know the Parent Page ID.

Can someone let me know how I can get the Parent Page ID from the Parent Page Title or generate the child page with just the Page Title?

The Custom Data looks like this:

{
"title": "Child Page",
"type": "page",
"space": { "key": "ABC" },
"status": "current",
"body": {"storage": {"value": "Sample Text", "representation": "storage"}}
}

P.S. I'm not a coder, so I would love some tips too.

question from:https://stackoverflow.com/questions/66045698/how-to-create-a-child-page-via-confluence-rest-api-with-only-parent-page-title

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Here the way how you can found Page ID :

https://developer.atlassian.com/server/confluence/confluence-rest-api-examples/

section Find a page by title and space key

curl -u admin:admin -X GET "http://localhost:8080/confluence/rest/api/content?title=myPage%20Title
&spaceKey=TST&expand=history" | python -mjson.tool

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...