-
Notifications
You must be signed in to change notification settings - Fork 2.6k
/
task.json
162 lines (162 loc) · 6.53 KB
/
task.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
{
"id": "9C3E8943-130D-4C78-AC63-8AF81DF62DFB",
"name": "InvokeRESTAPI",
"friendlyName": "Invoke REST API",
"description": "Invoke a REST API as a part of your pipeline.",
"author": "Microsoft Corporation",
"helpUrl": "https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/http-rest-api",
"helpMarkDown": "[Learn more about this task](https://go.microsoft.com/fwlink/?linkid=870236)",
"category": "Deploy",
"visibility": [
"Build",
"Release"
],
"runsOn": [
"Server",
"ServerGate"
],
"version": {
"Major": 1,
"Minor": 220,
"Patch": 0
},
"instanceNameFormat": "Invoke REST API: $(method)",
"groups": [
{
"name": "completionOptions",
"displayName": "Advanced",
"isExpanded": false
}
],
"inputs": [
{
"name": "connectedServiceNameSelector",
"aliases": [
"connectionType"
],
"type": "pickList",
"label": "Connection type",
"required": true,
"helpMarkDown": "Select the service connection type to use to invoke the REST API.",
"defaultValue": "connectedServiceName",
"options": {
"connectedServiceName": "Generic",
"connectedServiceNameARM": "Azure Resource Manager"
}
},
{
"name": "connectedServiceName",
"aliases": [
"serviceConnection",
"genericService"
],
"type": "connectedService:Generic",
"label": "Generic service connection",
"defaultValue": "",
"required": "true",
"helpMarkDown": "Select a generic service connection that should be used to pick the URL and construct authorization header for the http request.",
"visibleRule": "connectedServiceNameSelector = connectedServiceName"
},
{
"name": "connectedServiceNameARM",
"aliases": [
"azureServiceConnection",
"azureSubscription"
],
"type": "connectedService:AzureRM",
"label": "Azure subscription",
"defaultValue": "",
"required": true,
"helpMarkDown": "Select an Azure Resource Manager subscription to use for invoking a management API. 'ManagementPortalUrl' of the cloud is used as the baseURL",
"visibleRule": "connectedServiceNameSelector = connectedServiceNameARM"
},
{
"name": "method",
"type": "pickList",
"label": "Method",
"required": "true",
"defaultValue": "POST",
"options": {
"OPTIONS": "OPTIONS",
"GET": "GET",
"HEAD": "HEAD",
"POST": "POST",
"PUT": "PUT",
"DELETE": "DELETE",
"TRACE": "TRACE",
"PATCH": "PATCH"
},
"helpMarkDown": "Select the HTTP method with which the API should be invoked."
},
{
"name": "headers",
"type": "multiLine",
"label": "Headers",
"required": "false",
"defaultValue": "{\n\"Content-Type\":\"application/json\", \n\"PlanUrl\": \"$(system.CollectionUri)\", \n\"ProjectId\": \"$(system.TeamProjectId)\", \n\"HubName\": \"$(system.HostType)\", \n\"PlanId\": \"$(system.PlanId)\", \n\"JobId\": \"$(system.JobId)\", \n\"TimelineId\": \"$(system.TimelineId)\", \n\"TaskInstanceId\": \"$(system.TaskInstanceId)\", \n\"AuthToken\": \"$(system.AccessToken)\"\n}",
"properties": {
"resizable": "true",
"rows": "10",
"maxLength": "2000"
},
"helpMarkDown": "Define header in JSON format. The header shall be attached with request to be sent."
},
{
"name": "body",
"type": "multiLine",
"label": "Body",
"required": "false",
"defaultValue": "",
"properties": {
"resizable": "true",
"rows": "3",
"maxLength": "2000"
},
"visibleRule": "method != GET && method != HEAD"
},
{
"name": "urlSuffix",
"type": "string",
"label": "URL suffix and parameters",
"defaultValue": "",
"required": false,
"helpMarkDown": "Given string append to the URL. Example: If the service connection URL is https:...TestProj/_apis/Release/releases and the URL suffix is /2/environments/1, the service connection URL becomes https:.../TestProj/_apis/Release/releases/2/environments/1. If the URL suffix is ?definitionId=1&releaseCount=1 then the service connection URL becomes https//...TestProj/_apis/Release/releases?definitionId=1&releaseCount=1."
},
{
"name": "waitForCompletion",
"type": "pickList",
"label": "Completion event",
"defaultValue": "false",
"required": true,
"helpMarkDown": "Default value \"ApiResponse\". Available values : \"ApiResponse\", \"Callback\" call where the REST API calls back to update the timeline record.",
"groupName": "completionOptions",
"options": {
"true": "Callback",
"false": "ApiResponse"
}
},
{
"name": "successCriteria",
"type": "string",
"label": "Success criteria",
"defaultValue": "",
"required": false,
"helpMarkDown": "Criteria which defines when to pass the task. No criteria means response content does not influence the result. Example:- For response {\"status\" : \"successful\"}, the expression can be eq(root['status'], 'successful'). [More information](https://go.microsoft.com/fwlink/?linkid=842996)",
"groupName": "completionOptions",
"visibleRule": "waitForCompletion = false"
}
],
"execution": {
"HttpRequest": {
"Execute": {
"EndpointId": "TaskInputs[TaskInputs['connectedServiceNameSelector']]",
"EndpointUrl": "$(endpoint.url)$(urlSuffix)",
"Method": "$(method)",
"Body": "$(body)",
"Headers": "$(headers)",
"WaitForCompletion": "$(waitForCompletion)",
"Expression": "$(successCriteria)"
}
}
}
}