API usage example in Python
To help you get started with using Feature Upvote’s public REST API, here’s an example in Python you can copy and paste. It will list all of your feedback boards.
Make sure to add your own API key! It’s found here, in your Account profile.
import json
import urllib.request
import urllib.error
# Base URL for the Feature Upvote API v1
BASE_URL = "https://api.featureupvote.com/api/v1/"
# Replace this value with your actual Feature Upvote API key
API_KEY = "YOUR_API_KEY_HERE"
def get_boards():
# Construct the API endpoint for listing boards
endpoint_url = f"{BASE_URL}boards"
# Configure the request headers with Bearer Authentication
headers = {
"Authorization": f"Bearer {API_KEY}",
"Accept": "application/json"
}
# Build the request object
req = urllib.request.Request(endpoint_url, headers=headers, method="GET")
try:
# Send the request and read the response
with urllib.request.urlopen(req) as response:
status_code = response.getcode()
response_body = response.read().decode('utf-8')
# Parse raw text into a readable Python dictionary/list
json_data = json.loads(response_body)
print(f"HTTP Status Code: {status_code}")
print("JSON Response:")
print(json.dumps(json_data, indent=4))
except urllib.error.HTTPError as e:
print(f"HTTP Error occurred: {e.code} - {e.reason}")
print(e.read().decode('utf-8'))
except urllib.error.URLError as e:
print(f"URL Error occurred: {e.reason}")
if __name__ == "__main__":
get_boards()