Zum Hauptinhalt springen

RemoteControlService API Documentation

Overview

The RemoteControlService provides an HTTP-based API for remotely controlling and triggering AI validation checks in the OneWare.AI application. The service runs an HTTP listener that accepts POST requests and returns JSON responses. It can be activated by opening the Camera Tool and setting the checkmark in the top right. This page contains the information necessary to connect to the HTTP listener in OneWare Studio.

Service Configuration

  • Protocol: HTTP
  • Method: POST only
  • Content-Type: application/json
  • Response Format: JSON

Base URL

The base URL is configurable when the service is instantiated. Default format:

http://localhost:<port>/

Endpoints

POST /check

Triggers an AI validation check by capturing photos from configured cameras and running validation rules.

Endpoint Details

  • URL: /check
  • Method: POST
  • Auth required: No
  • Handler Name: "AI check"

Request Format

Headers:

Content-Type: application/json

Body:

{}

The request body is an empty JSON object. No parameters are required.

Example Request:

curl -X POST http://localhost:8080/check \
-H "Content-Type: application/json" \
-d '{}'

Response Format

Success Response (200 OK):

{
"isValid": true,
"validationRules": [
{
"ruleType": "AreaValidation",
"parameters": {
"type": "area",
"appliesTo": "All",
"name": "Area Check",
"appliesToCamera": null,
"appliesToPreset": null,
"executeCheckPerCapture": false
},
"isValid": true,
"value": 0.85
},
{
"ruleType": "CountValidation",
"parameters": {
"type": "count",
"appliesTo": "Camera",
"name": "Count Check",
"appliesToCamera": "Camera1",
"appliesToPreset": null,
"executeCheckPerCapture": true
},
"isValid": false,
"value": 3.0
}
],
"captures": [
{
"name": "Camera1_Preset1",
"isValid": true
},
{
"name": "Camera2_Preset1",
"isValid": false
}
]
}

Response Fields:

FieldTypeDescription
isValidbooleanOverall validation result. true if all validation rules passed, false otherwise.
validationRulesarrayArray of validation rule results.
capturesarrayArray of capture results from each camera/preset combination.

ValidationRule Object:

FieldTypeDescription
ruleTypestringType of validation rule (e.g., "AreaValidation", "CountValidation", "MinDistanceValidation").
parametersobjectRule-specific configuration parameters (see Rule Parameters section).
isValidbooleanWhether this specific rule passed validation.
valuenumberThe computed value from the validation rule.

Capture Object:

FieldTypeDescription
namestringName/identifier of the capture (typically Camera_Preset format).
isValidbooleanWhether this specific capture passed its validation checks.

Rule Parameters

The parameters object structure depends on the rule type, identified by the type discriminator field:

Common Fields (all types):

FieldTypeDescription
typestringRule type discriminator: "area", "count", "minDistance", "areaWeighted", or "countWeighted".
appliesTostringScope of the rule: "All", "Camera", or "Preset".
namestring or nullOptional name for the rule.
appliesToCamerastring or nullCamera name if appliesTo is "Camera".
appliesToPresetstring or nullPreset name if appliesTo is "Preset".
executeCheckPerCapturebooleanWhether to execute the check individually per capture or across all captures.

Rule Types:

  1. Area Validation (type: "area")

    • Validates based on detected object area/size
  2. Count Validation (type: "count")

    • Validates based on the number of detected objects
  3. Min Distance Validation (type: "minDistance")

    • Validates minimum distance between detected objects
  4. Weighted Area Validation (type: "areaWeighted")

    • Validates area with weighted calculation
  5. Weighted Count Validation (type: "countWeighted")

    • Validates count with weighted calculation

Behavior

When this endpoint is called:

  1. The service triggers the camera capture command
  2. Photos are taken from all configured cameras
  3. AI models process the captured images
  4. Validation rules are evaluated against the AI results
  5. Results are aggregated and returned as JSON

Error Responses

Endpoint Not Available (200 OK):

Endpoint not available

Returned when:

  • Wrong HTTP method used (not POST)
  • Invalid endpoint path
  • Endpoint not found in handlers

Bad Request (200 OK):

Bad request

Returned when the request payload cannot be parsed as valid JSON.

Internal Error (200 OK):

Internal error

Returned when an unexpected error occurs during request processing.

Note: All error responses currently return HTTP 200 status code with plain text body (not JSON).

Usage Example - Python

import requests
import json

# Trigger AI check
response = requests.post('http://localhost:8080/check', json={})

if response.status_code == 200:
try:
result = response.json()
print(f"Validation passed: {result['isValid']}")
print(f"Number of rules checked: {len(result['validationRules'])}")
print(f"Number of captures: {len(result['captures'])}")

# Check individual rules
for rule in result['validationRules']:
print(f"Rule {rule['ruleType']}: {'PASS' if rule['isValid'] else 'FAIL'} (value: {rule['value']})")
except json.JSONDecodeError:
print(f"Error: {response.text}")
else:
print(f"HTTP Error: {response.status_code}")

Disclaimer

The RemoteControlService is an experimental feature intendet for prototyping only. If you enable it in OneWare Studio you do so at your own risk. Only enable in closed network environments decoupled from the web.