> For the complete documentation index, see [llms.txt](https://docs.oneweb.tech/oneweb/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.oneweb.tech/oneweb/th/api/process-runtime-api/method-rest-api-api.md).

# รายการ Method ทั้งหมดของ REST API และคำอธิบายการทำงานของฟังก์ชันการทำงานของ API

#### Start Flow (new)&#x20;

API นี้จะถูกใช้ในการเริ่ม Process ซึ่งเมื่อผู้ใช้งานได้ส่ง Application ผ่านเซิฟเวอร์ ซึ่งตัวเซิฟเวอร์จะทำการเรียก BPMN เพื่อทำการ Start ตัว Process

```
URL: http://[SERVER]:[PORT]/BPMREST/service/runtime/process/start
HTTP Method: POST
HTTP Request Header: Content-Type: application/json
HTTP Request Body: 	{
	"processName": [String: Process name],
	"appName": [String: App name],
	"uniqueId": [String: Process ID],
	"snapVersion": [String: Snap version],
	"object":{
		Process Business Object        
	}
}
HTTP Response Body: 	{
  				"data" : [String: Reference Instance ID],
  				"code" : [Long: Code value],
  				"timestamp" : [Long: Timestamp value],
  				"totalRecordCount" : [Long: Total record count]
 	}
```

#### Start Flow (old but still available)&#x20;

API สำหรับทำการ start process ที่เมื่อผู้ใช้งานทำการสร้าง application ฝั่งเซิฟเวอร์จะทำการเรียก BPMN เพื่อทำการเริ่ม the process.&#x20;

```
URL: http://[SERVER]:[PORT]/BPMREST/service/runtime/process/[Process Name]/start
HTTP Method: POST
HTTP Request Header: Content-Type: application/json
HTTP Request Body: 	{
[Object: Business Object with data]
}
HTTP Response Body: 	{
  				"data" : [String: Reference Instance ID],
  				"code" : [Long: Code value],
  				"timestamp" : [Long: Timestamp value],
  				"totalRecordCount" : [Long: Total record count]
 	}
```

#### Claim Task&#x20;

API ที่ใช้สำหรับการรับ task ผู้ใช้งานสามารถหา tasks ที่ต้องการใช้งานและมอบหมายสิทธ์งานให้แก่ผู้ใช้ที่ยังไม่ได้มอบหมาย task ให้อย่างเจาะจงได้ด้วย&#x20;

```
URL: http://[SERVER]:[PORT]/BPMREST/service/runtime/tasks/[Task ID]/claim?user=[User Name] 

HTTP Method: POST 

HTTP Request Header: n/a 

HTTP Request Body: n/a 

HTTP Response Body: 	{ 

  				"data" : "", 

  				"code" : [Long: Code value], 

  				"timestamp" : [Long: Timestamp value], 

  				"totalRecordCount" : [Long: Total record count] 

 	} 
```

#### Complete Task&#x20;

เมื่อผู้ใช้งานทำการรับสิทธ์ task และทำงานบน task นั้นเสร็จ process runtime จะส่ง method complete แก่ task นั้นเพื่อให้แอปพลิเคชันรู้ แล้วrocess runtime จะได้ทำการย้ายไปยัง node ต่อไป

```
URL: http://[SERVER]:[PORT]/BPMREST/service/runtime/tasks/[Task ID]/complete?user=[User Name] 

HTTP Method: POST 

HTTP Request Header: Content-Type : application/json 

HTTP Request Body: 	{ 

[Object: Business Object with data] 

} 

HTTP Response Body: 	{ 

  				"data" : "", 

  				"code" : [Long: Code value], 

  				"timestamp" : [Long: Timestamp value], 

  				"totalRecordCount" : [Long: Total record count] 

  	} 
```

#### Get Task By Instance ID&#x20;

API สำหรับคืนค่า Array list ข้อมูลของ Task ที่กำลังดำเนินการอยู่ทั้งหมด แต่จะไม่รวมตัวอย่าง business object ของ Process โดยอ้างอิงจาก instance id ของ method "start flow" &#x20;

```
URL: http://[SERVER]:[PORT]/BPMREST/service/runtime/instance/[Instance ID]/tasks 

HTTP Method: GET 

HTTP Request Header: Content-Type : application/json 

HTTP Request Body: N/A 

HTTP Response Body: { 

  				"data" : [ { 

    					"createBy" : [String: Created by username], 

    					"createTime" : [Long: Created timestamp], 

    					"instanceId" : [String: Reference process instanct ID], 

    					"parentTaskId" : [String: Reference parent task ID], 

    					"dueDate" : [Long: Due date], 

    					"loadlinkEntityId" : [String: Link to reference entity], 

    					"definitionId" : [String: Reference Process definition ID], 

    					"assignee" : [String: User Name], 

    					"loadlinkParam" : [String: Load link parameter by default : "="], 

    					"owner" : [String: Owner User Name], 

    					"description" : [String: Node description], 

    					"processName" : [String: Reference process name], 

    					"name" : [String: Reference Node name], 

    					"priority" : [Long: Task priority start from 1 to 99], 

    					"id" : [String: Reference task ID] 

  				} ], 

  				"code" : [Long: Code value], 

  				"timestamp" : [Long: Timestamp value], 

  				"totalRecordCount" : [Long: Total record count] 

 	} 
```

#### Get Task By User/Role

```
URL: http://[SERVER]:[PORT]/BPMREST/service/runtime/tasks?[group/role/user]=[User Name/Role Name/Group Name] 

HTTP Method: GET 

HTTP Request Header: Content-Type : application/json 

HTTP Request Body: N/A 

HTTP Response Body: { 

  				"data" : [ { 

    					"createBy" : [String: Created by username], 

    					"createTime" : [Long: Created timestamp], 

    					"instanceId" : [String: Reference process instanct ID], 

    					"parentTaskId" : [String: Reference parent task ID], 

    					"dueDate" : [Long: Due date], 

    					"loadlinkEntityId" : [String: Link to reference entity], 

    					"definitionId" : [String: Reference Process definition ID], 

    					"assignee" : [String: User Name], 

    					"loadlinkParam" : [String: Load link parameter by default : "="], 

    					"owner" : [String: Owner User Name], 

    					"description" : [String: Node description], 

    					"processName" : [String: Reference process name], 

    					"name" : [String: Reference Node name], 

    					"priority" : [Long: Task priority start from 1 to 99], 

    					"id" : [String: Reference task ID] 

  				} ], 

  				"code" : [Long: Code value], 

  				"timestamp" : [Long: Timestamp value], 

  				"totalRecordCount" : [Long: Total record count] 

 	} 
```

#### Get Task Variables&#x20;

API สำหรับคืนค่าตัวแปร business object จาก process runtime

```
URL: http://[SERVER]:[PORT]/BPMREST/service/runtime/tasks/[Task ID]/variables 

HTTP Method: GET 

HTTP Request Header: N/A 

HTTP Request Body: N/A 

HTTP Response Body: 	{ 

  				"data" : {[Object: Business Object with data]}, 

  				"code" : [Long: Code value], 

  				"timestamp" : [Long: Timestamp value], 

  				"totalRecordCount" : [Long: Total record count] 

 	} 
```

#### Assign Task(by users)&#x20;

API นี้ใช้เพื่อกำหนด candidate ของ Task ซึ่ง API นี้จะให้ list parameter ในกรณีที่มี candidate มากกว่า 1 รายการใน Task

```
URL: http://[SERVER]:[PORT]/BPMREST/service/runtime/tasks/[Task ID]/assign?user=[User Name]&user=[User Name1]..&user=[User Name n] 

HTTP Method: POST 

HTTP Request Header: N/A 

HTTP Request Body: N/A 

HTTP Response Body:  { 

  				"data" : "", 

  				"code" : [Long: Code value], 

  				"timestamp" : [Long: Timestamp value], 

  				"totalRecordCount" : [Long: Total record count] 

            }
```

#### Refresh Cache&#x20;

API ที่ใช้สำหรับรีเฟรชแคชสำหรับทุก Process บน Server

```
URL: http://[SERVER]:[PORT]/BPMREST/service/runtime/refreshCache 
HTTP Method: POST 
HTTP Request Header: N/A 
HTTP Request Body: { 
"process":[], 
"event":"generate" 
} 
HTTP Response Body: { 
  "data" :"", 
  "code" : [Long: Code value], 
  "timestamp" : [Long: Timestamp value], 
  "totalRecordCount" : [Long: Total record count] 
} 
```

#### Class Action&#x20;

API สำหรับการรีเฟรชแคชสำหรับ Process ที่เจาะจง หรือ สร้าง BO จะมีเพียง parameter ที่เกี่ยวข้องกับ process เท่านั้นถึงจะได้รับการอัปเดต&#x20;

```
URL: http://[SERVER]:[PORT]/BPMREST/service/runtime/classAction 
HTTP Method: POST 
HTTP Request Header: N/A 
HTTP Request Body: { 
"process":[{uniqueID.appName.processName.snapVersion}], 
"event":"generate" 
} 
HTTP Response Body: { 
  "data" :"", 
  "code" : [Long: Code value], 
  "timestamp" : [Long: Timestamp value], 
  "totalRecordCount" : [Long: Total record count] 
} 
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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.oneweb.tech/oneweb/th/api/process-runtime-api/method-rest-api-api.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.
