【发布时间】:2014-02-06 18:10:41
【问题描述】:
用于转推的 Twitter API 显示为以下资源 URL:
http://api.twitter.com/1/statuses/retweet/:id.format
然后它说“id”是必需的参数。
因此,基于此,我认为以下 AIFNetworking 调用会起作用。我设置的地方: postPath:@"1.1/statuses/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 错误,告诉我该页面不存在。经过多次试验和错误,我强制 postPath 是
postpath:@"1.1/statuses/retweet/@"some_tweet_number".json"
这很奏效。
所以我不明白为什么“id”键的“params”条目没有按照它应该的方式附加到原始 postpath 中。我唯一的想法是,也许 postpath 必须包含“id”以及相同的“id”作为参数。
那么资源 URL 中的 :id 是什么意思? 为什么 API 需要将推文的“id”作为 URL 路径的一部分并作为参数传递?似乎是多余的。
谢谢
-玛莲娜
【问题讨论】: