My Mission

My Mission

Query

  • Method: POST

  • URL: /rest/my-mission/api/my-mission/list/

  • Input parameters (postbody): The sample format is as follows.

All APIs must obtain a security code (security) before using it. For how to obtain it, please refer to the chapter [RESTAPI > Security Code].

{ 
	"security" : "<security code>", 
	"omflow_restapi" : 1, 
	"search_columns" : [], 
	"search_conditions" : [], 
	"exclude_conditions" : [], 
	"order_columns" : [], 
	"limit" : 100, 
	"start" : 0 
} 
  1. security: required, security code.

  2. omflow_restapi: required, 1.

  3. search_columns: optional, the field name to be queried. An example of the format is as follows.

    "search_columns" : ["id", "status", "level"] 

If search_columns is not filled in, all field names and field values of the query form will be returned.

  1. search_conditions: Optional to filter out information that meets the conditions. Each condition in the array is a JSON object structure, and there is an AND relationship between each condition. The default is to query all data. (1) column: field ID. (2) condition: condition character, divided into the following five types. ● =: Filter out data that is exactly the same as value. ● >: Filter out data greater than value. ● <: Filter out data smaller than value. ● in: Filter out the same data as in the value array. ● contains: Filter out data containing value. (3) value: field value.

"search_conditions" : 
[ 
    { 
        "column" : "status", 
        "condition" : "in", 
        "value" : ["assigned", "under review"] 
    }, 
    { 
        "column" : "id" , 
        "condition" : ">", 
        "value" : 3 
    }, 
    <other conditions>,... 
] 
  1. exclude_conditions: Optional, exclude data that meets the conditions, the format is the same as search_conditions, the default is No conditions are excluded.

  2. order_columns: Optional, sort according to the specified fields. If you need to sort in reverse order, please add "-" in front of the field name. The default is to sort by ["id"]. The sample format is as follows.

    #Forward sorting 
    "order_columns" : ["id"] 
    
    #Reverse sorting 
    "order_columns" : ["-id"] 
  3. limit: optional, fill in the number to obtain the data, preset Set to 100 pens.

  4. start: optional, fill in the number from which data to start to obtain, the default is the 0th data.

Example 1: start=0, limit=100, return 100 pieces of data.

Example 2: start=1, limit=100, return 99 pieces of data.

Example 3: start=100, limit=100, return 0 pieces of data.

When the data is returned

successfully, the sample data returned is as follows:

{ 
    "status": 200, 
    "message": "Query successful.", 
    "result": [ 
        { 
            "id": 6, 
            "flow_uuid":
            "history": false,
            "stop_uuid": "FITEM_7", #Current level of the form 
            "stop_chart_text": "Assign labor", #Level name 
            "create_user_id": "system", 
            "update_user_id": null, 
            "ticket_createtime": "2020-07-07T13:50 :21.494", 
            "createtime": "2020-07-07T13:50:21.589", 
            "updatetime": "2020-07-07T13:50:21.589", 
            "assignee_id": null, 
            "assign_group_id": 1, 
            "action ": ",", 
            "attachment": false, #Whether there is an attached file 
            "closed": false, 
        },..... 
    ] 
} When 

fails, the example of returned data is as follows:

{ 
    " status": 404, 
    "message": "The query failed, the error message is as follows: <error message>", 
    "result": [] 

Push order

  • Method: POST

  • URL: /rest/flowmanage/api/ omdata/edit/<api_path>

  • Input parameters (postbody): The sample format is as follows.

All APIs must obtain a security code (security) before using it. For how to obtain it, please refer to the chapter [RESTAPI > Security Code].

Currently, the api_path on the URL can only be queried manually.

For how to query the api path, please refer to the [Application Management > Application Design] chapter.

Subsequent version updates will add an api_path field to my task list.

{ 
  "security": "<security>", 
  "omflow_restapi": 1, 
  "action": "update", 
  "data_id": "<data_id>", 
  "formdata": [ 
    { 
      "id": " <FORMITM_X>", 
      "value": "<field value>" 
    }, 
    { 
      "id": "FORMITM_X", 
      "value": "<field value>" 
    },...... 
  ] 
} 
`` ` 

1. security: required, security code.  
2. omflow_restapi: required, 1.  
3. action: required, just fill in "update".  
4. data_id: required, fill in the data_id queried by the query API.  
5. formdata: optional, fill in the fields and field contents to be modified.  

### When the data is returned 

successfully, the sample data returned is as follows: 

```python 
{ 
  "status": "200", 
  "message": "Order pushed successfully", 
  "result": 
"" } 

Quick operation

  • Method: POST

  • URL: /rest/flowmanage/api/omdata/edit/<api_path>

  • Input parameters (postbody): The sample format is as follows.

All APIs must obtain a security code (security) before using it. For how to obtain it, please refer to the chapter [RESTAPI > Security Code].

Currently, the api_path on the URL can only be queried manually.

For how to query the api path, please refer to the [Application Management > Application Design] chapter.

Subsequent version updates will add an api_path field to my task list.

{ 
  "security": "<security>", 
  "omflow_restapi": 1, 
  "action": "update", 
  "data_id": "<data_id>", 
  "quick_action": "<action1/action2>" 
} 
  1. security: required, security code.

  2. omflow_restapi: required, 1.

  3. action: required, just fill in "update".

  4. data_id: required, fill in the data_id queried by the query API.

  5. quick_action: required, fill in action1 or action2.

When the return data

is successful, the return data example is as follows:

{ 
  "status": "200", 
  "message": "Push order successfully", 
  "result": "" 
} 

Sample code

Python

queries my task list and performs order push actions for the specified form process``python

====================== ============== #OMFLOW My task example

Please refer to https://doc.omflow.com.tw/api-jie-shao/wo-de-ren-wu

#= =================================== import sys,requests,json

url = 'https://1.2. 3.4' # OMFLOW server address url_login = '/accounts/api/security/get/' url_my_mission = '/rest/my-mission/api/my-mission/list/' url_action = '/rest/flowmanage/api /omdata/edit/'

api_path = 'some-api-path-syscom' #Specify the API Path of the task to be processed (application management, visible in the launched application) api_id = '38ea93dc82za39as0a38ei1' #Specify the uuid of the task to be processed (Click on the form to see the URL column)

data_security = '' #Storage the security code for successful login

#========================== ==========

Log in to OMFLOW

Global variables: data_security, url, url_login

Input: user=account, pwd=password

Return: 200 = Success

#========== ========================== def login(user,pwd): global data_security response = requests.get( url + url_login, auth=( user , pwd )) data = response.json() data_code_int = data['status'] data_security = data['result']['security'] return data_code_int #================ =====================

Get my task list

Global variables: data_security, url, url_my_mission

Input: None

Return: My task list (JSON Format)

#==================================== def myMissonList(): values={ "security" : data_security, "omflow_restapi" : 1, "search_columns" : [], "search_conditions" : [], "exclude_conditions" : [], "order_columns" : [], "limit" : 100, "start" : 0 } response = requests.post( url + url_my_mission, data=values ​​) data = response.json() data_list = data['result'] return data_list

#==================== =================

Approval for the specified process

Global variables: data_security, url, url_action, api_path, api_id

Input: My task list (JSON format)

Return pass :

for item in data_list: 
    data_data_id = item['data_id'] 
    if data_flow_uuid.replace('-','') == api_id: 
        #Organize the order content, which can be managed in the application and can be exemplified in the already-listed application 
        values ​​= { 
                " security": data_security, 
                "omflow_restapi": 1, 
                "action": "update", 
                "data_id": data_data_id, 
                "formdata": [ 
                    { 
                        "id": "FORMITM_5", 
                        "value": "Approved" 
                    } 
                ] 
            } 
        response = requests.post( url + url_action + api_path, data= json.dumps(values)) 
        print('flow:' + data_flow_uuid + ',data:' + str(data_data_id) + ',approved.') 

#MAIN if len(sys.argv) != 3: print('error') else: if login(sys.argv[1] , sys.argv[2]) == 200: approve(myMissonList())


## # PowerShell 

query my task list 

```powershell 
#==================================== 
# OMFLOW my mission example 
# refrence https://doc.omflow.com.tw/api-jie-shao/wo-de-ren-wu 
#==================== ================= 

#url = OMFLOW Server URL 
#token = user password 
#user = user name 

$url = 'https://1.2.3.4' 
$token='password ' 
$user ='user' 
$api_path = 'some-api-path-syscom' 
$api_id = '1ko2kme1o9a120a03a0dfs' 

$url_login = '/accounts/api/security/get/' 
$url_my_mission = '/rest/my-mission/ api/my-mission/list/' 
$url_action = '/rest/flowmanage/api/omdata/edit/' 




$security = '' 


$auth = $user + ':' + $token 
$encoded = [System.Text. Encoding]::UTF8.GetBytes($auth) 
$authorizationInfo = [System.Convert]::ToBase64String($encoded) 
$headers = @{"Authorization"="Basic $($authorizationInfo)"} 

$result = Invoke-WebRequest -Uri "$url$url_login" -Method GET -Headers $headers 
if ($result.StatusCode -eq 200) 
{ 
    $result_json = $result.Content | ConvertFrom-Json 
	#echo $result_json.status 
	#echo $result_json.message 
	$ security = $result_json.result.security 
} 
else 
{ 
    echo "login fail." 
} 

if ($security -ne "") 
{ 
    $postParams = @{ 
        "security"=$security; 
        "omflow_restapi"=1; 
        "search_columns"=@();
        "search_conditions"=@();  
        "exclude_conditions"=@();
        "order_columns"=@(); 
        "limit"=100; 
        "start"=0 
		} 
	$result = Invoke-WebRequest -Uri "$url$url_my_mission" -Method POST -Body $postParams 
	$ result_json = $result.Content | ConvertFrom-Json 
	$count = $result_json.result.length 
	echo "total $count mission" 
} 

Last updated