Searching for Page by Content

Harsha Vardhini R January 31, 2024

I need to use a search API for retrieving the page by using text search.

There is a v2 rest API to get Page by title (https://developer.atlassian.com/cloud/confluence/rest/v2/api-group-page/#api-pages-get). But this does not satisfy my use case. 

It seems there are 2 v1 rest APIs with the same use case. Can anyone please explain me which is preferable. And are these safe to use or it may be soon deprecated ?

And I need to construct the download, redirect and copy url from these result. Please help me on a workaround for this scenarios.

 

 

1 answer

1 accepted

1 vote
Answer accepted
Aron Gombas _Midori_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 1, 2024

The best way to search for Confluence content using various fields, operators is the CQL query language.

This is the end-point you should use to run CQL searches using the REST API: https://developer.atlassian.com/cloud/confluence/rest/v1/api-group-content/#api-wiki-rest-api-content-search-get

For example, this search will find you all pages with a title that contains "Data":

https://YOUR_SITE_NAME_HERE.atlassian.net/wiki/rest/api/content/search?cql=title~Data

 

Harsha Vardhini R February 1, 2024

@Aron Gombas _Midori_ Appreciate your reply.  But I need to do a search across keyword and get their redirect url, download url and copy content. Is there any way to get those details on the API you have suggested. 

Thanks in Advance

Aron Gombas _Midori_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 1, 2024

Well, the response returned by the `/content/search` REST API end-point does include content IDs!

Using the IDs you can build all the URLs you mentioned.

Harsha Vardhini R February 1, 2024

I got the html content from the search API using the query param expand=content.body.storage which can be used for copy.

I constructed the redirect url, I have appended the base in _links and also webui or should I use the field url or tinyui instead of webui.

I constructed the download url by appending the base in _links and exportword?pageId={page_id}

Is this fine as the base in _links is https://{domain}.atlassian.net/wiki

Is it safe to use this url /wiki/rest/api/search as this is not mentioned in Deprecation note ?

@Aron Gombas _Midori_ Thanks for your continuous assistance

Like Aron Gombas _Midori_ likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events