docs(so-api): [31188f42] Diagnosis of email sending blockade & cleanup

This commit is contained in:
2026-03-05 06:19:45 +00:00
parent be00ea0daa
commit aad293f6fb
9 changed files with 284 additions and 77 deletions

View File

@@ -24,8 +24,9 @@ def create_test_company():
return
# Check if company already exists
existing = client.search(f"Contact?$select=contactId,name&$filter=name eq '{company_name}'")
print(f"DEBUG: Raw search response: {existing}")
if existing:
contact_id = existing[0]['ContactId']
contact_id = existing[0]['contactId']
print(f"⚠️ Company '{company_name}' already exists with ContactId: {contact_id}.")
print("Skipping creation.")
return contact_id
@@ -42,8 +43,8 @@ def create_test_company():
}
}
new_company = client._post("Contact", payload)
if new_company and "ContactId" in new_company:
contact_id = new_company["ContactId"]
if new_company and "contactId" in new_company:
contact_id = new_company["contactId"]
print(f"✅ SUCCESS! Created company '{company_name}' with ContactId: {contact_id}")
return contact_id
else:

View File

@@ -0,0 +1,44 @@
import sys
import os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from superoffice_client import SuperOfficeClient
def create_test_person(contact_id: int):
"""
Creates a new person for a given contact ID.
"""
print(f"🚀 Attempting to create a person for Contact ID: {contact_id}")
try:
client = SuperOfficeClient()
if not client.access_token:
print("❌ Authentication failed.")
return
payload = {
"Contact": {"ContactId": contact_id},
"Firstname": "Test",
"Lastname": "Person",
"Emails": [
{
"Value": "floke.com@gmail.com",
"Description": "Work Email"
}
]
}
new_person = client._post("Person", payload)
if new_person and "PersonId" in new_person:
person_id = new_person["PersonId"]
print(f"✅ SUCCESS! Created person with PersonId: {person_id}")
return person_id
else:
print(f"❌ Failed to create person. Response: {new_person}")
return None
except Exception as e:
print(f"An error occurred: {e}")
return None
if __name__ == "__main__":
TEST_CONTACT_ID = 171185
if len(sys.argv) > 1:
TEST_CONTACT_ID = int(sys.argv[1])
create_test_person(TEST_CONTACT_ID)