Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
657 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 Answer

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...