-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmockoon.json
More file actions
376 lines (375 loc) · 14.9 KB
/
mockoon.json
File metadata and controls
376 lines (375 loc) · 14.9 KB
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
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
{
"uuid": "ee6b98fb-c445-43f4-8344-c9d003187fd2",
"lastMigration": 32,
"name": "Demo API",
"endpointPrefix": "",
"latency": 0,
"port": 3000,
"hostname": "",
"folders": [],
"routes": [
{
"uuid": "0807de7d-e3ad-4dd6-ac1c-5dd6fb40f840",
"type": "crud",
"documentation": "Endpoint performing CRUD operations on a data bucket (automatically creates GET, POST, PUT, DELETE routes)",
"method": "",
"endpoint": "users",
"responses": [
{
"uuid": "76337bab-90ca-43c3-b29a-b91d2d35f202",
"body": "{}",
"latency": 0,
"statusCode": 200,
"label": "Perform CRUD operations on the \"Users\" databucket (\"Data\" tab at the top)",
"headers": [],
"bodyType": "DATABUCKET",
"filePath": "",
"databucketID": "jjuf",
"sendFileAsBody": false,
"rules": [],
"rulesOperator": "OR",
"disableTemplating": false,
"fallbackTo404": false,
"default": true,
"crudKey": "id",
"callbacks": []
}
],
"responseMode": null
},
{
"uuid": "131472d0-9f77-45d7-ad86-75bc301ef578",
"type": "http",
"documentation": "Generate random body (JSON, text, CSV, etc) with templating",
"method": "get",
"endpoint": "template",
"responses": [
{
"uuid": "4f002634-a949-47c1-9f6c-9fc4386e9e85",
"body": "{\n \"Templating example\": \"For more information about templating, click the blue 'i' above this editor\",\n \"users\": [\n {{# repeat (queryParam 'total' '10') }}\n {\n \"userId\": \"{{ faker 'number.int' min=10000 max=100000 }}\",\n \"firstname\": \"{{ faker 'person.firstName' }}\",\n \"lastname\": \"{{ faker 'person.lastName' }}\",\n \"friends\": [\n {{# repeat (faker 'number.int' 5) }}\n {\n \"id\": \"{{ faker 'string.uuid' }}\"\n }\n {{/ repeat }}\n ]\n },\n {{/ repeat }}\n ],\n \"total\": \"{{queryParam 'total' '10'}}\"\n}",
"latency": 0,
"statusCode": 200,
"label": "Creates 10 random users, or the amount specified in the 'total' query param",
"headers": [],
"bodyType": "INLINE",
"filePath": "",
"databucketID": "",
"sendFileAsBody": false,
"rules": [],
"rulesOperator": "OR",
"disableTemplating": false,
"fallbackTo404": false,
"default": false,
"crudKey": "id",
"callbacks": []
}
],
"responseMode": null
},
{
"uuid": "aadfb358-3156-4112-8cbc-ade5ed4777dd",
"type": "http",
"documentation": "Use multiple responses with rules",
"method": "post",
"endpoint": "content/:param1",
"responses": [
{
"uuid": "3e38676a-4339-4c03-af81-ba6574880ceb",
"body": "{\n \"Rules example\": \"Default response. Served if route param 'param1' is not present.\"\n}",
"latency": 0,
"statusCode": 200,
"label": "Default response",
"headers": [],
"bodyType": "INLINE",
"filePath": "",
"databucketID": "",
"sendFileAsBody": false,
"rules": [],
"rulesOperator": "OR",
"disableTemplating": false,
"fallbackTo404": false,
"default": true,
"crudKey": "id",
"callbacks": []
},
{
"uuid": "d5783a99-a0c5-4c77-a91f-73a029fb8219",
"body": "{\n \"Rules example\": \"Content XYZ. Served if route param 'param1' equals 'xyz'. (See in 'Rules' tab)\"\n}",
"latency": 0,
"statusCode": 200,
"label": "Content XYZ",
"headers": [],
"bodyType": "INLINE",
"filePath": "",
"databucketID": "",
"sendFileAsBody": false,
"rules": [
{
"target": "params",
"modifier": "param1",
"value": "xyz",
"invert": false,
"operator": "equals"
}
],
"rulesOperator": "OR",
"disableTemplating": false,
"fallbackTo404": false,
"default": false,
"crudKey": "id",
"callbacks": []
},
{
"uuid": "8f7f6b50-a45a-4778-b15d-7e2dd701a6a6",
"body": "{\n \"Rules example\": \"Content not found. Served if route param 'param1' is not equal to 'xyz'. (See in 'Rules' tab)\"\n}\n",
"latency": 0,
"statusCode": 404,
"label": "Content not found",
"headers": [],
"bodyType": "INLINE",
"filePath": "",
"databucketID": "",
"sendFileAsBody": false,
"rules": [
{
"target": "params",
"modifier": "param1",
"value": "^(?!.*xyz).*$",
"invert": false,
"operator": "regex"
}
],
"rulesOperator": "OR",
"disableTemplating": false,
"fallbackTo404": false,
"default": false,
"crudKey": "id",
"callbacks": []
}
],
"responseMode": null
},
{
"uuid": "40fa354a-b867-42c8-b92c-fa6fcd790827",
"type": "http",
"documentation": "Path supports various patterns",
"method": "put",
"endpoint": "path/with/pattern(s)?/*",
"responses": [
{
"uuid": "ff54f38f-8c75-4e5a-a89b-2110c0dc69e7",
"body": "The current path will match the following routes: \nhttp://localhost:3000/path/with/pattern/\nhttp://localhost:3000/path/with/patterns/\nhttp://localhost:3000/path/with/patterns/anything-else\n\nLearn more about Mockoon's routing: https://mockoon.com/docs/latest/api-endpoints/routing/",
"latency": 0,
"statusCode": 200,
"label": "",
"headers": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"bodyType": "INLINE",
"filePath": "",
"databucketID": "",
"sendFileAsBody": false,
"rules": [],
"rulesOperator": "OR",
"disableTemplating": false,
"fallbackTo404": false,
"default": false,
"crudKey": "id",
"callbacks": []
}
],
"responseMode": null
},
{
"uuid": "bae427cb-4c84-41e7-a292-e4a278622fb6",
"type": "http",
"documentation": "\"Guard\" route protecting all routes starting with /protected/",
"method": "all",
"endpoint": "protected/*",
"responses": [
{
"uuid": "ff30ce59-a4cd-4c3c-8018-2446a690670d",
"body": "{\n \"error\": \"Unauthorized\"\n}",
"latency": 0,
"statusCode": 401,
"label": "Requires the presence of an 'Authorization' header",
"headers": [],
"bodyType": "INLINE",
"filePath": "",
"databucketID": "",
"sendFileAsBody": false,
"rules": [
{
"target": "header",
"modifier": "Authorization",
"operator": "null",
"invert": false,
"value": ""
}
],
"rulesOperator": "OR",
"disableTemplating": false,
"fallbackTo404": false,
"default": false,
"crudKey": "id",
"callbacks": []
}
],
"responseMode": "FALLBACK"
},
{
"uuid": "37829f5d-c853-4fde-9464-c06ff450f082",
"type": "http",
"documentation": "Protected route",
"method": "get",
"endpoint": "protected/path",
"responses": [
{
"uuid": "92956029-b804-4b86-82ad-43a340b3ed75",
"body": "You can serve the same responses based on the same rules for all or part of your endpoints by creating global routes using the fallback mode and a wildcard path. \nThis is useful if you want to protect all your endpoints by checking if an Authorization header is present or if you want to verify that all your requests contain a specific property in their body.\nTo learn more: https://mockoon.com/docs/latest/route-responses/global-routes-with-rules/",
"latency": 0,
"statusCode": 200,
"label": "",
"headers": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"bodyType": "INLINE",
"filePath": "",
"databucketID": "",
"sendFileAsBody": false,
"rules": [],
"rulesOperator": "OR",
"disableTemplating": false,
"fallbackTo404": false,
"default": false,
"crudKey": "id",
"callbacks": []
}
],
"responseMode": null
},
{
"method": "get",
"endpoint": "forward-and-record",
"documentation": "Can Mockoon forward or record entering requests?",
"responses": [
{
"uuid": "eb4eba9d-6acf-4434-a8b2-f3aa3000ff0c",
"body": "Mockoon can also act as a proxy and forward all entering requests that are not caught by declared routes. \nYou can activate this option in the environment settings (\"Settings\" tab at the top). \nTo learn more: https://mockoon.com/docs/latest/server-configuration/proxy-mode/\n\nAll entering requests, and responses from the proxied server will be recorded and can be automatically mocked (\"Logs\" tab at the top).\nTo learn more: https://mockoon.com/docs/latest/logging-and-recording/requests-logging/",
"latency": 0,
"statusCode": 200,
"label": "",
"headers": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"bodyType": "INLINE",
"filePath": "",
"databucketID": "",
"sendFileAsBody": false,
"rules": [],
"rulesOperator": "OR",
"disableTemplating": false,
"fallbackTo404": false,
"default": false,
"crudKey": "id",
"callbacks": []
}
],
"uuid": "9af048fc-dfe4-4ab7-bcc5-3e41dd53b980",
"type": "http",
"responseMode": null
}
],
"rootChildren": [
{
"type": "route",
"uuid": "0807de7d-e3ad-4dd6-ac1c-5dd6fb40f840"
},
{
"type": "route",
"uuid": "131472d0-9f77-45d7-ad86-75bc301ef578"
},
{
"type": "route",
"uuid": "aadfb358-3156-4112-8cbc-ade5ed4777dd"
},
{
"type": "route",
"uuid": "40fa354a-b867-42c8-b92c-fa6fcd790827"
},
{
"type": "route",
"uuid": "bae427cb-4c84-41e7-a292-e4a278622fb6"
},
{
"type": "route",
"uuid": "37829f5d-c853-4fde-9464-c06ff450f082"
},
{
"type": "route",
"uuid": "9af048fc-dfe4-4ab7-bcc5-3e41dd53b980"
}
],
"proxyMode": false,
"proxyHost": "",
"proxyRemovePrefix": false,
"tlsOptions": {
"enabled": false,
"type": "CERT",
"pfxPath": "",
"certPath": "",
"keyPath": "",
"caPath": "",
"passphrase": ""
},
"cors": true,
"headers": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Access-Control-Allow-Origin",
"value": "*"
},
{
"key": "Access-Control-Allow-Methods",
"value": "GET,POST,PUT,PATCH,DELETE,HEAD,OPTIONS"
},
{
"key": "Access-Control-Allow-Headers",
"value": "Content-Type, Origin, Accept, Authorization, Content-Length, X-Requested-With"
}
],
"proxyReqHeaders": [
{
"key": "",
"value": ""
}
],
"proxyResHeaders": [
{
"key": "",
"value": ""
}
],
"data": [
{
"uuid": "c57051fa-09e1-418f-a50b-c43127adcfb5",
"id": "jjuf",
"name": "Users",
"documentation": "",
"value": "[\n {{#repeat 50}}\n {\n \"id\": \"{{faker 'string.uuid'}}\",\n \"username\": \"{{faker 'internet.userName'}}\"\n }\n {{/repeat}}\n]"
}
],
"callbacks": []
}