# Method Reference

This section documents **all REST API methods** provided by the ONEWEB **Microflow Runtime**, including their purpose, request structure, and execution behavior.

These APIs allow external systems to **execute Microflows as services**, **refresh runtime cache**, and **regenerate Business Objects**, enabling dynamic and service‑oriented application behavior.

All endpoints are accessed relative to the application **context root** and require a valid authenticated session.

***

### Execute Flow

Executes a **Microflow** at runtime.\
This API is typically used to invoke a Microflow as a **micro‑service**, passing input business objects and receiving output data.

#### Endpoint

```
POST /MicroflowRest/DoAction
```

#### Request Header

```
Content-Type: application/json
```

#### Request Body

```
{
    "flowName": "MicroflowName",
    "appName": "ApplicationName",
    "uniqueId": "UniqueFlowId",
    "snapVersion": "v.0.2.0",
    "object": {
        "RequestBO": {
            "requestData": "data"
        }
    }
}
```

#### Response Body

```
{
    "exception": "",
    "responseStatus": "SUCCESS",
    "responseObjectsMap": {
        "ResponseBO": {
            "responseData": 31.184504
        }
    },
    "flowName": "ExchangeRate",
    "flowId": "",
    "tId": ""
}
```

* `responseStatus` indicates execution result
* `responseObjectsMap` contains output Business Objects
* `exception` contains error information when execution fails

***

### Refresh Cache (All Flows)

Refreshes **all cached Business Objects** for all Microflows.

This API should be used when the Business Object structure has changed and the runtime needs to reload updated definitions.

#### Endpoint

```
GET /MicroflowRest/refreshCache
```

#### Response

```
RefreshCache Success
```

This operation affects **all Microflows** in the runtime.

***

### Execute Class Action (Specific Flow)

Executes runtime actions for **specific Microflows** only.

This API allows selective cache refresh or Business Object regeneration without affecting all flows.

#### Endpoint

```
POST /MicroflowRest/classAction
```

#### Request Header

```
Content-Type: application/json
```

#### Request Body

```
{
    "fileNames": [
        "uniqueID.appName.processName.snapVersion.jar"
    ],
    "event": "generate"
}
```

#### Event Options

| Event      | Description                                                 |
| ---------- | ----------------------------------------------------------- |
| `refresh`  | Refresh cache for the specified flows                       |
| `file`     | Retrieve JAR file for the flow                              |
| `generate` | Generate Business Object classes and load them into runtime |

#### Response Body

```
{
    "businessObjectSize": 0,
    "exception": "",
    "fieldDescriptersMapSize": 1,
    "process": [],
    "businessObjectDefSize": 0,
    "files": [],
    "cacheClassSize": 0,
    "definitionSize": 0,
    "responseStatus": "SUCCESS",
    "fieldDescripterSize": 0,
    "environmentSize": 0
}
```

***

### Authentication & Execution Context

All Microflow Runtime API calls:

* Execute within an authenticated ONEWEB session
* Run in the security context of the authenticated user
* Respect application‑level authorization and permissions

Unauthorized or invalid session requests are rejected by the runtime.

***

### Summary

The **Microflow Runtime API** enables service‑oriented execution and runtime management of Microflows.

Key capabilities include:

* Executing Microflows as REST‑based services
* Passing and receiving Business Objects
* Refreshing cached Business Objects globally or selectively
* Controlling runtime behavior without redeployment

This API is essential for **micro‑service orchestration**, **dynamic runtime execution**, and **integration with external systems** in ONEWEB.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.onewebstack.com/api-reference/microflow-runtime-api/method-reference.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
