Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flickr API: API key keeps getting invalid?

I’ve a Flickr which I’m using to upload pictures from my phone and all images are public. On my blog I want to retrieve all the images to show and for that I’ve first tried to create an application to get my API key. I’m using the Flickr API flickr.people.getPublicPhotos. This API service is said to not require authentication and putting it all together I end up with this call:

http://api.flickr.com/services/rest/?method=flickr.people.getPublicPhotos&api_key=fc94274cd0335f3c171fe22c8490b7d9&user_id=5545356%40N04&extras=description%2Cdate_upload%2Cdate_taken%2Cowner_name%2Coriginal_format%2Ctags%2C+o_dims%2C+views%2C+media%2C+path_alias%2C+url_sq%2C+url_t%2C+url_s%2C+url_q%2C+url_m%2C+url_n%2C+url_z%2C+url_c%2C+url_l%2C+url_o&per_page=40&format=php_serial&api_sig=0c48e2b6b6d9a03521e5ca86a15cf471

The problem is that every around 10 hours I fails and returns the error message a:3:{s:4:"stat";s:4:"fail";s:4:"code";i:100;s:7:"message";s:31:"Invalid API Key (Key not found)";}

I tried to create the API call when logged in to Flickr and also with not logging in and in both cases I get the error message. It’s like the API key expires or stops working. Have a missed something on Flickr about the API key or what could cause this? It is really frustrating to renew the URL twice at day.

Thank you

Sincere
- Mestika

like image 674
Emil Devantie Brockdorff Avatar asked May 18 '12 17:05

Emil Devantie Brockdorff


3 Answers

If I read the docs correctly, the &api_sig query string parameter is constructed using an authentication token, one that eventually expires. Remove that parameter (= do not sign your API request) and I think you'll be OK.

like image 68
David Gorsline Avatar answered Oct 23 '22 18:10

David Gorsline


Mestika's comment seems correct. I was getting the same problem when using the API explorer. If you use your accounts API, or go in and create a new app, then use the API given for that, then the key doesn't change every few hours.

The url to request a key is: http://www.flickr.com/services/apps/create/apply

like image 38
JayCrossler Avatar answered Oct 23 '22 17:10

JayCrossler


I got the same problem.

This is how i solved it:

  • removed the auth_token and the api_sig parameters
  • replaced the api_key value with an app key

Hope this helps.

like image 1
Luis Sandoval Avatar answered Oct 23 '22 18:10

Luis Sandoval