是什么导致 Klout API 出现 403 错误?

What causes a 403 error with the Klout API?

我有一个 Klout 的 API 密钥,我编写了一个每天执行 6 个调用的服务来跟踪 6 个社交媒体帐户的性能。这项服务上周突然停止工作。

这是我帐户日志的概览:

我混淆了我的密钥,但如您所见,我的入门计划的状态是活动的;但是:错误显示 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)

它说 redacted 的地方有一个 Twitter 句柄和一个 API 密钥。

构造器及相关方法为:

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();
}

我唯一能想到的是,Klout 停用了我的帐户,但当我登录 Klout 时,这并没有反映在我的帐户面板中,但也许我忽略了我的代码中一些非常简单的东西。指标还显示,我每天拨打的电话从未超过 6 个,这远低于关键速率限制。

我的推文收到了回复:

推文指的是这个 blog item:

I’m writing to let you know that Lithium has made the decision to sunset the Klout service, effective May 25, 2018.

简而言之:我使用的服务不再可用,因为Klout将被停用。