jonnahmarie / Project-1-Basix

0 stars 1 forks source link

Kroger API Key #5

Open JadeP27 opened 3 years ago

JadeP27 commented 3 years ago

How do we get the API Key? What are the limitations? What do we request? What is the api response?

JadeP27 commented 3 years ago

Kroger API requires an individual to create an account which I have done. It also requires you to register your application to generate your OAuth2 client credentials. When making API requests that do not require customer consent, you can use the Client Credentials Grant Type to authenticate your OAuth2 application.

Once your application has been registered you make a test call using the instruction below which then authenticates your application and you receive an access token returned as a JSON response. The token response equates that the client credentials were registered.

TEST CALL curl -X POST \ 'https://api.kroger.com/v1/connect/oauth2/token' \ -H 'Content-Type: application/x-www-form-urlencoded' \ -H 'Authorization: Basic {{base64(CLIENT_ID:CLIENT_SECRET)}}' \ -d 'grant_type=client_credentials'

Ultimately the Kroger API will require usage of both Kroger's Location API and Kroger's Products API.

Kroger Location API Limit - 1600 calls per day Request & Response: location list - returns a list of locations matching a given criteria. chain list - returns a list of all chains owned by the Kroger Co. Pagination - Default response limit of ten results but can be extended with filter.limit which has a 200 maximum. Default mile radius is 10 miles but can be extended using filter.radiusInMiles.

Kroger Products API Limit - 10,000 calls per day Request & Response: product search - find products by passing a search term or product id price - includes both regular price and promo price for the item instore - determines if the item is sold in the store at the given location (NOT NECESSARILY IN STOCK!!!) curbside - the item is available for curbside pickup from the given location Pagination - Default 10 results per page using filter.limit will set the amount of products returned and using filter.start will set a number of results to skip in the response.

Screen Shot 2020-11-13 at 6 24 05 PM Screen Shot 2020-11-13 at 6 24 52 PM