Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

API to GET the confluence page content via page name?

I want to CURL an API to get the contents of a confluence page using the pagename. I have an API to get the page details via pageid.

curl -u <userid>:<password> -X GET confluence-url/confluence/rest/prototype/1/content/<pageid>

But i want an API to get the same via pagename. Is that possible?

like image 669
david419 Avatar asked Oct 20 '25 12:10

david419


1 Answers

Check out confluence rest api examples

Maybe you are looking for something like this:

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

EDIT:

"title" is the name of the page

"spaceKey" is the key for your space. Confluence is organized in spaces. You can read more about spaces here

Expansions are documented here. expand specifies which elements should be expanded in the response. as stated in the documentation

If your GET returns a list of results and you don't choose to expand anything, the response is terse, displaying only a basic representation of the resource. It will, however, include a list of the expandable items for the resource.

So if you want the response to include the content of your page, then you need to expand "body.storage". If you want to expand multiple things you can seperate them with comma.

like image 116
Ørjan Johansen Avatar answered Oct 23 '25 08:10

Ørjan Johansen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!