Hello!
I'm just starting to try SlimTimer API from Java and I get
Authentication failed XML response. This is my code:
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpPost post = new HttpPost("
http://slimtimer.com/users/token");
StringEntity xml = new StringEntity("<?xml version=\"1.0\" encoding=
\"UTF-8\"?><request><user><email>jms...@XXX.com</email><password>XXX</
password></user><api-key>" +
API_KEY + "</api-key></request>");
xml.setContentType("application/xml");
post.setEntity(xml);
HttpResponse response = httpClient.execute(post);
HttpEntity entity = response.getEntity();
if (entity != null) {
System.out.println(entity.getContentType().getValue());
System.out.println(EntityUtils.toString(entity));
}
This is the output:
application/xml; charset=utf-8
<?xml version="1.0" encoding="UTF-8"?>
<errors>
<error>Authentication failed</error>
</errors>
What I'm doing wrong?