It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How can we see jira issue macro in API called confluence page

I am following confluence rest api and trying to get confluence page content which contains Jira issue macro. The problem lies that the other content is normally loaded while the Jira issue macro are not being loaded?? Is there any another API I need to  use to get the confluence page along with it's Jira Issue macro??? Can anyone suggest some solution related to current situation. The below image represents the response I get while calling the confluence page.

I am using this confluence rest api as reference:-

http://localhost:8080/confluence/rest/api/content/search?cql=space=DEV%20AND%20label=docs&expand=body.view.value

 

Screenshot from 2020-03-12 09-55-24.png

1 answer

0 votes
Dario B Atlassian Team Mar 18, 2020

Hello @Rashida_Bharmal ,

Welcome to the Atlassian Community!

If you want to see the page content then, instead of sending a request to the search (GET /rest/api/content/search) endpoint, you should use one of the below adding the expand=body.storage property:

 

 

An example is available in the Confluence REST API examples page:

Read content, and expand the body

This example shows how you can read content of a page with the body expanded.

curl -u admin:admin http://localhost:8080/confluence/rest/api/content/3965072?expand=body.storage |python -mjson.tool

Example result:


{
    "_expandable": {
        "ancestors": "",
        "children": "",
        "container": "",
        "history": "/rest/api/content/3965072/history",
        "metadata": "",
        "space": "/rest/api/space/TST",
        "version": ""
    },
    "_links": {
        "base": "http://localhost:8080/confluence",
        "collection": "/rest/api/contents",
        "self": "http://localhost:8080/confluence/rest/api/content/3965072",
        "tinyui": "/x/kIA8",
        "webui": "/display/TST/Test+Page"
    },
    "body": {​_
        "editor": {
            "_expandable": {
                "content": "/rest/api/content/3965072"
            },
            "representation": "editor"
        },
        "export_view": {
            "_expandable": {
                "content": "/rest/api/content/3965072"
            },
            "representation": "export_view"
        },
        "storage": {
            "_expandable": {
                "content": "/rest/api/content/3965072"
            },
            "representation": "storage",
            "value": "<p>blah blah</p>"
        },
        "view": {
            "_expandable": {
                "content": "/rest/api/content/3965072"
            },
            "representation": "view"
        }
    },
    "id": "3965072",
    "title": "Test Page",
    "type": "page"
}

 

I hope this helps.

 

Cheers,
Dario

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Confluence

Lessons and Learnings: Six Months of Working Remote [Discussion]

Hey there, folks! For most of us, the past six months- yes, you read that right- have been a journey. More people than ever before have pivoted to working remotely, and navigating being on-scre...

3,138 views 4 6
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you