修改一条任务

修改一条任务

API调用URL地址

  1. http://<serverName>:<portNumber>/api/v3/tasks/{task_id}
  2. http://<serverName>:<portNumber>/api/v3/requests/{id}/tasks/{task_id}
  3. http://<serverName>:<portNumber>/api/v3/problems/{id}/tasks/{task_id}
  4. http://<serverName>:<portNumber>/api/v3/changes/{id}/tasks/{task_id}
  5. http://<serverName>:<portNumber>/api/v3/projects/{id}/tasks/{task_id}
  6. http://<serverName>:<portNumber>/api/v3/projects/{project_id}/milestones/{milestone_id}/tasks/{task_id}

其中{id}为对应的请求/问题/变更/项目 ID。{project_id} 为项目ID,{milestone_id}为里程碑ID。{task_id}为需要修改的任务ID

示例:http://192.168.0.163:8080/api/v3/tasks/23

请求参数

方法:PUT

请求参数:

参数名

位置

input_data

<JSON_String>

body

authtoken

<API Key>

header

输入示例

 {

    "task":{
        "actual_end_time":{
            "value":1637806731000
        }
,
        "actual_start_time":{
            "value":1637720331000
        }
,
        "status":{
            "name":"Closed"
        }

    }

}

响应示例

 {

    "task":{
        "percentage_completion":"100",
        "estimated_effort_hours":"2 Hrs ",
        "email_before":"3600000",
        "description":"测试任务描述",
        "title":"测试任务主题",
        "overdue":"false",
        "additional_cost":"2.20",
        "actual_end_time":{
            "display_value":"25/11/2021 10:18 AM",
            "value":"1637806731000"
        }
,
        "id":"23",
        "actual_start_time":{
            "display_value":"24/11/2021 10:18 AM",
            "value":"1637720331000"
        }
,
        "group":null,
        "owner":{
            "email_id":null,
            "name":"Shawn Adams",
            "profile_pic":{
                "content-url":"/images/default-profile-pic2.svg",
                "name":"default-profile-pic2.svg"
            }
,
            "is_vipuser":false,
            "id":"6"
        }
,
        "associated_entity":"general",
        "priority":{
            "color":"#666666",
            "name":"Low",
            "id":"1"
        }
,
        "created_by":{
            "email_id":"test1@test.com",
            "name":"administrator",
            "profile_pic":{
                "content-url":"/images/default-profile-pic2.svg",
                "name":"default-profile-pic2.svg"
            }
,
            "is_vipuser":false,
            "id":"5"
        }
,
        "scheduled_end_time":{
            "display_value":"11/05/2023 10:14 PM",
            "value":"1683814450059"
        }
,
        "marked_owner":null,
        "marked_group":null,
        "estimated_effort_minutes":"22 Mins",
        "comment":null,
        "created_date":{
            "display_value":"25/11/2021 02:20 PM",
            "value":"1637821218316"
        }
,
        "estimated_effort_days":"2 Days ",
        "task_type":null,
        "scheduled_start_time":{
            "display_value":"10/03/2020 12:27 PM",
            "value":"1583814450059"
        }
,
        "status":{
            "color":"#006600",
            "name":"Closed",
            "id":"1"
        }

    }
,
    "response_status":{
        "messages":[
            {
                "type":"success",
                "message":"Task details updated successfully.",
                "status_code":"200"
            }

        ]
,
        "status":"success"
    }

}

Postman示例

 

Python脚本示例

#Python version - 3.9
#需要安装requests模块
import requests
 
url = "http://192.168.0.163:8080/api/v3/tasks/23"
headers = {"authtoken":"2D02FD93-9BD8-484E-ADEF-727FA69A161B"}
input_data = '''{
    "task": {
        "actual_end_time": {
            "value": 1637806731000
        },
        "actual_start_time": {
            "value": 1637720331000
        },
        "status": {
            "name": "Closed"
        }
    }
}'''
data = {'input_data': input_data}
response = requests.put(url,headers=headers,data=data,verify=False)
print(response.text)