I have an API key for Klout, and I wrote a service that performs 6 calls a day to track the performance of 6 social media accounts. This service suddenly stopped working last week.
This is an overview of the logs on my account:
I obfuscated my key, but as you can see, the status of my Starter Plan is active; however: the error says 403 inactive Plan (Proxy):
java.io.IOException: Server returned HTTP response code: 403 for URL: http://api.klout.com/v2/identity.json/twitter?screenName=redacted&key=redacted
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1876)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
at com.directmediatips.klout.KloutRequests.sendRequest(KloutRequests.java:66)
at com.directmediatips.klout.Klout.getUserIdFromTwitterScreenName(Klout.java:119)
at com.directmediatips.klout.Klout.main(Klout.java:126)
Where it says redacted
, there was a Twitter handle and an API key.
The constructor and relevant methods are:
private String apiKey;
public Klout(String apiKey) {
this.apiKey = apiKey;
}
public UserId getUserIdFromTwitterScreenName(String screenName) throws IOException {
return new UserId(new JSONObject(KloutRequests.sendRequest(String.format(
KloutRequests.ID_FROM_TWITTER_SCREENNAME, screenName, apiKey))));
}
public static String sendRequest(String request) throws IOException {
URL url = new URL(request);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setUseCaches(false);
BufferedReader in = new BufferedReader(
new InputStreamReader(connection.getInputStream()));
String line;
StringBuilder response = new StringBuilder();
while ((line = in.readLine()) != null) {
response.append(line);
}
in.close();
return response.toString();
}
The only thing I can think of, is that Klout inactivated my account, but that isn't reflected in my account panel when I log into Klout, but maybe I'm overlooking something very simple in my code. The metrics also show that I never did more than 6 calls a day, which is way below the key rate limits.
I received an answer to my Tweet:
The Tweet refers to this blog item:
I’m writing to let you know that Lithium has made the decision to sunset the Klout service, effective May 25, 2018.
In short: the service I used is no longer available because Klout will be discontinued.