Hi all. I have been following the excellent article on Sitepoint about using the Flickr API by James Hibbard @James_Hibbard . However, I am using Axios instead of jQuery .ajax as well as Webpack and React.
I keep on getting XMLHttpRequest cannot load errors. This is when using
https://api.flickr.com/services/feeds/photos_public.gne?format=json
even though my understanding is that this should work as in the article. I can only assume this is due to jsonp, CORS issues?? I know that Axios doesn’t support JSONP so wonder if this makes a difference? Or webpack dev server?
However, when playing around with flickr.photos.search in the format
I am able to access the data, but it is in a form that gives limited data after which I would have to make several other calls in order to determine author names, descriptions etc.
Any way I can make a simple call using the first API endpoint without having to resort to flickr.photos.search?
Any hints or tips would be welcomed.
Thanks
Update:
According to this https://github.com/github/fetch/issues/280, it seems that fetch and XMLHttpRequest will not work as Flickr does not supports CORS headers. Also, elsehwere I found that that Axios doesn’t support JSONP (if that affects me in using Flickr API?).
I am relatively novice to CORS etc but have been able to deal with it in the past with better API documentation and endpoints. Should I cut my losses and just go with jQuery? I find it odd that Flickr is this hard to use and I am wondering if it is because of Webpack dev server? I’ve tried adding headers to webpack dev server but to no avail.
I have also used the allow control allow origin extension on chrome just now and it sort of worked - but all the json data came out as one large string!?
Not sure what else to do now except use jQuery…