Hi,
We went with REST Confluence recently. No matter what I do as a respose I get HTML, but no Jason.
thank you, Lena
Community moderators have prevented the ability to post new answers.
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Just tried it - the same answer. What do you mean by "use some rest client"?
thanks a lot, Lena
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.