Xeku.Scripts.WebApi
0.0.0.7
dotnet add package Xeku.Scripts.WebApi --version 0.0.0.7
NuGet\Install-Package Xeku.Scripts.WebApi -Version 0.0.0.7
<PackageReference Include="Xeku.Scripts.WebApi" Version="0.0.0.7" />
<PackageVersion Include="Xeku.Scripts.WebApi" Version="0.0.0.7" />
<PackageReference Include="Xeku.Scripts.WebApi" />
paket add Xeku.Scripts.WebApi --version 0.0.0.7
#r "nuget: Xeku.Scripts.WebApi, 0.0.0.7"
#:package Xeku.Scripts.WebApi@0.0.0.7
#addin nuget:?package=Xeku.Scripts.WebApi&version=0.0.0.7
#tool nuget:?package=Xeku.Scripts.WebApi&version=0.0.0.7
Xeku.Scripts.WebApi
WebApi module for Xeku.Scripts, providing remote script execution endpoints via REST API.
Features
- Remote Execution: Execute compiled scripts via HTTP POST endpoint
- Timeout Support: Built-in 30-second timeout mechanism (configurable)
- Execution Logging: Automatic logging of all remote executions
- ScriptContext Support: Optional ScriptContext injection for XAF interactions
- Standard Authentication: Compatible with JWT Bearer and ApiKey authentication
Installation
dotnet add package Xeku.Scripts.WebApi
Dependencies
Xeku.Core.WebApi- Core WebApi moduleXeku.Scripts- Scripts core module (required)DevExpress.ExpressApp.Api.Xpo.All- XAF OData support
Integration
1. Module Registration
Add to your WebApi project's Startup.cs:
builder.Modules
.Add<Xeku.Scripts.WebApi.ScriptsWebApiModule>();
2. Authentication Configuration
This module uses standard [Authorize] attribute. Ensure your Startup.cs has proper authentication configured:
Option A: JWT Bearer (Standard)
services.AddAuthentication()
.AddJwtBearer(options => {
// JWT configuration
});
Option B: ApiKey (Recommended for external integration)
// Install Xeku.ApiKey.WebApi module
builder.Modules
.Add<Xeku.ApiKey.WebApi.ApiKeyWebApiModule>();
API Endpoints
POST /api/ScriptsController/Execute
Executes a compiled script remotely.
Request Body:
{
"scriptId": "guid-of-compiled-script",
"withContext": true,
"timeoutSeconds": 30
}
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
scriptId |
Guid | Yes | - | The GUID of the script to execute |
withContext |
bool | No | true |
Whether to inject ScriptContext parameter |
timeoutSeconds |
int | No | 30 |
Execution timeout in seconds |
Response (Success - 200 OK):
{
"success": true,
"executionLogId": "guid",
"returnValue": "result or null",
"durationMs": 123,
"messages": ["[INFO] Hello from Script!", "[WARN] ..."]
}
Response (Error - 400/404/500):
{
"type": "https://xeku.dev/errors/execution-failed",
"title": "Execution Failed",
"status": 400,
"detail": "Script not compiled or specific error message"
}
Usage Examples
Using curl with ApiKey
curl -X POST "https://your-api.com/api/ScriptsController/Execute" \
-H "Authorization: ApiKey YOUR_API_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{
"scriptId": "12345678-1234-1234-1234-123456789abc",
"withContext": true,
"timeoutSeconds": 30
}'
Using C# HttpClient
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "ApiKey YOUR_API_KEY");
var request = new
{
scriptId = Guid.Parse("12345678-1234-1234-1234-123456789abc"),
withContext = true,
timeoutSeconds = 30
};
var response = await client.PostAsJsonAsync(
"https://your-api.com/api/ScriptsController/Execute",
request);
var result = await response.Content.ReadFromJsonAsync<ExecutionResult>();
Error Scenarios
| Error | HTTP Status | Description |
|---|---|---|
| Script Not Found | 404 | The specified scriptId does not exist |
| Script Not Compiled | 400 | The script must be compiled before execution |
| Execution Timeout | 400 | Script exceeded the timeout limit |
| Execution Failed | 400 | Script threw an exception during execution |
| Server Error | 500 | Internal server error |
Security Recommendations
Remote script execution can pose security risks. Follow these best practices:
- Use ApiKey Authentication: Implement
Xeku.ApiKeymodule for external API access - Limit Script Permissions: Use XAF security to restrict who can create/edit scripts
- Set Reasonable Timeouts: Default 30 seconds prevents infinite loops
- Monitor Execution Logs: Review
ScriptExecutionLogregularly - Validate Script Content: Review scripts before compilation in production
Performance Considerations
- Assembly Caching: Compiled assemblies are cached in memory for fast execution
- Async Execution: The Execute endpoint is fully async-compatible
- Timeout Mechanism: Uses
CancellationTokenSourcefor efficient timeout handling
Related Modules
- Xeku.Scripts - Core scripts module
- Xeku.ApiKey.WebApi - ApiKey authentication
License
Proprietary - Xeku Solutions
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- DevExpress.ExpressApp.Api.Xpo.All (>= 25.2.3)
- Xeku.Core.WebApi (>= 0.0.0.7)
- Xeku.Scripts (>= 0.0.0.7)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.0.0.7 | 95 | 1/28/2026 |