Get content with url confluence REST API

angry_einstein picture angry_einstein · Feb 6, 2015 · Viewed 9.7k times · Source

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

Answer

James McLeod picture James McLeod · Mar 2, 2015

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.