0

嗨,我对 Scribe 还是很陌生。我从以下内容中了解到,它正在请求发布状态。

private static final String PROTECTED_RESOURCE_URL = "https://api.twitter.com/1/statuses/update.json";

这是发布 URL,这就是请求的发出方式。

OAuthRequest request = new OAuthRequest(Verb.POST, PROTECTED_RESOURCE_URL);
        request.addBodyParameter("status", textArea1.getText());
        service.signRequest(accessToken, request);
        Response response = request.send();

我知道如果我想获取用户的推文,我需要用户的 url。例如,

private static final String PROTECTED_RESOURCE_URL2 = "http://api.twitter.com/1/statuses/user_timeline.json?screen_name=twitterusename";

我如何继续提出请求并检索与此帐户关联的推文?

4

1 回答 1

1

将示例中发出受保护资源请求的行替换为:

OAuthRequest request = new OAuthRequest(Verb.GET,"http://api.twitter.com/1/statuses/user_timeline.json");
service.signRequest(accessToken, request);
Response response = request.send();
System.out.println("Got it! Lets see what we found...");
System.out.println();
System.out.println(response.getBody());
于 2012-03-29T00:39:35.503 回答