我收到未经授权的 BBVA APIData 错误。我在 Xcode 中用作 Objective-C 来获取数据的代码是这样的:
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
[request setURL:[NSURL URLWithString:@"https://api.bbva.com/apidatos/zones/cards_cube.json?date_min=201301&date_max=201307&group_by=week"]];
[request setHTTPMethod:@"GET"];
[request setValue:@"application/json;charset=UTF-8" forHTTPHeaderField:@"Authorization: Y2hvbWFsaS1hcHA6MGM2ZTljNjgxODNiZmUzOWY2OGJiYjY1NjZlZmU4ZTE3MzI0NTcyOQ=="];
NSURLResponse *response;
NSData *GETReply = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:nil];
NSString *theReply = [[NSString alloc] initWithBytes:[GETReply bytes] length:[GETReply length] encoding: NSASCIIStringEncoding];
NSLog(@"Reply: %@", theReply);
这是我使用的文档:https ://developer.bbva.com/api/api-datathon/section/api-reference