Task & Job Management APIs Overview
The N-central Task & Job Management APIs provide comprehensive control over scheduled tasks, direct support operations, and job status monitoring across your managed service infrastructure. These APIs enable you to automate routine maintenance, track task execution, and manage job statuses.
API Methods
List Tasks
Endpoint: GET /api/scheduled-tasks
Retrieve a comprehensive list of all scheduled tasks in your N-central environment. This endpoint provides visibility into all automated and scheduled operations.
Key Parameters
- pageSize: Number of items to retrieve per page (default: 50)
- pageNumber: Page number to retrieve (starts at 1)
- sortBy: Field to sort results by
- sortOrder: Sort direction (ASC/DESC)
Direct Support Tasks
Endpoint: POST /api/scheduled-tasks/direct
Create immediate execution tasks for specific devices, enabling real-time remote support and maintenance operations.
Key Parameters
- name: Unique identifier for the task
- itemId: ID of the remote execution item
- taskType: Type of task (AutomationPolicy, Script, MacScript)
- deviceId: Target device identifier
- credential: Authentication details for task execution
- parameters: Task-specific configuration parameters
Task Types
- AutomationPolicy: Execute predefined automation policies
- Script: Run custom scripts
- MacScript: Execute Mac-specific scripts
Task Information
Endpoint: GET /api/scheduled-tasks/{taskId}
Retrieve detailed information about a specific task using its unique identifier.
Response Details
- taskId: Unique task identifier
- name: Task name
- type: Task type
- isEnabled: Task activation status
- deviceIds: List of affected devices
Task Status
Endpoint: GET /api/scheduled-tasks/{taskId}/status
Monitor the execution status and progress of specific tasks.
Status Information
- taskName: Name of the task
- status: Current execution state
- statusCounts: Aggregated status metrics
- deviceDetails: Per-device execution status
Job Status
Endpoint: GET /api/org-units/{orgUnitId}/job-statuses
Track job execution states at the organization unit level.
Key Features
- Status tracking for multiple job types
- Detailed execution metrics
- Historical job status data
Key Features
Direct Support Task Execution
Execute immediate tasks against specific devices with support for multiple task types including Automation Policies, Scripts, and Mac Scripts. Each task can be configured with custom credentials and parameters for precise control.
Comprehensive Task Information
Retrieve detailed task metadata including task IDs, parent-child relationships, organization assignments, and device associations. Track whether tasks are reactive or proactive, and monitor their enabled/disabled status.
Aggregated Status Monitoring
Get detailed task status aggregations showing counts by status type (e.g., Completed, Pending) across all devices. Includes task names and execution statistics to help track task progress at scale.
Device-Level Status Details
Access granular status information for each device involved in a task, including device names, execution status, output messages, and detailed execution logs for troubleshooting.
Flexible Job Status Tracking
Monitor job statuses across different organization units with support for pagination and custom sorting. Track execution states, timestamps, and completion status for better operational oversight.
Implementation Examples
Create a Direct Support Task
curl -X POST "https://your-ncentral-instance/api/scheduled-tasks/direct" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Security Update Script",
"itemId": 1001,
"taskType": "Script",
"customerId": 100,
"deviceId": 987654321,
"credential": {
"type": "LocalSystem"
},
"parameters": [
{
"name": "CommandLine",
"value": "update_security.ps1",
"type": "string"
}
]
}'
Check Task Status
curl -X GET "https://your-ncentral-instance/api/scheduled-tasks/1234567/status" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
List All Tasks with Pagination
curl -X GET "https://your-ncentral-instance/api/scheduled-tasks?pageSize=50&pageNumber=1" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Updated 6 days ago