【发布时间】:2015-10-17 03:00:22
【问题描述】:
首先,我使用我的有效访问令牌向 Uber 沙箱创建了一个 POST /v1/requests,然后 Uber 将 202 OK 返回给我,这意味着请求成功。
然后我发出请求,试图用PUT /v1/sandbox/requests/{request_id} 操纵请求的状态,但我只能得到405 代码。
所有的状态我都试过了,结果都是405,请帮忙看看有没有可能的原因。谢谢。
我通过以下方式请求更改状态 (PUT /v1/sandbox/requests/{request_id}):
NSString *url = [NSString stringWithFormat:@"%@/requests/%@", sandBoxURL, requestId];
NSDictionary *params = @{@"status": @"processing"};
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:url]];
[request addValue:@"application/json; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
[request addValue:[NSString stringWithFormat:@"Bearer %@", _accessToken] forHTTPHeaderField:@"Authorization"];
NSError *error = nil;
request.HTTPMethod = @"PUT";
request.HTTPBody = [NSJSONSerialization dataWithJSONObject:params options:0 error:&error];
【问题讨论】: