I am getting a error that I do not understand. It looks like credentials are accepted. Here is my code.
public static void main(String[] args) throws Exception
{
// GET section
DefaultHttpClient httpclient = new DefaultHttpClient();
CredentialsProvider credentials = new BasicCredentialsProvider();
credentials.setCredentials(
new AuthScope(“<wiki-mine.com>”,<port>, “<realm>"),
new UsernamePasswordCredentials(“<user>", “<password>"));
HttpGet req = new HttpGet(“https://<wiki-mine.com>:<port>:8443/conflunce/rest/api/content/?title=Test+Page&spaceKey=~<user>");
req.addHeader("accept", "application/json");
req.setHeader("Content-Type", "application/json");
final HttpResponse response = httpclient.execute(req);
final int statusCode = response.getStatusLine().getStatusCode();
if (statusCode != 200) {
System.out.println("Request has failed, status code: " + statusCode);
System.exit(-1);
} else {
final InputStream content = response.getEntity().getContent();
System.out.println(IOUtils.toString(content));
IOUtils.closeQuietly(content);
}
This is the output:
{"errorMessage":"You are not logged in. <a href=\"/login.action\">Log in<\/a> here and try again.”}
Should this return the page?
thanks