Skip to main content

Python examples

requests

import requests

API_URL = 'https://uthana.com/graphql'
API_KEY = 'YOUR_API_KEY'

query = '''
query GetMotion($id: String!) {
motion(id: $id) {
id
name
created
}
}
'''

variables = {"id": "m3G3XSJrjEJH"}

response = requests.post(
API_URL,
auth=(API_KEY, ''),
json={
'query': query,
'variables': variables,
}
)

print(response.json()["data"]["motion"])

gql

from gql import gql, Client
from gql.transport.requests import RequestsHTTPTransport

API_URL = 'https://uthana.com/graphql'
API_KEY = 'YOUR_API_KEY'

transport = RequestsHTTPTransport(
url=API_URL,
auth=(API_KEY, ''),
use_json=True,
)

client = Client(transport=transport, fetch_schema_from_transport=True)

query = gql('''
query GetMotion($id: String!) {
motion(id: $id) {
id
name
created
}
}
''')

params = {"id": "m3G3XSJrjEJH"}

result = client.execute(query, variable_values=params)
print(result["motion"])

Downloading motions

Download a motion with character mesh

import requests

API_KEY = 'YOUR_API_KEY'
CHARACTER_ID = 'your-character-id'
MOTION_ID = 'your-motion-id'

# Download as FBX (includes character mesh)
fbx_url = f'https://uthana.com/motion/file/motion_viewer/{CHARACTER_ID}/{MOTION_ID}/fbx/{CHARACTER_ID}-{MOTION_ID}.fbx'
response = requests.get(fbx_url, auth=(API_KEY, ''))
with open('motion.fbx', 'wb') as f:
f.write(response.content)

# Download as GLB (includes character mesh)
glb_url = f'https://uthana.com/motion/file/motion_viewer/{CHARACTER_ID}/{MOTION_ID}/glb/{CHARACTER_ID}-{MOTION_ID}.glb'
response = requests.get(glb_url, auth=(API_KEY, ''))
with open('motion.glb', 'wb') as f:
f.write(response.content)

Download a motion-only GLB (without character mesh)

import requests

API_KEY = 'YOUR_API_KEY'
CHARACTER_ID = 'your-character-id'
MOTION_ID = 'your-motion-id'
APP_ID = 'motion_viewer' # or 'training'

# Download motion-only GLB (animation data without character mesh)
motion_only_url = f'https://uthana.com/motion/animation/{APP_ID}/{CHARACTER_ID}/{MOTION_ID}/glb/{CHARACTER_ID}-{MOTION_ID}.glb'
response = requests.get(motion_only_url, auth=(API_KEY, ''))
with open('motion-only.glb', 'wb') as f:
f.write(response.content)

# Motion-only GLB files contain animation data without the character mesh. The character ID is required to ensure the correct skeleton is used.