# Method Reference

This section lists **all REST API methods** provided by the ONEWEB **Process Runtime**, including their purpose, request parameters, and runtime behavior.

These APIs allow external systems to **start process flows**, **manage tasks**, **retrieve runtime information**, and **control process execution** through standard REST calls.

All endpoints are accessed relative to the application **context root** and are subject to ONEWEB authentication and authorization rules.

***

### Start Flow (New)

Starts a new process flow when an application is submitted.\
This is the **recommended API** for starting processes.

#### Endpoint

```
POST /BPMREST/service/runtime/process/start
```

#### Request Header

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

#### Request Body

```
{
  "processName": "string",
  "appName": "string",
  "uniqueId": "string",
  "snapVersion": "string",
  "object": {
    "businessObject": "data"
  }
}
```

#### Response Body

```
{
  "data": "ReferenceInstanceId",
  "code": 0,
  "timestamp": 1710000000000,
  "totalRecordCount": 1
}
```

***

### Start Flow (Old – Still Available)

Legacy API used to start a process by process name.\
This method is **still supported but not recommended** for new implementations.

#### Endpoint

```
POST /BPMREST/service/runtime/process/{processName}/start
```

#### Request Body

```
{
    "businessObject": "data"
}
```

#### Response Body

```
{
    "data": "ReferenceInstanceId",
    "code": 0,
    "timestamp": 1710000000000,
    "totalRecordCount": 1
}
```

***

### Claim Task

Claims a task for a specific user if the task is not yet assigned.

#### Endpoint

```
POST /BPMREST/service/runtime/tasks/{taskId}/claim?user={username}
```

#### Response Body

```
{
    "data": "",
    "code": 0,
    "timestamp": 1710000000000,
    "totalRecordCount": 1
}
```

***

### Complete Task

Completes a task and moves the process to the next node.

#### Endpoint

```
POST /BPMREST/service/runtime/tasks/{taskId}/complete?user={username}
```

#### Request Body

```
{
    "businessObject": "data"
}
```

#### Response Body

```
{
    "data": "",
    "code": 0,
    "timestamp": 1710000000000,
    "totalRecordCount": 1
}
```

***

### Get Tasks by Instance ID

Returns all active tasks for a given process instance.

#### Endpoint

```
GET /BPMREST/service/runtime/instance/{instanceId}/tasks
```

#### Response Body (Example)

```
{
    "data": [
        {
            "id": "taskId",
            "name": "Task Name",
            "description": "Node description",
            "processName": "Process Name",
            "assignee": "username",
            "owner": "username",
            "priority": 50,
            "createTime": 1710000000000,
            "dueDate": 1710003600000
        }
    ],
    "code": 0,
    "timestamp": 1710000000000,
    "totalRecordCount": 1
}
```

***

### Get Tasks by User / Role / Group

Retrieves tasks assigned to a user, role, or group.

#### Endpoint

```
GET /BPMREST/service/runtime/tasks?{group|role|user}={name}
```

#### Response

Same structure as **Get Tasks by Instance ID**.

***

### Get Task Variables

Retrieves the business object variables associated with a task.

#### Endpoint

```
GET /BPMREST/service/runtime/tasks/{taskId}/variables
```

#### Response Body

```
{
    "data": {
        "businessObject": "data"
    },
    "code": 0,
    "timestamp": 1710000000000,
    "totalRecordCount": 1
}
```

***

### Assign Task (Multiple Users)

Assigns a task to one or more users as candidates.

#### Endpoint

```
POST /BPMREST/service/runtime/tasks/{taskId}/assign?user=user1&user=user2
```

#### Response Body

```
{
    "data": "",
    "code": 0,
    "timestamp": 1710000000000,
    "totalRecordCount": 1
}
```

***

### Refresh Cache (All Processes)

Refreshes runtime cache for **all processes** on the server.

#### Endpoint

```
POST /BPMREST/service/runtime/refreshCache
```

#### Request Body

```
{
    "process": [],
    "event": "generate"
}
```

#### Response Body

```
{
    "data": "",
    "code": 0,
    "timestamp": 1710000000000,
    "totalRecordCount": 1
}
```

***

### Class Action (Specific Process)

Refreshes cache or regenerates Business Objects for a **specific process**.

#### Endpoint

```
POST /BPMREST/service/runtime/classAction
```

#### Request Body

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

#### Response Body

```
{
    "data": "",
    "code": 0,
    "timestamp": 1710000000000,
    "totalRecordCount": 1
}
```

***

### Summary

The **Process Runtime API** enables complete external control over ONEWEB process flows.

Key capabilities include:

* Starting and managing process instances
* Task claiming, assignment, and completion
* Runtime task inspection
* Cache and process metadata refresh

This API is essential for **workflow automation**, **integration with external systems**, and **orchestrating business processes** within the ONEWEB platform.


---

# 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/process-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.
