查询所有变更

查询所有变更

API调用URL地址

http://<serverName>:<portNumber>/api/v3/changes

示例:http://192.168.0.39:8080/api/v3/changes

请求参数

方法:GET

请求参数:

参数名

位置

input_data

<JSON_String>

body

authtoken

<API Key>

header

 

输入示例

{
    "list_info":{
        "row_count":10,
        "start_index":1,
        "get_total_count":true,
        "sort_fields":[
            {
                "field":"id",
                "order":"asc"
            }

        ]

    }

}

List_info中的值为API请求的参数,其中:
“row_count”:“10”,为查询返回 10 个数据;
start_index”1,为从第 1 个开始查询;
get_total_count:true,为获得所有数据计数;
"sort_fields":[
            {
                "field":"id",
                "order":"asc"
            }
        ]
为排序方式,排序字段依据的字段为“id”,order:“asc”,为升序排列;
其他:
search_fields:{ "title": "测试主题"},即搜索条件,为 主题 为 “测试主题” 的变更

响应示例

 {

    "response_status":[
        {
            "status_code":2000,
            "status":"success"
        }

    ]
,
    "changes":[
        {
            "template":{
                "name":"General Template",
                "id":"1"
            }
,
            "short_description":"",
            "sla_violation":null,
            "emergency":false,
            "change_type":null,
            "title":"该变更造成了请求14",
            "change_owner":null,
            "next_review_on":null,
            "urgency":null,
            "id":"1",
            "change_requester":null,
            "group":null,
            "created_time":{
                "display_value":"18/08/2021 09:29 AM",
                "value":"1629250161910"
            }
,
            "item":null,
            "workflow":{
                "validated":true,
                "name":"SDGeneral",
                "id":"1"
            }
,
            "approval_status":{
                "name":"Pending Approval",
                "id":"1"
            }
,
            "change_manager":null,
            "impact":null,
            "retrospective":false,
            "sla":null,
            "priority":null,
            "scheduled_end_time":null,
            "site":null,
            "stage":{
                "internal_name":"Submission",
                "stage_index":"1",
                "name":"Submission",
                "id":"1"
            }
,
            "reason_for_change":null,
            "completed_time":null,
            "risk":null,
            "category":null,
            "subcategory":null,
            "notes_present":false,
            "status":{
                "internal_name":"Requested",
                "prominent":false,
                "stage":{
                    "id":"1"
                }
,
                "action_name":null,
                "name":"Requested",
                "id":"3"
            }
,
            "scheduled_start_time":null
        }
,
        {
            "template":{
                "name":"General Template",
                "id":"1"
            }
,
            "short_description":"",
            "sla_violation":null,
            "emergency":false,
            "change_type":null,
            "title":"该变更导致了请求事件",
            "change_owner":null,
            "next_review_on":null,
            "urgency":null,
            "id":"2",
            "change_requester":null,
            "group":null,
            "created_time":{
                "display_value":"18/08/2021 09:29 AM",
                "value":"1629250187114"
            }
,
            "item":null,
            "workflow":{
                "validated":true,
                "name":"SDGeneral",
                "id":"1"
            }
,
            "approval_status":{
                "name":"Pending Approval",
                "id":"1"
            }
,
            "change_manager":null,
            "impact":null,
            "retrospective":false,
            "sla":null,
            "priority":null,
            "scheduled_end_time":null,
            "site":null,
            "stage":{
                "internal_name":"Submission",
                "stage_index":"1",
                "name":"Submission",
                "id":"1"
            }
,
            "reason_for_change":null,
            "completed_time":null,
            "risk":null,
            "category":null,
            "subcategory":null,
            "notes_present":false,
            "status":{
                "internal_name":"Requested",
                "prominent":false,
                "stage":{
                    "id":"1"
                }
,
                "action_name":null,
                "name":"Requested",
                "id":"3"
            }
,
            "scheduled_start_time":null
        }
,
        {
            "template":{
                "name":"General Template",
                "id":"1"
            }
,
            "short_description":"",
            "sla_violation":null,
            "emergency":false,
            "change_type":{
                "color":"#ffff66",
                "pre_approved":false,
                "name":"Minor",
                "id":"4"
            }
,
            "title":"test",
            "change_owner":null,
            "next_review_on":null,
            "urgency":null,
            "id":"3",
            "change_requester":null,
            "group":null,
            "created_time":{
                "display_value":"08/09/2021 04:55 PM",
                "value":"1631091355677"
            }
,
            "item":null,
            "workflow":{
                "validated":true,
                "name":"SDGeneral",
                "id":"1"
            }
,
            "approval_status":{
                "name":"Pending Approval",
                "id":"1"
            }
,
            "change_manager":null,
            "impact":null,
            "retrospective":false,
            "sla":null,
            "priority":null,
            "scheduled_end_time":null,
            "site":null,
            "stage":{
                "internal_name":"Submission",
                "stage_index":"1",
                "name":"Submission",
                "id":"1"
            }
,
            "reason_for_change":null,
            "completed_time":null,
            "risk":null,
            "category":null,
            "subcategory":null,
            "notes_present":false,
            "status":{
                "internal_name":"Requested",
                "prominent":false,
                "stage":{
                    "id":"1"
                }
,
                "action_name":null,
                "name":"Requested",
                "id":"3"
            }
,
            "scheduled_start_time":null
        }
,
        {
            "template":{
                "name":"IT服务变更",
                "id":"301"
            }
,
            "short_description":"test",
            "sla_violation":null,
            "emergency":false,
            "change_type":null,
            "title":"需要升级SIP服务器",
            "change_owner":{
                "email_id":null,
                "phone":null,
                "name":"亚马逊",
                "mobile":null,
                "profile_pic":{
                    "content-url":"/images/default-profile-pic2.svg",
                    "name":"default-profile-pic2.svg"
                }
,
                "is_vipuser":false,
                "id":"1506",
                "department":null
            }
,
            "next_review_on":{
                "display_value":"09/09/2021 05:00 PM",
                "value":"1631178000000"
            }
,
            "urgency":null,
            "id":"4",
            "change_requester":null,
            "group":null,
            "created_time":{
                "display_value":"09/09/2021 03:37 PM",
                "value":"1631173059914"
            }
,
            "item":null,
            "workflow":{
                "validated":true,
                "name":"SDGeneral",
                "id":"1"
            }
,
            "approval_status":{
                "name":"Approved",
                "id":"2"
            }
,
            "change_manager":{
                "email_id":"test1@test.com",
                "phone":null,
                "name":"IT经理Jack",
                "mobile":null,
                "profile_pic":{
                    "content-url":"/images/default-profile-pic2.svg",
                    "name":"default-profile-pic2.svg"
                }
,
                "is_vipuser":false,
                "id":"1801",
                "department":null
            }
,
            "impact":null,
            "retrospective":false,
            "sla":null,
            "priority":null,
            "scheduled_end_time":null,
            "site":null,
            "stage":{
                "internal_name":"Implementation",
                "stage_index":"4",
                "name":"Implementation",
                "id":"4"
            }
,
            "reason_for_change":{
                "name":"Security compliance",
                "id":"2"
            }
,
            "completed_time":null,
            "risk":null,
            "category":null,
            "subcategory":null,
            "notes_present":false,
            "status":{
                "internal_name":"Implementation - In Progress",
                "prominent":false,
                "stage":{
                    "id":"4"
                }
,
                "action_name":null,
                "name":"In Progress",
                "id":"20"
            }
,
            "scheduled_start_time":null
        }
,
        {
            "template":{
                "name":"General Template",
                "id":"1"
            }
,
            "short_description":null,
            "sla_violation":null,
            "emergency":false,
            "change_type":null,
            "title":"测试变更顾问委员会",
            "change_owner":null,
            "next_review_on":null,
            "urgency":null,
            "id":"5",
            "change_requester":null,
            "group":null,
            "created_time":{
                "display_value":"09/09/2021 04:50 PM",
                "value":"1631177440537"
            }
,
            "item":null,
            "workflow":{
                "validated":true,
                "name":"SDGeneral",
                "id":"1"
            }
,
            "approval_status":{
                "name":"Approved",
                "id":"2"
            }
,
            "change_manager":null,
            "impact":null,
            "retrospective":false,
            "sla":null,
            "priority":null,
            "scheduled_end_time":null,
            "site":null,
            "stage":{
                "internal_name":"Implementation",
                "stage_index":"4",
                "name":"Implementation",
                "id":"4"
            }
,
            "reason_for_change":null,
            "completed_time":null,
            "risk":null,
            "category":null,
            "subcategory":null,
            "notes_present":false,
            "status":{
                "internal_name":"Implementation - In Progress",
                "prominent":false,
                "stage":{
                    "id":"4"
                }
,
                "action_name":null,
                "name":"In Progress",
                "id":"20"
            }
,
            "scheduled_start_time":null
        }
,
        {
            "template":{
                "name":"General Template",
                "id":"1"
            }
,
            "short_description":null,
            "sla_violation":null,
            "emergency":false,
            "change_type":null,
            "title":"测试变更顾问委员会",
            "change_owner":null,
            "next_review_on":null,
            "urgency":null,
            "id":"6",
            "change_requester":null,
            "group":null,
            "created_time":{
                "display_value":"09/09/2021 04:56 PM",
                "value":"1631177763113"
            }
,
            "item":null,
            "workflow":{
                "validated":true,
                "name":"SDGeneral",
                "id":"1"
            }
,
            "approval_status":{
                "name":"Pending Approval",
                "id":"1"
            }
,
            "change_manager":null,
            "impact":null,
            "retrospective":false,
            "sla":null,
            "priority":null,
            "scheduled_end_time":null,
            "site":null,
            "stage":{
                "internal_name":"Approval",
                "stage_index":"3",
                "name":"Approval",
                "id":"3"
            }
,
            "reason_for_change":null,
            "completed_time":null,
            "risk":null,
            "category":null,
            "subcategory":null,
            "notes_present":false,
            "status":{
                "internal_name":"Approval Pending",
                "prominent":false,
                "stage":{
                    "id":"3"
                }
,
                "action_name":null,
                "name":"Approval Pending",
                "id":"19"
            }
,
            "scheduled_start_time":null
        }
,
        {
            "template":{
                "name":"General Template",
                "id":"1"
            }
,
            "short_description":"",
            "sla_violation":null,
            "emergency":false,
            "change_type":null,
            "title":"测试变更顾问委员会2.0",
            "change_owner":null,
            "next_review_on":null,
            "urgency":null,
            "id":"7",
            "change_requester":null,
            "group":null,
            "created_time":{
                "display_value":"08/10/2021 03:35 PM",
                "value":"1633678548522"
            }
,
            "item":null,
            "workflow":{
                "validated":true,
                "name":"SDGeneral",
                "id":"1"
            }
,
            "approval_status":{
                "name":"Pending Approval",
                "id":"1"
            }
,
            "change_manager":null,
            "impact":null,
            "retrospective":false,
            "sla":null,
            "priority":null,
            "scheduled_end_time":null,
            "site":null,
            "stage":{
                "internal_name":"Submission",
                "stage_index":"1",
                "name":"Submission",
                "id":"1"
            }
,
            "reason_for_change":null,
            "completed_time":null,
            "risk":null,
            "category":null,
            "subcategory":null,
            "notes_present":false,
            "status":{
                "internal_name":"Requested",
                "prominent":false,
                "stage":{
                    "id":"1"
                }
,
                "action_name":null,
                "name":"Requested",
                "id":"3"
            }
,
            "scheduled_start_time":null
        }
,
        {
            "template":{
                "name":"General Template",
                "id":"1"
            }
,
            "short_description":null,
            "sla_violation":null,
            "emergency":false,
            "change_type":null,
            "title":"测试网络问题",
            "change_owner":null,
            "next_review_on":null,
            "urgency":null,
            "id":"8",
            "change_requester":null,
            "group":null,
            "created_time":{
                "display_value":"08/10/2021 03:44 PM",
                "value":"1633679060576"
            }
,
            "item":null,
            "workflow":{
                "validated":true,
                "name":"SDGeneral",
                "id":"1"
            }
,
            "approval_status":{
                "name":"Pending Approval",
                "id":"1"
            }
,
            "change_manager":null,
            "impact":null,
            "retrospective":false,
            "sla":null,
            "priority":null,
            "scheduled_end_time":null,
            "site":null,
            "stage":{
                "internal_name":"Planning",
                "stage_index":"2",
                "name":"Planning",
                "id":"2"
            }
,
            "reason_for_change":null,
            "completed_time":null,
            "risk":null,
            "category":null,
            "subcategory":null,
            "notes_present":false,
            "status":{
                "internal_name":"Planning In Progress",
                "prominent":false,
                "stage":{
                    "id":"2"
                }
,
                "action_name":null,
                "name":"Planning In Progress",
                "id":"16"
            }
,
            "scheduled_start_time":null
        }
,
        {
            "template":{
                "name":"General Template",
                "id":"1"
            }
,
            "short_description":"",
            "sla_violation":null,
            "emergency":false,
            "change_type":null,
            "title":"test",
            "change_owner":null,
            "next_review_on":null,
            "urgency":null,
            "id":"9",
            "change_requester":null,
            "group":null,
            "created_time":{
                "display_value":"13/10/2021 05:24 PM",
                "value":"1634117045885"
            }
,
            "item":null,
            "workflow":{
                "validated":true,
                "name":"SDGeneral",
                "id":"1"
            }
,
            "approval_status":{
                "name":"Pending Approval",
                "id":"1"
            }
,
            "change_manager":null,
            "impact":null,
            "retrospective":false,
            "sla":null,
            "priority":null,
            "scheduled_end_time":null,
            "site":null,
            "stage":{
                "internal_name":"Submission",
                "stage_index":"1",
                "name":"Submission",
                "id":"1"
            }
,
            "reason_for_change":null,
            "completed_time":null,
            "risk":null,
            "category":null,
            "subcategory":null,
            "notes_present":false,
            "status":{
                "internal_name":"Requested",
                "prominent":false,
                "stage":{
                    "id":"1"
                }
,
                "action_name":null,
                "name":"Requested",
                "id":"3"
            }
,
            "scheduled_start_time":null
        }

    ]
,
    "list_info":{
        "sort_fields":[
            {
                "field":"id",
                "order":"asc"
            }

        ]
,
        "has_more_rows":false,
        "start_index":1,
        "total_count":9,
        "get_total_count":"true",
        "row_count":9
    }

}
response_status为响应的状态信息
changes为详细的变更信息
list_info为查询到的列表信息

Postman示例

 

Python脚本示例

#Python version - 3.9
#需要安装requests模块
import requests
 
url = "http://192.168.0.39:8080/api/v3/changes"
headers = {"authtoken":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"}
input_data = '''{
    "list_info": {
        "row_count": 10,
        "start_index": 1,
        "get_total_count": true,
        "search_fields": {
            "title": "该变更导致了请求事件"
        },
        "sort_fields": [
            {
                "field": "id",
                "order": "asc"
            }
        ]

    },
    "fields_required": [
        "title",
    ]
}'''
params = {'input_data': input_data}
response = requests.get(url,headers=headers,params=params,verify=False)
print(response.text)