Skip to main content

List Work Orders

The List Work Orders endpoint allows you to retrieve a paginated list of work orders with powerful filtering and search capabilities.

Endpoint

GET /api/v1/external/workorders/

Full URL: https://app.centroaccess.com/api/v1/external/workorders/

Authentication

Requires API key with view_workorder permission.

Authorization: Api-Key your-api-key-here

Query Parameters

ParameterTypeRequiredDescriptionExample
statusstringNoFilter by work order statusdispatch, in_progress, completed
prioritystringNoFilter by priority levellow, medium, high, urgent
service_categorystringNoFilter by service categoryinstallation, survey, mdu
assigned_teamUUIDNoFilter by assigned team550e8400-e29b-41d4-a716-446655440000
service_zoneUUIDNoFilter by service zone660e8400-e29b-41d4-a716-446655440001
from_dateISO datetimeNoWork orders created after this date2025-10-01 or 2025-10-01T10:00:00Z
to_dateISO datetimeNoWork orders created before this date2025-10-31 or 2025-10-31T23:59:59Z
pageintegerNoPage number (default: 1)1, 2, 3
page_sizeintegerNoResults per page (default: 50, max: 100)20, 50, 100

Response Format

Success Response (200 OK)

{
"count": 150,
"next": "/api/v1/external/workorders/?page=2&page_size=20",
"previous": null,
"results": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"title": "Install fiber connection",
"client_name": "John Doe",
"client_contact": "+1234567890",
"status": "dispatch",
"status_display": "Dispatch",
"priority": "high",
"priority_display": "High",
"service_category": "installation",
"service_category_display": "Installation",
"due_date": "2025-12-31",
"created_at": "2025-10-23T10:00:00Z",
"updated_at": "2025-10-23T10:00:00Z",
"service_zone": {
"id": "660e8400-e29b-41d4-a716-446655440001",
"name": "Downtown Area"
},
"assigned_team": {
"id": "770e8400-e29b-41d4-a716-446655440002",
"name": "Installation Team A"
}
}
// ... more work orders
]
}

Response Fields

FieldTypeDescription
countintegerTotal number of work orders matching filters
nextstring/nullURL for next page of results
previousstring/nullURL for previous page of results
resultsarrayArray of work order objects

Work Order Object Fields

FieldTypeDescription
idUUIDUnique work order identifier
titlestringWork order title
client_namestringCustomer/client name
client_contactstringClient phone number
statusstringCurrent status code
status_displaystringHuman-readable status
prioritystringPriority level code
priority_displaystringHuman-readable priority
service_categorystringService category code
service_category_displaystringHuman-readable category
due_datestring/nullDue date (YYYY-MM-DD)
created_atstringCreation timestamp (ISO format)
updated_atstringLast update timestamp (ISO format)
service_zoneobject/nullService zone information
assigned_teamobject/nullAssigned team information

Examples

Basic Request

List all work orders (first 50 results):

curl -X GET "https://app.centroaccess.com/api/v1/external/workorders/" \
-H "Authorization: Api-Key your-api-key-here"

Filter by Status

Get all work orders in "dispatch" status:

curl -X GET "https://app.centroaccess.com/api/v1/external/workorders/?status=dispatch" \
-H "Authorization: Api-Key your-api-key-here"

Filter by Priority and Service Category

Get high-priority installation work orders:

curl -X GET "https://app.centroaccess.com/api/v1/external/workorders/?priority=high&service_category=installation" \
-H "Authorization: Api-Key your-api-key-here"

Date Range Filter

Get work orders created in the last 7 days:

curl -X GET "https://app.centroaccess.com/api/v1/external/workorders/?from_date=2025-10-17&to_date=2025-10-24" \
-H "Authorization: Api-Key your-api-key-here"

Pagination

Get the second page with 20 results per page:

curl -X GET "https://app.centroaccess.com/api/v1/external/workorders/?page=2&page_size=20" \
-H "Authorization: Api-Key your-api-key-here"

Combined Filters

Complex query with multiple filters:

curl -X GET "https://app.centroaccess.com/api/v1/external/workorders/?status=dispatch&priority=high&service_category=installation&page=1&page_size=10" \
-H "Authorization: Api-Key your-api-key-here"

Status Values

Work orders can have the following status values:

StatusDescription
dispatchInitial state, waiting to be assigned
assignedAssigned to a team
resource_enrouteTeam is on the way
inspectionUnder inspection
submittedSubmitted for review
in_progressWork is being performed
on_holdTemporarily paused
pending_reviewWaiting for review
review_salesSales review required
review_serviceService review required
completedWork completed successfully
cancelledWork order cancelled

Priority Values

PriorityDescription
lowLow priority
mediumMedium priority (default)
highHigh priority
urgentUrgent priority

Service Categories

CategoryDescription
surveySurvey work
installationInstallation work
mduMulti-dwelling unit work
service_providerService provider work
extensionExtension work
transmissionTransmission work
constructionConstruction work
reviewReview work
supportSupport work
relocationRelocation work
equipment_recoveryEquipment recovery

Error Responses

Invalid Filter Value

Status Code: 400 Bad Request

{
"error": "Invalid status value",
"details": "Status 'invalid_status' is not a valid choice."
}

Invalid Date Format

Status Code: 400 Bad Request

{
"error": "Invalid from_date format. Use ISO format (YYYY-MM-DD or YYYY-MM-DDTHH:MM:SS)"
}

Authentication Required

Status Code: 401 Unauthorized

{
"detail": "Invalid API key"
}

Insufficient Permissions

Status Code: 403 Forbidden

{
"error": "Insufficient permissions",
"required_permission": "workorder.view_workorder"
}

Code Examples

Python

import requests
from datetime import datetime, timedelta

API_KEY = "your-api-key-here"
BASE_URL = "https://app.centroaccess.com/api/v1/external"

headers = {
"Authorization": f"Api-Key {API_KEY}",
"Content-Type": "application/json"
}

def list_work_orders(status=None, priority=None, page_size=50):
"""List work orders with optional filtering."""
params = {"page_size": page_size}

if status:
params["status"] = status
if priority:
params["priority"] = priority

response = requests.get(
f"{BASE_URL}/workorders/",
headers=headers,
params=params
)

if response.status_code == 200:
data = response.json()
print(f"Total work orders: {data['count']}")

for wo in data['results']:
print(f"- {wo['title']} ({wo['status']}) - {wo['priority']} priority")

return data
else:
print(f"Error: {response.status_code} - {response.text}")
return None

def get_recent_work_orders(days=7):
"""Get work orders created in the last N days."""
from_date = (datetime.now() - timedelta(days=days)).strftime('%Y-%m-%d')

params = {
"from_date": from_date,
"page_size": 100
}

response = requests.get(
f"{BASE_URL}/workorders/",
headers=headers,
params=params
)

if response.status_code == 200:
data = response.json()
print(f"Work orders created in last {days} days: {data['count']}")
return data['results']
else:
print(f"Error: {response.status_code} - {response.text}")
return []

# Usage examples
list_work_orders(status="dispatch", priority="high")
recent_orders = get_recent_work_orders(days=3)

JavaScript/Node.js

const axios = require('axios');

const API_KEY = 'your-api-key-here';
const BASE_URL = 'https://app.centroaccess.com/api/v1/external';

const headers = {
'Authorization': `Api-Key ${API_KEY}`,
'Content-Type': 'application/json'
};

async function listWorkOrders(filters = {}) {
try {
const response = await axios.get(
`${BASE_URL}/workorders/`,
{
headers,
params: {
page_size: 50,
...filters
}
}
);

console.log(`Total work orders: ${response.data.count}`);

response.data.results.forEach(wo => {
console.log(`- ${wo.title} (${wo.status}) - ${wo.priority} priority`);
});

return response.data;
} catch (error) {
console.error('Error listing work orders:', error.response?.data || error.message);
return null;
}
}

async function getWorkOrdersByTeam(teamId) {
return await listWorkOrders({
assigned_team: teamId,
status: 'assigned'
});
}

async function getHighPriorityOrders() {
return await listWorkOrders({
priority: 'high',
status: 'dispatch'
});
}

// Usage examples
listWorkOrders({ status: 'dispatch' });
getHighPriorityOrders();
getWorkOrdersByTeam('550e8400-e29b-41d4-a716-446655440000');

Best Practices

1. Use Pagination

Always use pagination for large datasets:

# Good: Specify page size
curl "https://app.centroaccess.com/api/v1/external/workorders/?page_size=20"

# Avoid: Requesting all results at once
curl "https://app.centroaccess.com/api/v1/external/workorders/?page_size=10000"

2. Filter Results

Use filters to reduce response size and improve performance:

# Good: Filter by status and date range
curl "https://app.centroaccess.com/api/v1/external/workorders/?status=dispatch&from_date=2025-10-01"

# Less efficient: Get all results and filter client-side
curl "https://app.centroaccess.com/api/v1/external/workorders/"

3. Handle Pagination

Process all pages when dealing with large datasets:

def get_all_work_orders():
all_orders = []
page = 1

while True:
response = requests.get(
f"{BASE_URL}/workorders/",
headers=headers,
params={"page": page, "page_size": 100}
)

if response.status_code != 200:
break

data = response.json()
all_orders.extend(data['results'])

if not data['next']:
break

page += 1

return all_orders

4. Cache Results

Cache results when appropriate to reduce API calls:

import time

class WorkOrderCache:
def __init__(self, ttl=300): # 5 minute TTL
self.cache = {}
self.ttl = ttl

def get_work_orders(self, filters=None):
cache_key = str(filters) if filters else "all"
now = time.time()

if cache_key in self.cache:
cached_data, timestamp = self.cache[cache_key]
if now - timestamp < self.ttl:
return cached_data

# Fetch fresh data
data = list_work_orders(**(filters or {}))
self.cache[cache_key] = (data, now)
return data

Next Steps