ServerEngine REST API
A simple, powerful REST API for triggering automation jobs in ServerEngine. Schedule scripts, runbooks, and workflows with a single HTTP POST request using Basic Authentication.
API Capabilities
Simple REST Endpoint
One endpoint for all automation triggers
API Features
- Single POST endpoint for job scheduling
- Basic HTTP authentication (username:password)
- JSON request body for job configuration
- Dynamic parameter passing to scripts
- Support for scripts, runbooks, and bundles
- Immediate job execution or scheduled runs
API Specifications
Basic Authentication
Simple username/password security
Security Features
- Basic HTTP authentication
- Base64 encoded credentials
- Default admin user
- Configurable password
- Standard port 5000
- Localhost or network access
Default Credentials
Authentication Details
ServerEngine API uses Basic HTTP Authentication with Base64 encoding
Username
admin – Must be admin user for full access
Password
cforce-it.com – Default password (configurable)
Port
5000 – Default listening port (configurable)
Encoding
Base64 encode “username:password” for Authorization header
Request Parameters
Time & Scheduling
Target & Script
Dynamic Parameters (Optional)
Any parameter after will be available in your script. For example, xTest1 will be replaced in your PowerShell script like a variable.
API Usage Examples
# Define the username and password
$username = "admin" #user must be admin
$password = "cforce-it.com" #default password
$port = 5000 #default port
$time = Get-Date -Format "HH:mm" #time syntax for now
$date = Get-Date -Format "yyyy/MM/dd" #date syntax for today
# Encode the credentials
$pair = $username+":"+$password
$encodedCredentials = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes($pair))
# Create the headers
$headers = @{
"Content-Type" = "application/json"
"Authorization" = "Basic $encodedCredentials"
}
# Create the body
$body = @{
Time = $time
Date = $date
RepeatInterval = "One time"
# Host/Group
Host = "(This Computer)"
# Run a script, runbook or bundle
Run = "myscript.ps1"
Status = "Enabled"
# dynamic parameters for e.g. xTest1 will be
# replaced in your script with the value someText
xTest1 = "someText"
xTest2 = "verysomesome"
# xTest3 = "123"
# xTest4 = "coolio"
} | ConvertTo-Json
# Make the POST request to localhost, replace with ip if called from a different host
$response = Invoke-WebRequest -Uri http://localhost:$port/ -Method POST -Headers $headers -Body $body -UseBasicParsing
# Output the response content
$response.Content
# Schedule a job using cURL with Basic Authentication
curl -u admin:cforce-it.com -X POST http://192.168.1.123:5000/ \
-H "Content-Type: application/json" \
-d '{
"Time": "12:01",
"Date": "2024/08/05",
"RepeatInterval": "One time",
"Host": "WIN-SRV-AUS.CForce-IT.network",
"Run": "ServerDeployment.runbook",
"Status": "Enabled",
"xTest1": "someText",
"xTest2": "verysomesome"
}'
# Alternative: Using base64 encoded credentials
curl -X POST http://192.168.1.123:5000/ \
-H "Content-Type: application/json" \
-H "Authorization: Basic YWRtaW46Y2ZvcmNlLWl0LmNvbQ==" \
-d '{
"Time": "14:30",
"Date": "2024/12/25",
"RepeatInterval": "Daily",
"Host": "(This Computer)",
"Run": "DailyBackup.ps1",
"Status": "Enabled",
"xBackupPath": "C:\\Backup",
"xRetentionDays": "30"
}'
import requests
import json
import base64
from datetime import datetime
# ServerEngine API Configuration
username = "admin"
password = "cforce-it.com"
host = "localhost" # or IP address
port = 5000
url = f"http://{host}:{port}/"
# Prepare Basic Authentication
credentials = f"{username}:{password}"
encoded_credentials = base64.b64encode(credentials.encode()).decode()
# Request headers
headers = {
"Content-Type": "application/json",
"Authorization": f"Basic {encoded_credentials}"
}
# Request payload
payload = {
"Time": datetime.now().strftime("%H:%M"),
"Date": datetime.now().strftime("%Y/%m/%d"),
"RepeatInterval": "One time",
"Host": "(This Computer)",
"Run": "automation_script.ps1",
"Status": "Enabled",
"xParameter1": "value1",
"xParameter2": "value2"
}
# Send request
response = requests.post(url, headers=headers, json=payload)
if response.status_code == 200:
print("Job scheduled successfully!")
print("Response:", response.json())
else:
print(f"Error: {response.status_code}")
print(response.text)
const scheduleServerEngineJob = async () => {
// ServerEngine API Configuration
const username = 'admin';
const password = 'cforce-it.com';
const host = 'localhost'; // or IP address
const port = 5000;
const url = `http://${host}:${port}/`;
// Prepare Basic Authentication
const credentials = `${username}:${password}`;
const encodedCredentials = btoa(credentials);
// Prepare request payload
const now = new Date();
const time = now.toTimeString().slice(0, 5); // HH:mm format
const date = `${now.getFullYear()}/${(now.getMonth()+1).toString().padStart(2, '0')}/${now.getDate().toString().padStart(2, '0')}`;
const payload = {
Time: time,
Date: date,
RepeatInterval: "One time",
Host: "(This Computer)",
Run: "webhook_triggered.ps1",
Status: "Enabled",
xWebhookData: "received from API",
xTimestamp: now.toISOString()
};
try {
const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Basic ${encodedCredentials}`
},
body: JSON.stringify(payload)
});
if (response.ok) {
const result = await response.json();
console.log('Job scheduled successfully!', result);
return result;
} else {
const error = await response.text();
throw new Error(`HTTP ${response.status}: ${error}`);
}
} catch (error) {
console.error('Error scheduling job:', error);
throw error;
}
};
// Usage example
scheduleServerEngineJob()
.then(result => console.log('Success:', result))
.catch(error => console.error('Failed:', error));
Common Integration Scenarios
Multi-VM Provisioning
Automate Windows VM configuration by using the VMware PowerCLI module from a ServerEngine-runbook triggered via API.
VM Lifecycle Health
Automate health checks & remediate issues (e.g., restart services, clear logs) on VMware Windows VMs via scheduled ServerEngine jobs using PowerCLI.
Automate Microsoft 365
Manage M365 via the Microsoft Graph PowerShell SDK from a ServerEngine script scheduled to run nightly, automating user provisioning, license assignment, and mailbox settings.
Azure Virtual Machine
Enforce baseline security on Azure Windows VMs by using the Azure PowerShell module from a ServerEngine-runbook to check configurations, apply scripts, and report deviations.
Windows Server Security
Scheduled & Event-Triggered Runbooks Continuously enforce security benchmarks (like CIS or Microsoft Security Baselines) across an entire Windows Server estate.
Automated AWS EC2
TCentralize Windows patching for AWS and on-premises. Trigger System Manager to patch an AWS EC2 instance; upon completion, a webhook triggers a ServerEngine API call to patch on-premises servers, creating a unified workflow.
Google Workspace
Sync user lifecycle from on-prem AD to Google Workspace via the Admin SDK. A ServerEngine script monitors AD and automates Google user creation/suspension.
CI/CD Pipeline for .NET
Automate final-stage deployment to Windows servers. Your CI/CD tool (Jenkins, GitLab) calls the ServerEngine API with the script name and parameters, triggering the deployment on target servers.
Automated Remediation
Create “self-healing” actions. A monitoring tool (like ManageEngine OpManager ) sends a webhook alert; a script interprets it and calls the ServerEngine API to run a remediation script on the affected server.