Search code examples
restcurlconfluenceconfluence-rest-api

Get content with url confluence REST API


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


Solution

  • 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.