API Documentation
The Grocerybear basic API is extremely easy to use. As we continue to enhance our offering we will add additional premium endpoints. For the time being, there is only one endpoint available to users:
https://grocerybear.com/getitems
.
The /getitems
endpoint lets you query our rich database of grocery prices and pull prices for eggs
, milk
, bread
, orange juice (oj)
, rice
, steak
, or butter
from our selected cities:
[Full city name in brackets; use abbreviation in API call]
all [returns all cities]
Boise
DC [Washington DC]
Honolulu
Houston
LA [Los Angeles]
LV [Las Vegas]
Phoenix
Portland
Seattle
SF [San Francisco]
We are actively adding new cities and countries.
Also, you can specify the number of days (num_days
) you wish to return. This is an integer looking back from today. For example, if you pass num_days: 5
you will return the last five days of the product you have selected. If you set num_days
to 0
we will return you all the data we have available for the given city and product combination.
Here is a sample API call:
curl -H "api-key: your-api-key" \
-H "Content-Type: application/json" \
-X POST \
-d '{"city":"Boise", "product":"eggs", "num_days": 7}' \
https://grocerybear.com/getitems
Note that this API requires authentification. The api-key
which was emailed to you after registration should be inserted into the above curl
command instead of 'your-api-key'
. For example if your api-key
is 123ABC
and you would like to query New York
for the last 10
days of bread
prices you would submit the following request:
curl -H "api-key: 123ABC" \
-H "Content-Type: application/json" \
-X POST \
-d '{"city":"LA", "product":"bread", "num_days": 10}' \
https://grocerybear.com/getitems
The response payload is returned in standard JSON as shown below. Note that when relevant the product price has been converted to USD using open exchange rates. Also, note that the date format is yyyy-mm-dd
.
[
{
"city": "LA",
"date": "2020-02-26",
"price": 1.99,
"title": "Signature Kitchens 100% Whole Wheat Bread - 22 Oz"
},
{
"city": "LA",
"date": "2020-02-27",
"price": 1.99,
"title": "Signature Kitchens 100% Whole Wheat Bread - 22 Oz"
}
]
If you have any questions about the API please, contact us! We'd love to hear from you.