The official Apache Camel Twitter Component documentation似乎没有提及喜欢或喜欢推文。
它使用Twitter4j,所以我认为它应该是可能的。
到目前为止我所拥有的:
//like a tweet
from("direct:likeTweet")
.setHeader(Exchange.HTTP_METHOD, constant("POST"))
.setHeader(Exchange.CONTENT_TYPE, constant("application/json"))
.recipientList(simple("twitter://favorites/create.json?id=" +
"${body.tweetId}" +
"&consumerKey=" + consumerKey +
"&consumerSecret=" + consumerSecret +
"&accessToken=" + accessToken +
"&accessTokenSecret=" + accessTokenSecret))
.log("Response: ${body}");
这构建了以下端点:
twitter://favorites/create.json?accessToken={redacted}&accessTokenSecret={redacted}&consumerKey={redacted}&consumerSecret={redacted}&id={redacted}
这会产生以下错误:
org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: ...
There are 1 parameters that couldn't be set on the endpoint. Check the uri if the parameters are spelt correctly and that they are properties of the endpoint. Unknown parameters=[{id={redacted}}]
错误很明显,但不幸的是我无法解决, 因为文档没有提到这个功能(据我所知)。
谢谢!