Add Windows startup config and Jellyfin API test script

Added startup.json with Windows-specific default paths and documentation for Jellyfin configuration. Introduced test_api.py, a Python script to authenticate with Jellyfin, create a backup, and list backups using the REST API.
This commit is contained in:
2026-02-27 18:10:36 -05:00
parent 78bc22db79
commit 3e6aa54a8c
2 changed files with 67 additions and 0 deletions
+53
View File
@@ -0,0 +1,53 @@
import requests
# Define connection details
server_url = 'http://localhost:8096'
username = 'admin'
password = 'Optimus0329'
backup_options = {
"Database": True, # Include database
"Config": True, # Include config files
"Data": True, # Include data files
"Root": True, # Include root folder
"MediaFiles": False # Exclude media files
}
# Build json payload with auth data
auth_data = {
'username': username,
'Pw': password
}
headers = {}
# Build required connection headers
authorization = 'MediaBrowser Client="other", Device="my-script", DeviceId="some-unique-id", Version="0.0.0"'
headers['Authorization'] = authorization
# Authenticate to server
r = requests.post(server_url + '/Users/AuthenticateByName', headers=headers, json=auth_data)
# Retrieve auth token and user id from returned data
token = r.json().get('AccessToken')
user_id = r.json().get('User').get('Id')
# Update the headers to include the auth token
headers['Authorization'] = f'{authorization}, Token="{token}"'
headers['Content-Type'] = 'application/json'
# Requests can be made with
#requests.get(f'{server_url}/api/endpoint', headers=headers)
# Create a backup (empty body is OK, will use default options)
print("Creating backup...")
response = requests.post(f'{server_url}/Backup/Create', headers=headers, json={})
print(f"Status: {response.status_code}")
print(response.text)
# List all backups
print("\nListing backups...")
response = requests.get(f'{server_url}/Backup', headers=headers)
print(f"Status: {response.status_code}")
print(response.text)