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

Confluence Json respone

Lena Gurevich March 13, 2017

Hi,

We went with REST Confluence recently. No matter what I do as a respose I get HTML, but no Jason.

thank you, Lena

5 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Lena Gurevich March 14, 2017

Just tried it. The same http answer. What do you mean by "use some rest client", I am the first REST client.

thanks a lot, Lena

Andreas Purde
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.
April 17, 2017

Dear Lena,

I know that Confluence returns HTML in case you have a malformed REST call or run in error with a correct call. I would suggest to try your call first using curl or something similar.

Andreas

0 votes
Lena Gurevich March 14, 2017

Just tried it - the same answer. What do you mean by "use some rest client"?

 

thanks a lot, Lena

Panos
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.
March 14, 2017

You wanna talk "REST", there are libraries that help you do that and avoid common pitfalls such as you didn't close streams in the snippet. AsyncHttpClient is one of them. Again, the server needs to talk json, to me it seems that server talks html/text.

0 votes
Panos
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.
March 14, 2017

It would be better if you use some rest client, it would make your life easier. Much easier. Anyway, your 

connection.setRequestProperty("Content-Type", "application/json");

is declaring that you will send json. Not what you will receive. Change the content-type to "Accept" but it won't help you if the server doesnt send back json. 

0 votes
Lena Gurevich March 14, 2017

Panos, I do appreciate your answer.I've written a Confluence crawler based on rpcxml three years ago and it worked fine. Now the Confluence server is RESR and I dont'd have an admin rights to it. Also, all processed docs from Confluence are to be placed into solr. So I am a Java client. Instaed of Json I am getting http. Here is my code:

              try {

                     connection.setRequestProperty("Content-Type", "application/json");
                    InputStream in = connection.getInputStream();
                    new InputStreamReader(connection.getInputStream());                        
                    BufferedReader r = new BufferedReader(new InputStreamReader(in));
                    String line;
                    while (true) {
                       line = r.readLine();
                       if (line== null) {
                           break;
 
                       }
                   }
                    logger.info("Number of Processed sites = "+ totalProcessedNumber);

...

thanks a lot, Lena
 

 

 

 

0 votes
Panos
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.
March 13, 2017

You need to provide some example code as well as more information. Are you poking custom resources? Are you poking confluence's resources? Is it javascript? java?

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