Request Photo Data
API Request Using A Single Filter
This API request retrieves all photos from the Acne Treatments
category (uKuGhXS
) that were taken in the last 30 days, sorted from oldest to newest
import requests
API_KEY = "YOUR_SHELFGRAM_API_KEY"
ENDPOINT = "https://api.shelfgram.com/api/2/query/photos"
payload = {
"api_key": API_KEY,
"filters": [
{
"categories": {"match": "uKuGhXS"},
"dates": {"match": "l30"}
}
],
"sort": "earliest_taken"
}
response = requests.post(ENDPOINT, json=payload)
API Request Using Multiple Filters
This API request retrieves all photos that are either
Taken in Toronto (
51DobYI
); ORNot taken in Toronto, but contain the text
"Toronto"
import requests
API_KEY = "YOUR_SHELFGRAM_API_KEY"
ENDPOINT = "https://api.shelfgram.com/api/2/query/photos"
payload = {
"api_key": API_KEY,
"filters": [
{
"cities": {"match": "51DobYI"}
},
{
"cities": {"exclude": "51DobYI"},
"text": {"match": "Toronto"}
}
]
}
response = requests.post(ENDPOINT, json=payload)