Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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

Rashida Bharmal March 12, 2020

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
Atlassian Team members are employees working across the company in a wide variety of roles.
March 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
AUG Leaders

Atlassian Community Events