Job Models
Models for job-related API responses.
Core Job Model
Supporting Models
Usage Examples
Accessing nested data:
from ABConnect import ABConnectAPI
api = ABConnectAPI()
job = api.jobs.get("2000000")
# Access customer information
customer_name = job.customerContact.contact.fullName
company_code = job.customerContact.contact.company.companyCode
# Iterate through items
total_weight = sum(item.weight for item in job.items)
# Check job status
if job.jobStatusName == "Booked":
print(f"Job {job.jobDisplayId} is ready for shipping")
Creating a new job:
from ABConnect.api.models.jobs import Job, JobItem
# Create job data
job_data = {
"customerContactId": 12345,
"items": [
{"description": "Box 1", "quantity": 2, "weight": 5.0},
{"description": "Box 2", "quantity": 1, "weight": 10.0}
],
"origin": {
"address1": "123 Main St",
"city": "Denver",
"state": "CO",
"zipCode": "80202"
},
"destination": {
"address1": "456 Oak Ave",
"city": "Los Angeles",
"state": "CA",
"zipCode": "90001"
}
}
# Validate with Pydantic model
job = Job.model_validate(job_data)
# Create via API
created_job = api.jobs.create(job.model_dump())
See Also
CompanyBasic- Company information in jobsContact- Contact details in jobsAddress- Address validation