在Twitter API资源URL格式中,结肠意味着什么



转发的Twitter API显示为资源URL:

http://api.twitter.com/1/statuses/retweet/:id.format

然后说" ID"是必需的参数。

因此,我认为以下aifnetworking呼叫将起作用。我设置的位置:POSTPATH:@" 1.1/status/retweet.json"

和参数:nsmutabledictionary *params = [nsmutabledictionary dictionarywithdictionary:@{@{@" id":tweetId}];

整个通话看起来像:

- (void)postARetweet:(NSString*)tweetID success:(void (^)(AFHTTPRequestOperation *operation, id response))success failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure {
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithDictionary:@{@"id": tweetID}];
self postPath:@"1.1/statuses/retweet.json" parameters:params success:success failure:failure];}

但是我有一个404错误告诉我页面不存在。经过大量反复试验,我强迫Path Path为

postpath:@"1.1/statuses/retweet/@"some_tweet_number".json"

那起作用。

因此,我不明白为什么" ID"密钥的" params"条目不会像原本应该的那样将其附加到原始的PotsPath上。我唯一的想法是,Postpath也许必须包括" ID",另外还必须将相同的" ID"作为参数。

那么:ID在资源URL中意味着什么?为什么API要求Tweet的" ID"成为URL路径的一部分,而作为参数的传递?似乎多余。

谢谢

-malena

,假设您想转发使用123456 ID的推文。该数字是:id

现在,假设您希望响应在XML中。那就是format

所以你可以拥有

https://api.twitter.com/1.1/statuses/retweet/123456.xml

https://api.twitter.com/1.1/statuses/retweet/123456.json

请注意,API已更改为1.1版。您应该在https://api.twitter.com/1.1/

上仔细阅读文档

有关转发文档,请参见https://dev.twitter.com/docs/api/1.1/post/statuses/retweet/:id

最新更新