I'm trying to make a GET call using flickr.photos.getInfo method from an app. Goal is to get info about a photo using it's id.
my method:
+(NSDictionary*)photoForId:(NSString *)photoID
{
NSLog(@"photo id = %@", photoID);
NSString *request=[NSString stringWithFormat:@"http://api.flickr.com/services/rest/flickr.photos.getInfo&photo_id=%@&format=json&nojsoncallback=1&extras=original_format,tags,description,geo,date_upload,owner_name&page=1&method=flickr.photos.search", photoID];
NSLog(@"output=%@",[self executeFlickrFetch:request]);
return [[[self executeFlickrFetch:request]valueForKey:@"photos.photo"]lastObject];
}
executeFlickrFetch method:
+ (NSDictionary *)executeFlickrFetch:(NSString *)query
{
query = [NSString stringWithFormat:@"%@&format=json&nojsoncallback=1&api_key=%@", query, FlickrAPIKey];
query = [query stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSStringFromSelector(_cmd), query);
NSData *jsonData = [[NSString stringWithContentsOfURL:[NSURL URLWithString:query] encoding:NSUTF8StringEncoding error:nil] dataUsingEncoding:NSUTF8StringEncoding];
NSError *error = nil;
NSDictionary *results = jsonData ? [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers|NSJSONReadingMutableLeaves error:&error] : nil;
return results;
}
Right now this call is returning null. I know execute fetch works because it is fetching photos by photographer, or place. Just need to figure out the photo id.
this is the correct request:
NSString *request=[NSString stringWithFormat:@"http://api.flickr.com/services/rest/?method=flickr.photos.getInfo&photo_id=%@&format=json&nojsoncallback=1&extras=original_format,tags,description,geo,date_upload,owner_name&page=1", photoID];