- Added a new VTigerService class for handling API interactions with vTiger CRM. - Implemented methods to fetch customer subscriptions and sales orders. - Created a new database migration for BMC Office subscriptions, including table structure and view for totals. - Enhanced customer detail frontend to display subscriptions and sales orders with improved UI/UX. - Added JavaScript functions for loading and displaying subscription data dynamically. - Created tests for vTiger API queries and field inspections to ensure data integrity and functionality.
35 lines
1013 B
Python
35 lines
1013 B
Python
import asyncio
|
|
import aiohttp
|
|
import json
|
|
import os
|
|
from dotenv import load_dotenv
|
|
|
|
load_dotenv()
|
|
|
|
async def test_vtiger():
|
|
base_url = os.getenv('VTIGER_URL')
|
|
username = os.getenv('VTIGER_USERNAME')
|
|
api_key = os.getenv('VTIGER_API_KEY')
|
|
|
|
auth = aiohttp.BasicAuth(username, api_key)
|
|
|
|
# Test query with singular "Subscription"
|
|
vtiger_id = '3x760'
|
|
query = f"SELECT * FROM Subscription WHERE account_id='{vtiger_id}';"
|
|
print(f"🔍 Testing query: {query}")
|
|
|
|
async with aiohttp.ClientSession() as session:
|
|
async with session.get(
|
|
f"{base_url}/restapi/v1/vtiger/default/query",
|
|
params={"query": query},
|
|
auth=auth
|
|
) as response:
|
|
text = await response.text()
|
|
print(f"Status: {response.status}")
|
|
print(f"Response: {text[:500]}")
|
|
if response.status == 200:
|
|
data = json.loads(text)
|
|
print(json.dumps(data, indent=2))
|
|
|
|
asyncio.run(test_vtiger())
|