Confluence REST Remote API Capabilities

Jackie Wilson May 23, 2014

I have been tasked to develop an integration with Confluence. The current version of the Confluence installation is 5.2.5 but there are plans to upgrade to the latest version in the next 6-8 months. The online documentation indicates that all remote APIs sans REST have been deprecated as of version 5.5. In order to meet the requirements of the integration, I will need to perform various searches using the REST API. The documentation for the REST API and specifically the search functionality is sparse. Given that, can anyone provide insight in the following areas?

1. Is wildcard search available in 5.5+? (I know it is not in 5.2.5)

2. Can the REST API be used to query for a date range (i.e. created date or modified date)?

3. Is it possible to search for a page's creator and/or modifier?

4. Is it possible to search for a label? (This works in 5.2.5 using the "search" function but there is no "search" function in the latest REST API)

5. How are complex searches formatted in the REST API? E.g. this AND ((this OR that) AND (this OR that))?

6. Are XML schemas (xsd) available that describe the REST request and response?

7. Does a REST extension exist that I could leverage or perhaps purchase that extends the REST search functionality?

Any help is greatly appreciated. Thanks.

4 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

3 votes
Answer accepted
Jackie Wilson August 6, 2014

I have learned a few things, mostly by trial and error, and I'll share those in case someone else must use the REST API. Note that I abandoned the REST API for searching and went with SOAP. In my opinion, the REST API is just not ready yet when it comes to searching. In fact, there are some rather serious limitations with Confluence searching in general.

1. The REST documenation is very limited and what is there is just flat out wrong in some cases. This has been extremely frustrating. Your best bet for getting useful information is to either search the Atlassian Answers site or read the comments at the bottom of online documentation. For some reason, Atlassian personnel will sometimes post good information in the comments section but not update the documentation itself.

2. It is possible to query on a date range using the normal Confluence search syntax. For example, created:[20140101 TO 20140707]. In fact, date range searches are all that's available. An exact date search must be formatted as a range as well. Any special characters must be url encoded.

3. It is currently NOT possible to search for a page's creator and/or modifier via the Remote APIs. See ticket CONF-32339. Apparently this search was available in the past but was removed.

4. Is is possible to search by label, at least in the REST prototype API. There is no longer a search function in the latest REST API. In the prototype API the URI looks like this:

https://mydomain.com/confluence/rest/prototype/latest/search?type=page&label=global:test-1

Note the "global" prefix in the label name. This is required or the search will fail. I don't know if personal prefixes work or not.

5. Complex searches are available in the REST API. As previously noted, the parens and/or spaces have to be url encoded per normal practice.

6. There is a WADL available for the REST API. It's not obvious how to get to it though. It's certainly not in the documenation. The latest WADL can be found at:

https://confluence.atlassian.com/rest/api/latest/application.wadl

Make sure you get the correct version for your Confluence installation. You can also get the WADL from your local Confluence installation.

https://mydomain.com/confluence/rest/prototype/latest/application.wadl

7. I was not able to find a plugin that would extend/enhance the Remote APIs search functionality. If you're a vendor out there and you see this then let me know. I'd like to talk to you.

One more thing, Atlassian support will not answer questions about how the Remote APIs actually work. I was told that support is only for incident reporting so unless you find a bug you're on your own with the Remote APIs.

Davin Studer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 6, 2014

I agree with point 1 a thousand fold.

1 vote
discountrobot
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 23, 2014

The current REST documentation is either sparse or not existing.

I'd suggest that you setup a test instance with 5.5 and install the REST Browser Work out if the requirements you seek are implemented.

I can already tell you that searching with logical operators is definitely possible as the searchresult page and the livesearch macro uses the searchv3 API.

yourserver.com/rest/searchv3/1.0/search

Some of the stuff you're requesting might not be available in the immidate API, but the REST API is extenable if you write a java plugin for it.

TL;DR Anything is possible at zombocom

Jackie Wilson May 26, 2014

Thanks bot. It's somewhat puzzling to me that there is not more information about the REST API available (current and prototype). Except for basic operations (like returning page or space info) there is little to go on. On the surface it appears that very few have attempted to search using the REST API but that seems odd given the amount of time that it has been available. Most of what I've learned was from trial and error tests and by piecing together information from posts like yours.

In any case, I've already made plans to get 5.5 installed in our dev environment so that I can start chipping away. I also found the search operation you noted in the public Atlassian REST Browser but the search operation is noticebly absent from the lastest REST API documentation. It appears that I'll need to write an extension to get the search capability I need. I was hopeful that someone else had already done this but I haven't found it yet.

Like EvrazTehnika likes this
0 votes
Fred Bunting January 6, 2015

Another point about date ranges is that you should think of the start-date as "inclusive" and the end-date as "exclusive."

This sounds counter-intuitive, but it is an artifact of how dates are represented internally.  (A date is a short hand for midnight at the start of that day, regardless of whether the date is used as that start- or end-date of a range.)

I added a separate post about this, as I'd like others to confirm.  See: https://answers.atlassian.com/questions/11972245

 

0 votes
allen zhang December 1, 2014

Hi, All;

Regarding the question as below:

2. Can the REST API be used to query for a date range (i.e. created date or modified date)?

--------------

Does the latest REST API support the query for a data range? I mean not use the normal Confluence search syntax.

 

Jackie Wilson December 2, 2014

It is possible to search by date range using the Prototype REST API. See my accepted answer above. It may not be possible using the latest version of the REST API since the search function was removed. The next Confluence release is supposed to have at least partial support for the new Confluence query language Hopefully that will be the standard going forward.

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events