Get content with url confluence REST API
Asked Answered
Y

1

9

Hi I have noticed several ways to get the content with the REST API. Although I was wondering if there is a way to get the content directly from the url without calling the space and title.

Meaning if I have http://localhost:8080/display/TST/myPage Instead of doing this

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

I can use the url on the rest api. Maybe something like this

curl -u admin:admin -X GET "http://localhost:8080/confluence/rest/api/content/display/TST/myPage" | python -mjson.tool

Is there a way to do this?

This is the documentation I have looked at

https://docs.atlassian.com/atlassian-confluence/REST/latest/#d3e865

Yancey answered 6/2, 2015 at 1:4 Comment(0)
S
4

Yes; immediately below the section you linked to, there is a description of the version of this request which takes an article ID: /rest/api/content/{id}. As long as you know the article ID, this is the easiest way.

Supplication answered 2/3, 2015 at 16:26 Comment(7)
How do I get the content ID for a specific wiki page?Acatalectic
Browse to Tools -> Page Info and you can read the ID out of the destination URL.Supplication
Ah, thanks. I already was on Page Info but didn't found it... I have not looked to the URL. :)Acatalectic
But this is not fetching attachments.Lampkin
@KeyurPatel - please ask that as a new question.Supplication
I am using /rest/api/content/{id} ,it doesn't return all content.any suggestion!Motherwell
Check the “expand” query parameter. But maybe this warrants its own question.Supplication

© 2022 - 2024 — McMap. All rights reserved.