I'm attempting to use the last.fm API (http://www.last.fm/api/mobileauth) restful using Android Studio and the Loopj Android AsyncHttpClient plugin (http://loopj.com/android-async-http/) but I keep getting a 404 error, but can't see why. Code below. What am I doing wrong? Thanks.
RequestParams params = new RequestParams();
params.put("username", "myusername");
params.put("password", "mypassword");
params.put("api_key", "myapikey");
params.put("api_sig", "myapisecret");
LastFMRestClient.post("http://ws.audioscrobbler.com/2.0/", params,
new AsyncHttpResponseHandler() {
@Override
public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
Log.e("MUSIC SERVICE", "Success");
}
@Override
public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) {
String msg = "Object *" + statusCode + "*" + responseBody;
Log.e("MUSIC SERVICE", "Failed: " + msg);
// Outputs: Failed: Object *404*[B@17f1042c
}
public void onFinish() {
Log.e("MUSIC SERVICE", "Finished");
}
}
);