juliaguas17 / Hardcore-Memory-Game

3 stars 2 forks source link

Icon API to randomize the theme of images #9

Closed jengle-dev closed 1 year ago

jengle-dev commented 1 year ago

https://developer.iconfinder.com/reference/overview-1

jengle-dev commented 1 year ago

The Iconfinder API is an HTTP JSON API and allows you to programmatically access resources on the service, such as icons, icon sets, categories, styles, authors, etc. The API is accessible on the api.iconfinder.com domain and always used over HTTPS. It accepts form-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authorization, and verbs.

jengle-dev commented 1 year ago

example pulling category of pickles with 30 results but it looks like we can choose number pulled back but would not randomize because we would not have extra options.

GET https://iconfinder-api-auth.herokuapp.com/v4/icons/search?query=pickles&count=30

curl --request GET \ --url 'https://api.iconfinder.com/v4/iconsets?count=10' \ --header 'Authorization: Bearer X0vjEUN6KRlxbp2DoUkyHeM0VOmxY91rA6BbU5j3Xu6wDodwS0McmilLPBWDUcJ1' \ --header 'accept: application/json'

jengle-dev commented 1 year ago

Ally suggested we choose initial count of 8 images instead of Math.floor randomizing from a larger array pulled back from API. Add that as a nice-to-have.

jengle-dev commented 1 year ago

API key uC6CsrKOpLvqkHaklwGh6uV8LwfEqa5t4GsVnRYFpbGD5a58OzhIGQGQk86DMX1C Client ID U7WHdyA6jueqIJWOJH775Wqqn4ZlhybDLxZHvoTx9NJoMyQLNdbwXWy4vKi5IDqn schmobots.com

need to register new API key with our published site url

jengle-dev commented 1 year ago

going to try using https://www.pexels.com/api/documentation/

jengle-dev commented 1 year ago

Pexels requires .node and Ally suggested we not go there yet.

trying serpapi.com next

API Key requested and received: a4a6db4f2015502f33fd07a0dabf3c5c4f2804cceedd61c91db6f93d0cff030a

Image

jengle-dev commented 1 year ago

Going to try Flickr

Needs Authorization: OAuth is an open standard for access delegation, commonly used as a way for internet users to grant websites or applications access to their information on other websites but without giving them the passwords.

Matching Game Key: ab44015fa7a49dd092d72824c1d221fd

Secret: 72029c16a98c0dbd

jengle-dev commented 1 year ago

flickr.galleries.getPhotos

Image

Typical usage

#

https://live.staticflickr.com/{server-id}/{id}_{secret}_{size-suffix}.jpg

#

Unique URL format for 500px size

#

https://live.staticflickr.com/{server-id}/{id}_{secret}.jpg

jengle-dev commented 1 year ago

successfully able to receive JSON response from API and then generate the http.jpg url needed for the images.

jengle-dev commented 1 year ago

Flickr was used in script.js this is complete