Setup Summary & API Docs
The TL;DR version
Authorization Quickstart
import requests
# Define the endpoint URL
url = "https://api.passiolife.com/v2/token-cache/napi/oauth/token"
# Specify the key parameter
params = {
"key": "1i5eXnFpiRfiBGgLibonnBg10Ct14nALTAK5Jb6B4V4o"
}
# Make the GET request with the headers and query parameters
try:
r = requests.get(url, params=params)
r.raise_for_status()
# Assuming JSON response, parse and print it
data = r.json()
print(data)
except requests.exceptions.HTTPError as err:
print(f"HTTP error occurred: {err}")
except Exception as err:
print(f"An error occurred: {err}")
Nutrition-API Request Quickstart
import requests
# This is an example of the response from the above Token service route
response = {
"access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImupZCI6InNab1FMT3oxMkRreHVLNVVVRUJBSCJ9...",
"scope": "read:search read:products",
"expires_in": 86155.034762118,
"token_type": "Bearer",
"customer_id": "0d8bb889-36e1-11ee-b9e9-92e504c243a4"
}
# Add the required headers. If missing or invalid you will get a 401 or 403
headers = {
"Authorization": f"Bearer {response['access_token']}",
"Passio-ID": response['customer_id']
}
url = "https://api.passiolife.com/v2/products/napi/food/search/advanced?term=pepperoni%20pizza"
r = requests.get(url, headers=headers)
print(r.json())
Last updated