-
Notifications
You must be signed in to change notification settings - Fork 0
/
requests.http
249 lines (198 loc) · 8.29 KB
/
requests.http
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
# These are read from a `.env` file
@base_url = {{BASE_URL}}
@company = {{COMPANY}}
@cookie_name = {{COOKIE_NAME}}
@cookie_value = {{COOKIE_VALUE}}
@job_name={{JOB_NAME}}
@job_number = {{JOB_NUMBER}}
###
# Get instances (to get concurrency control and container instance ID needed for next request)
POST {{base_url}}/containers/{{company}}/timeregistration/instances
Authorization: X-Cookie {{cookie_name}}
Content-Type: application/vnd.deltek.maconomy.containers+json
Cookie: {{cookie_name}}={{cookie_value}}
{ "panes": { "card": { "fields": [ "periodstartvar", "periodendvar", "employeenamevar", "datevar", "weeknumbervar", "fixednumberday1var", "fixednumberday2var", "fixednumberday3var", "fixednumberday4var", "fixednumberday5var", "fixednumberday6var", "fixednumberday7var", "totalnumberday1var", "totalnumberday2var", "totalnumberday3var", "totalnumberday4var", "totalnumberday5var", "totalnumberday6var", "totalnumberday7var", "regulartimeday1var", "regulartimeday2var", "regulartimeday3var", "regulartimeday4var", "regulartimeday5var", "regulartimeday6var", "regulartimeday7var" ] }, "table": { "fields": [ "jobnumber", "numberday1", "numberday2", "numberday3", "numberday4", "numberday5", "numberday6", "numberday7", "entrytext", "taskname", "timeregistrationunit", "jobnamevar", "tasktextvar" ] } } }
# @lang=lua
> {%
local function capture_header(variable_name, header_name)
local header_values = response.headers[header_name]
if header_values ~= nil then
client.global.set(variable_name, header_values[1])
end
end
capture_header('concurrency_control', 'maconomy-concurrency-control')
local container_instance_id = vim.json.decode(response.body).meta.containerInstanceId
client.global.set('container_instance_id', container_instance_id)
%}
###
# Get all table rows (requires `request.hooks.encode_url = false` in rest.nvim to not have the `;` incorrectly encoded)
POST {{base_url}}/containers/{{company}}/timeregistration/instances/{{container_instance_id}}/data;any
Authorization: X-Cookie {{cookie_name}}
Maconomy-Concurrency-Control: {{concurrency_control}}
Content-length: 0
Cookie: {{cookie_name}}={{cookie_value}}
# @lang=lua
> {%
local function capture_header(variable_name, header_name)
local header_values = response.headers[header_name]
if header_values ~= nil then
client.global.set(variable_name, header_values[1])
end
end
capture_header('concurrency_control', 'maconomy-concurrency-control')
%}
###
@row = 0
# Set data
POST {{base_url}}/containers/{{company}}/timeregistration/instances/{{container_instance_id}}/data/panes/table/{{row}}
Authorization: X-Cookie {{cookie_name}}
Maconomy-Concurrency-Control: {{concurrency_control}}
Content-Type: application/vnd.deltek.maconomy.containers+json
Cookie: {{cookie_name}}={{cookie_value}}
{"data": {"numberday1": 1.0}}
# @lang=lua
> {%
local function capture_header(variable_name, header_name)
local header_values = response.headers[header_name]
if header_values ~= nil then
client.global.set(variable_name, header_values[1])
end
end
capture_header('concurrency_control', 'maconomy-concurrency-control')
%}
###
# Change week (not sure what the 0 does)
POST {{base_url}}/containers/{{company}}/timeregistration/instances/{{container_instance_id}}/data/panes/card/0
Authorization: X-Cookie {{cookie_name}}
Maconomy-Concurrency-Control: {{concurrency_control}}
Content-Type: application/vnd.deltek.maconomy.containers+json
Cookie: {{cookie_name}}={{cookie_value}}
{"data": {"datevar": "2024-10-07"}}
# @lang=lua
> {%
local function capture_header(variable_name, header_name)
local header_values = response.headers[header_name]
if header_values ~= nil then
client.global.set(variable_name, header_values[1])
end
end
capture_header('concurrency_control', 'maconomy-concurrency-control')
%}
###
# Add time sheet line (does not need to update concurrency control, does not seem to be required before doing request below)
POST {{base_url}}/containers/{{company}}/timeregistration/instances/{{container_instance_id}}/data/panes/table/inits?row=end
Authorization: X-Cookie {{cookie_name}}
Cookie: {{cookie_name}}={{cookie_value}}
Maconomy-Concurrency-Control: {{concurrency_control}}
Content-Length: 0
Accept: application/vnd.deltek.maconomy.containers+json; version=5.0
###
# Get job number from job name
POST {{base_url}}/containers/{{company}}/timeregistration/search/table;foreignkey=notblockedjobnumber_jobheader
Authorization: X-Cookie {{cookie_name}}
Cookie: {{cookie_name}}={{cookie_value}}
Accept: application/vnd.deltek.maconomy.containers+json; version=5.0
Content-type: application/vnd.deltek.maconomy.containers+json; version=5.0
{
"restriction": "(customernumber like '*{{job_name}}*' or jobnumber like '*{{job_name}}*' or jobname like '*{{job_name}}*' or name1 like '*{{job_name}}*')",
"fields": [
"jobnumber"
]
}
# @lang=lua
> {%
local job_number = vim.json.decode(response.body).panes.filter.records[1].data.jobnumber
client.global.set('job_number', job_number)
%}
###
# Get list of tasks
POST {{base_url}}/containers/{{company}}/timeregistration/search/table;foreignkey=taskname_tasklistline
Authorization: X-Cookie {{cookie_name}}
Cookie: {{cookie_name}}={{cookie_value}}
Accept: application/vnd.deltek.maconomy.containers+json; version=5.0
Content-type: application/vnd.deltek.maconomy.containers+json
{
"data": {
"jobnumber": "{{job_number}}"
},
"fields": ["taskname", "description"]
}
###
# Set new job and task on last row
POST {{base_url}}/containers/{{company}}/timeregistration/instances/{{container_instance_id}}/data/panes/table/?row=end
Authorization: X-Cookie {{cookie_name}}
Cookie: {{cookie_name}}={{cookie_value}}
Maconomy-Concurrency-Control: {{concurrency_control}}
Accept: application/vnd.deltek.maconomy.containers+json; version=5.0
Content-type: application/vnd.deltek.maconomy.containers+json; version=5.0
{
"data": {
"jobnumber": "{{job_number}}",
"taskname": "{{task_name}}"
}
}
# @lang=lua
> {%
local function capture_header(variable_name, header_name)
local header_values = response.headers[header_name]
if header_values ~= nil then
client.global.set(variable_name, header_values[1])
end
end
capture_header('concurrency_control', 'maconomy-concurrency-control')
%}
###
@line_number=0
# Delete line
DELETE {{base_url}}/containers/{{company}}/timeregistration/instances/{{container_instance_id}}/data/panes/table/{{line_number}}
Authorization: X-Cookie {{cookie_name}}
Cookie: {{cookie_name}}={{cookie_value}}
Maconomy-Concurrency-Control: {{concurrency_control}}
Accept: application/vnd.deltek.maconomy.containers+json; version=5.0
# @lang=lua
> {%
local function capture_header(variable_name, header_name)
local header_values = response.headers[header_name]
if header_values ~= nil then
client.global.set(variable_name, header_values[1])
end
end
capture_header('concurrency_control', 'maconomy-concurrency-control')
%}
###
# Create new timesheet
POST {{base_url}}/containers/{{company}}/timeregistration/instances/{{container_instance_id}}/data/panes/card/0/action;name=createtimesheet
Authorization: X-Cookie {{cookie_name}}
Cookie: {{cookie_name}}={{cookie_value}}
Accept: application/vnd.deltek.maconomy.containers+json; version=5.0
Maconomy-Concurrency-Control: {{concurrency_control}}
Maconomy-Response-Type: patch
Content-Length: 0
# @lang=lua
> {%
local function capture_header(variable_name, header_name)
local header_values = response.headers[header_name]
if header_values ~= nil then
client.global.set(variable_name, header_values[1])
end
end
capture_header('concurrency_control', 'maconomy-concurrency-control')
%}
###
# Submit time timesheet
POST {{base_url}}/containers/{{company}}/timeregistration/instances/{{container_instance_id}}/data/panes/card/0/action;name=submittimesheet
Authorization: X-Cookie {{cookie_name}}
Cookie: {{cookie_name}}={{cookie_value}}
Maconomy-Concurrency-Control: {{concurrency_control}}
Accept: application/vnd.deltek.maconomy.containers+json; version=5.0
Content-Length: 0
# @lang=lua
> {%
local function capture_header(variable_name, header_name)
local header_values = response.headers[header_name]
if header_values ~= nil then
client.global.set(variable_name, header_values[1])
end
end
capture_header('concurrency_control', 'maconomy-concurrency-control')
%}