Skip to main content

Introducing Formengine - The New Formbuilder, try for FREE formengine.io.

Workflow API Core

The Core component of the Workflow API manages other components and building the API using an internal builder based on ASP.NET minimal API.

info

The Core component does not implement endpoint functionality, so be sure to include one of the Data components.

Integration

The Core component is included in the base NuGet package OptimaJet.Workflow.Api for .NET 8.0. You can add it to your project with the following command:

dotnet add package OptimaJet.Workflow.Api

The Core component is integrated into an ASP.NET application using three extension methods. The first method adds the necessary services and allows options configuration:

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddWorkflowApiCore(options =>
{
// Configure the Workflow Engine API Core options.
options.BasePath = "workflow-api";
options.LicenseKey = "V2-TRIAL-VFJJQUw6MDguMjAuMjAyNTpleUpTWlhOMGNtbGpkR2x2Ym5NaU9uc2lVM1J5YVdOMFEyaGxZMnNpT21aaGJITmxMQ0pOWVhoT2RXMWlaWEpQWmtGamRHbDJhWFJwWlhNaU9qRXdMQ0pOWVhoT2RXMWlaWEpQWmxSeVlXNXphWFJwYjI1eklqb3hNQ3dpVFdGNFRuVnRZbVZ5VDJaRGIyMXRZVzVrY3lJNk5Td2lUV0Y0VG5WdFltVnlUMlpUWTJobGJXVnpJam94TENKTllYaE9kVzFpWlhKUFpsUm9jbVZoWkhNaU9qRXNJa0ZqZEdsMlpVUnBjbVZqZEc5eWVTSTZabUZzYzJVc0lrSnlZVzVrYVc1bklqb2lRbkpoYm1ScGJtY2lMQ0pYYjNKclpteHZkMFZ1WjJsdVpVRndhU0k2SW5SeWRXVWlmU3dpUTNWemRHOXRVbVZ6ZEhKcFkzUnBiMjRpT25SeWRXVjk6bE1iTHBleFplMXk3ZEw5NHVLNm1EZWpkbzVOalZPd1JZZjIvbUZIZmlCb1RiMjdUWFBvQ1gyN1NFeWNiMm1SLzNSckhkWUlWMy9zaG1VWTgvRjZVQk5iQlhMK0lFYmFIYVJ0YVNiVDlldmI1ZWVYaEF4a1RmNmdCVVpiWHBwR3JuY09wNEJIV2dPR2RZZXJSTFNxc0Y3RlRxbGE3Z3RwbkpHTy9IdWJHZWlzPQ==";
});
info

This is just a sample. In a real application, the configuration would be stored in an appsettings.json file.

The second method, located in the Data component, adds services with API endpoint implementations based on the data provider you use for your Workflow Engine application. As an example, let's consider using SQLite, but you can choose any other provider. A complete list of providers and installation details can be found in the Data documentation. First, add the appropriate NuGet package:

dotnet add package OptimaJet.Workflow.Api.Sqlite
warning

This version of SQLite may not be compatible with macOS on Apple Silicon processors.

Next, use the extension method to configure the data provider, including the connection string:

builder.Services.AddWorkflowApiSqlite("Data Source=:memory:", options =>
{
// Configure the Workflow Engine API Data options:
options.DatabaseSchema = "main";
options.CommandTimeout = 30;
options.ExceptionHandler = _ => {};
options.LogQueryAction = _ => {};
});

The third extension method is applied to your HTTP pipeline, adding the necessary middleware and registering the built API based on the provided settings and connected components:

var app = builder.Build();

app.UseWorkflowApi();

app.Run();

That's it! In just three steps, you've integrated the Workflow API Core.

info

Authentication and authorization settings are handled by the separate Security component, so the basic API configuration will be entirely public.

Options

NameTypeDefaultDescription
BasePathstring"workflow-api"The root path to the Workflow Engine API endpoints. If an empty string is specified, endpoints will be accessible via the root path of your application.
LicenseKeystring""The Workflow Engine license key with the Workflow Engine API option enabled. If the key is not provided, the API will not start.

For more details about the Data component settings, visit the next page.

Stay in the know
Build Workflow Applications Faster
Star us on GitHub