pact_broker 2.87.0 → 2.88.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +15 -0
  3. data/docs/CONFIGURATION.md +1 -1
  4. data/docs/api/WEBHOOKS.md +789 -0
  5. data/lib/pact_broker/api/decorators/pact_decorator.rb +12 -0
  6. data/lib/pact_broker/api/resources/default_base_resource.rb +1 -1
  7. data/lib/pact_broker/api/resources/environment.rb +3 -3
  8. data/lib/pact_broker/api/resources/metadata_resource_methods.rb +33 -3
  9. data/lib/pact_broker/api/resources/pact_version.rb +4 -0
  10. data/lib/pact_broker/api/resources/previous_distinct_pact_version.rb +1 -1
  11. data/lib/pact_broker/api/resources/webhook_execution.rb +7 -3
  12. data/lib/pact_broker/api.rb +5 -0
  13. data/lib/pact_broker/deployments/environment_service.rb +3 -1
  14. data/lib/pact_broker/doc/views/provider-pacts-for-verification.markdown +7 -7
  15. data/lib/pact_broker/domain/webhook.rb +2 -2
  16. data/lib/pact_broker/test/http_test_data_builder.rb +1 -0
  17. data/lib/pact_broker/test/test_data_builder.rb +6 -0
  18. data/lib/pact_broker/version.rb +1 -1
  19. data/lib/pact_broker/versions/abbreviate_number.rb +8 -4
  20. data/lib/webmachine/describe_routes.rb +62 -0
  21. data/script/data/branches.rb +1 -1
  22. data/script/docs/generate-api-docs.rb +117 -0
  23. data/script/docs/regenerate-api-docs.sh +11 -0
  24. data/spec/fixtures/approvals/docs_webhooks_executing_a_saved_webhook_options.approved.json +20 -0
  25. data/spec/fixtures/approvals/docs_webhooks_executing_a_saved_webhook_post.approved.json +43 -0
  26. data/spec/fixtures/approvals/docs_webhooks_executing_an_unsaved_webhook_options.approved.json +20 -0
  27. data/spec/fixtures/approvals/docs_webhooks_executing_an_unsaved_webhook_post.approved.json +63 -0
  28. data/spec/fixtures/approvals/docs_webhooks_logs_of_triggered_webhook_get.approved.json +20 -0
  29. data/spec/fixtures/approvals/docs_webhooks_logs_of_triggered_webhook_options.approved.json +20 -0
  30. data/spec/fixtures/approvals/docs_webhooks_pact_webhooks_get.approved.json +45 -0
  31. data/spec/fixtures/approvals/docs_webhooks_pact_webhooks_options.approved.json +20 -0
  32. data/spec/fixtures/approvals/docs_webhooks_triggered_webhooks_for_pact_publication_get.approved.json +52 -0
  33. data/spec/fixtures/approvals/docs_webhooks_triggered_webhooks_for_pact_publication_options.approved.json +20 -0
  34. data/spec/fixtures/approvals/docs_webhooks_triggered_webhooks_for_verification_publication_get.approved.json +32 -0
  35. data/spec/fixtures/approvals/docs_webhooks_triggered_webhooks_for_verification_publication_options.approved.json +20 -0
  36. data/spec/fixtures/approvals/docs_webhooks_webhook_get.approved.json +74 -0
  37. data/spec/fixtures/approvals/docs_webhooks_webhook_options.approved.json +20 -0
  38. data/spec/fixtures/approvals/docs_webhooks_webhook_put.approved.json +77 -0
  39. data/spec/fixtures/approvals/docs_webhooks_webhooks_for_a_provider_get.approved.json +41 -0
  40. data/spec/fixtures/approvals/docs_webhooks_webhooks_for_a_provider_options.approved.json +20 -0
  41. data/spec/fixtures/approvals/docs_webhooks_webhooks_for_consumer_and_provider_get.approved.json +45 -0
  42. data/spec/fixtures/approvals/docs_webhooks_webhooks_for_consumer_and_provider_options.approved.json +20 -0
  43. data/spec/fixtures/approvals/docs_webhooks_webhooks_for_consumer_get.approved.json +41 -0
  44. data/spec/fixtures/approvals/docs_webhooks_webhooks_for_consumer_options.approved.json +20 -0
  45. data/spec/fixtures/approvals/docs_webhooks_webhooks_get.approved.json +45 -0
  46. data/spec/fixtures/approvals/docs_webhooks_webhooks_options.approved.json +20 -0
  47. data/spec/fixtures/approvals/docs_webhooks_webhooks_post.approved.json +78 -0
  48. data/spec/fixtures/approvals/docs_webhooks_webhooks_status_get.approved.json +79 -0
  49. data/spec/fixtures/approvals/docs_webhooks_webhooks_status_options.approved.json +20 -0
  50. data/spec/fixtures/approvals/get_provider_pacts_for_verification.approved.json +1 -2
  51. data/spec/fixtures/approvals/publish_contract_no_branch.approved.json +1 -2
  52. data/spec/fixtures/approvals/publish_contract_nothing_exists.approved.json +1 -2
  53. data/spec/fixtures/approvals/publish_contract_nothing_exists_with_webhook.approved.json +1 -2
  54. data/spec/fixtures/approvals/publish_contract_verification_already_exists.approved.json +1 -2
  55. data/spec/fixtures/approvals/publish_contract_with_validation_error.approved.json +1 -2
  56. data/spec/integration/pact_metdata_spec.rb +105 -0
  57. data/spec/integration/webhooks_documentation_spec.rb +348 -0
  58. data/spec/lib/pact_broker/deployments/environment_service_spec.rb +21 -0
  59. data/spec/lib/pact_broker/domain/webhook_spec.rb +35 -0
  60. data/spec/lib/pact_broker/versions/abbreviate_number_spec.rb +2 -1
  61. data/spec/support/documentation.rb +64 -0
  62. data/spec/support/rack_helpers.rb +1 -1
  63. data/tasks/development.rake +14 -13
  64. metadata +65 -3
@@ -0,0 +1,789 @@
1
+
2
+ # Webhooks
3
+
4
+
5
+ ## Webhook
6
+
7
+ Path: `/webhooks/:uuid`<br/>
8
+ Allowed methods: `GET`, `PUT`, `DELETE`<br/>
9
+
10
+ ### GET
11
+
12
+ #### Request
13
+
14
+ Headers: `{"Accept":"application/hal+json"}`<br/>
15
+
16
+
17
+ #### Response
18
+
19
+ Status: `200`<br/>
20
+ Headers: `{"Content-Type":"application/hal+json;charset=utf-8"}`<br/>
21
+ Body:
22
+
23
+ ```
24
+ {
25
+ "uuid": "d2181b32-8b03-4daf-8cc0-d9168b2f6fac",
26
+ "description": "an example webhook",
27
+ "consumer": {
28
+ "name": "Foo"
29
+ },
30
+ "provider": {
31
+ "name": "Bar"
32
+ },
33
+ "enabled": true,
34
+ "request": {
35
+ "method": "POST",
36
+ "url": "https://example.org/example",
37
+ "headers": {
38
+ "Content-Type": "application/json"
39
+ },
40
+ "body": {
41
+ "pactUrl": "${pactbroker.pactUrl}"
42
+ }
43
+ },
44
+ "events": [
45
+ {
46
+ "name": "contract_content_changed"
47
+ }
48
+ ],
49
+ "createdAt": "2021-09-01T00:07:21+00:00",
50
+ "_links": {
51
+ "self": {
52
+ "title": "an example webhook",
53
+ "href": "http://example.org/webhooks/d2181b32-8b03-4daf-8cc0-d9168b2f6fac"
54
+ },
55
+ "pb:execute": {
56
+ "title": "Test the execution of the webhook with the latest matching pact or verification by sending a POST request to this URL",
57
+ "href": "http://example.org/webhooks/d2181b32-8b03-4daf-8cc0-d9168b2f6fac/execute"
58
+ },
59
+ "pb:consumer": {
60
+ "title": "Consumer",
61
+ "name": "Foo",
62
+ "href": "http://example.org/pacticipants/Foo"
63
+ },
64
+ "pb:provider": {
65
+ "title": "Provider",
66
+ "name": "Bar",
67
+ "href": "http://example.org/pacticipants/Bar"
68
+ },
69
+ "pb:pact-webhooks": {
70
+ "title": "All webhooks for consumer Foo and provider Bar",
71
+ "href": "http://example.org/webhooks/provider/Bar/consumer/Foo"
72
+ },
73
+ "pb:webhooks": {
74
+ "title": "All webhooks",
75
+ "href": "http://example.org/webhooks"
76
+ }
77
+ }
78
+ }
79
+ ```
80
+
81
+
82
+ ### PUT
83
+
84
+ #### Request
85
+
86
+ Headers: `{"Content-Type":"application/json","Accept":"application/hal+json"}`<br/>
87
+ Body:
88
+
89
+ ```
90
+ {
91
+ "description": "an example webhook",
92
+ "events": [
93
+ {
94
+ "name": "contract_content_changed"
95
+ }
96
+ ],
97
+ "request": {
98
+ "method": "POST",
99
+ "url": "https://example.org/example",
100
+ "username": "username",
101
+ "password": "password",
102
+ "headers": {
103
+ "Accept": "application/json"
104
+ },
105
+ "body": {
106
+ "pactUrl": "${pactbroker.pactUrl}"
107
+ }
108
+ }
109
+ }
110
+ ```
111
+
112
+
113
+ #### Response
114
+
115
+ Status: `200`<br/>
116
+ Headers: `{"Content-Type":"application/hal+json;charset=utf-8"}`<br/>
117
+ Body:
118
+
119
+ ```
120
+ {
121
+ "uuid": "d2181b32-8b03-4daf-8cc0-d9168b2f6fac",
122
+ "description": "an example webhook",
123
+ "enabled": true,
124
+ "request": {
125
+ "method": "POST",
126
+ "url": "https://example.org/example",
127
+ "headers": {
128
+ "Accept": "application/json"
129
+ },
130
+ "body": {
131
+ "pactUrl": "${pactbroker.pactUrl}"
132
+ },
133
+ "username": "username",
134
+ "password": "**********"
135
+ },
136
+ "events": [
137
+ {
138
+ "name": "contract_content_changed"
139
+ }
140
+ ],
141
+ "createdAt": "2021-09-01T00:07:21+00:00",
142
+ "_links": {
143
+ "self": {
144
+ "title": "an example webhook",
145
+ "href": "http://example.org/webhooks/d2181b32-8b03-4daf-8cc0-d9168b2f6fac"
146
+ },
147
+ "pb:execute": {
148
+ "title": "Test the execution of the webhook with the latest matching pact or verification by sending a POST request to this URL",
149
+ "href": "http://example.org/webhooks/d2181b32-8b03-4daf-8cc0-d9168b2f6fac/execute"
150
+ },
151
+ "pb:webhooks": {
152
+ "title": "All webhooks",
153
+ "href": "http://example.org/webhooks"
154
+ }
155
+ }
156
+ }
157
+ ```
158
+
159
+
160
+
161
+ ## Webhooks
162
+
163
+ Path: `/webhooks`<br/>
164
+ Allowed methods: `GET`, `POST`<br/>
165
+
166
+ ### GET
167
+
168
+ #### Request
169
+
170
+ Headers: `{"Accept":"application/hal+json"}`<br/>
171
+
172
+
173
+ #### Response
174
+
175
+ Status: `200`<br/>
176
+ Headers: `{"Content-Type":"application/hal+json;charset=utf-8"}`<br/>
177
+ Body:
178
+
179
+ ```
180
+ {
181
+ "_links": {
182
+ "self": {
183
+ "title": "Webhooks",
184
+ "href": "http://example.org/webhooks"
185
+ },
186
+ "pb:create": {
187
+ "title": "POST to create a webhook",
188
+ "href": "http://example.org/webhooks"
189
+ },
190
+ "pb:webhooks": [
191
+ {
192
+ "title": "A webhook for the pact between Foo and Bar",
193
+ "name": "an example webhook",
194
+ "href": "http://example.org/webhooks/d2181b32-8b03-4daf-8cc0-d9168b2f6fac"
195
+ }
196
+ ],
197
+ "curies": [
198
+ {
199
+ "name": "pb",
200
+ "href": "http://example.org/doc/webhooks-{rel}",
201
+ "templated": true
202
+ }
203
+ ]
204
+ }
205
+ }
206
+ ```
207
+
208
+
209
+ ### POST
210
+
211
+ #### Request
212
+
213
+ Headers: `{"Content-Type":"application/json","Accept":"application/hal+json"}`<br/>
214
+ Body:
215
+
216
+ ```
217
+ {
218
+ "description": "an example webhook",
219
+ "events": [
220
+ {
221
+ "name": "contract_content_changed"
222
+ }
223
+ ],
224
+ "request": {
225
+ "method": "POST",
226
+ "url": "https://example.org/example",
227
+ "username": "username",
228
+ "password": "password",
229
+ "headers": {
230
+ "Accept": "application/json"
231
+ },
232
+ "body": {
233
+ "pactUrl": "${pactbroker.pactUrl}"
234
+ }
235
+ }
236
+ }
237
+ ```
238
+
239
+
240
+ #### Response
241
+
242
+ Status: `201`<br/>
243
+ Headers: `{"Content-Type":"application/hal+json;charset=utf-8","Location":"http://example.org/webhooks/dCGCl-Ba3PqEFJ_iE9mJkQ"}`<br/>
244
+ Body:
245
+
246
+ ```
247
+ {
248
+ "uuid": "dCGCl-Ba3PqEFJ_iE9mJkQ",
249
+ "description": "an example webhook",
250
+ "enabled": true,
251
+ "request": {
252
+ "method": "POST",
253
+ "url": "https://example.org/example",
254
+ "headers": {
255
+ "Accept": "application/json"
256
+ },
257
+ "body": {
258
+ "pactUrl": "${pactbroker.pactUrl}"
259
+ },
260
+ "username": "username",
261
+ "password": "**********"
262
+ },
263
+ "events": [
264
+ {
265
+ "name": "contract_content_changed"
266
+ }
267
+ ],
268
+ "createdAt": "2021-09-01T00:07:21+00:00",
269
+ "_links": {
270
+ "self": {
271
+ "title": "an example webhook",
272
+ "href": "http://example.org/webhooks/dCGCl-Ba3PqEFJ_iE9mJkQ"
273
+ },
274
+ "pb:execute": {
275
+ "title": "Test the execution of the webhook with the latest matching pact or verification by sending a POST request to this URL",
276
+ "href": "http://example.org/webhooks/dCGCl-Ba3PqEFJ_iE9mJkQ/execute"
277
+ },
278
+ "pb:webhooks": {
279
+ "title": "All webhooks",
280
+ "href": "http://example.org/webhooks"
281
+ }
282
+ }
283
+ }
284
+ ```
285
+
286
+
287
+
288
+ ## Webhooks for consumer
289
+
290
+ Path: `/webhooks/consumer/:consumer_name`<br/>
291
+ Allowed methods: `POST`, `GET`<br/>
292
+
293
+ ### GET
294
+
295
+ #### Request
296
+
297
+ Headers: `{"Accept":"application/hal+json"}`<br/>
298
+
299
+
300
+ #### Response
301
+
302
+ Status: `200`<br/>
303
+ Headers: `{"Content-Type":"application/hal+json;charset=utf-8"}`<br/>
304
+ Body:
305
+
306
+ ```
307
+ {
308
+ "_links": {
309
+ "self": {
310
+ "title": "Webhooks",
311
+ "href": "http://example.org/webhooks/consumer/Foo"
312
+ },
313
+ "pb:create": {
314
+ "title": "POST to create a webhook",
315
+ "href": "http://example.org/webhooks/consumer/Foo"
316
+ },
317
+ "pb:webhooks": [
318
+
319
+ ],
320
+ "curies": [
321
+ {
322
+ "name": "pb",
323
+ "href": "http://example.org/doc/webhooks-{rel}",
324
+ "templated": true
325
+ }
326
+ ]
327
+ }
328
+ }
329
+ ```
330
+
331
+
332
+
333
+ ## Webhooks for a provider
334
+
335
+ Path: `/webhooks/provider/:provider_name`<br/>
336
+ Allowed methods: `POST`, `GET`<br/>
337
+
338
+ ### GET
339
+
340
+ #### Request
341
+
342
+ Headers: `{"Accept":"application/hal+json"}`<br/>
343
+
344
+
345
+ #### Response
346
+
347
+ Status: `200`<br/>
348
+ Headers: `{"Content-Type":"application/hal+json;charset=utf-8"}`<br/>
349
+ Body:
350
+
351
+ ```
352
+ {
353
+ "_links": {
354
+ "self": {
355
+ "title": "Webhooks",
356
+ "href": "http://example.org/webhooks/provider/Bar"
357
+ },
358
+ "pb:create": {
359
+ "title": "POST to create a webhook",
360
+ "href": "http://example.org/webhooks/provider/Bar"
361
+ },
362
+ "pb:webhooks": [
363
+
364
+ ],
365
+ "curies": [
366
+ {
367
+ "name": "pb",
368
+ "href": "http://example.org/doc/webhooks-{rel}",
369
+ "templated": true
370
+ }
371
+ ]
372
+ }
373
+ }
374
+ ```
375
+
376
+
377
+
378
+ ## Webhooks for consumer and provider
379
+
380
+ Path: `/webhooks/provider/:provider_name/consumer/:consumer_name`<br/>
381
+ Allowed methods: `POST`, `GET`<br/>
382
+
383
+ ### GET
384
+
385
+ #### Request
386
+
387
+ Headers: `{"Accept":"application/hal+json"}`<br/>
388
+
389
+
390
+ #### Response
391
+
392
+ Status: `200`<br/>
393
+ Headers: `{"Content-Type":"application/hal+json;charset=utf-8"}`<br/>
394
+ Body:
395
+
396
+ ```
397
+ {
398
+ "_links": {
399
+ "self": {
400
+ "title": "Webhooks",
401
+ "href": "http://example.org/webhooks/provider/Bar/consumer/Foo"
402
+ },
403
+ "pb:create": {
404
+ "title": "POST to create a webhook",
405
+ "href": "http://example.org/webhooks/provider/Bar/consumer/Foo"
406
+ },
407
+ "pb:webhooks": [
408
+ {
409
+ "title": "A webhook for the pact between Foo and Bar",
410
+ "name": "an example webhook",
411
+ "href": "http://example.org/webhooks/d2181b32-8b03-4daf-8cc0-d9168b2f6fac"
412
+ }
413
+ ],
414
+ "curies": [
415
+ {
416
+ "name": "pb",
417
+ "href": "http://example.org/doc/webhooks-{rel}",
418
+ "templated": true
419
+ }
420
+ ]
421
+ }
422
+ }
423
+ ```
424
+
425
+
426
+
427
+ ## Pact webhooks
428
+
429
+ Path: `/pacts/provider/:provider_name/consumer/:consumer_name/webhooks`<br/>
430
+ Allowed methods: `POST`, `GET`<br/>
431
+
432
+ ### GET
433
+
434
+ #### Request
435
+
436
+ Headers: `{"Accept":"application/hal+json"}`<br/>
437
+
438
+
439
+ #### Response
440
+
441
+ Status: `200`<br/>
442
+ Headers: `{"Content-Type":"application/hal+json;charset=utf-8"}`<br/>
443
+ Body:
444
+
445
+ ```
446
+ {
447
+ "_links": {
448
+ "self": {
449
+ "title": "Pact webhooks",
450
+ "href": "http://example.org/pacts/provider/Bar/consumer/Foo/webhooks"
451
+ },
452
+ "pb:create": {
453
+ "title": "POST to create a webhook",
454
+ "href": "http://example.org/pacts/provider/Bar/consumer/Foo/webhooks"
455
+ },
456
+ "pb:webhooks": [
457
+ {
458
+ "title": "A webhook for the pact between Foo and Bar",
459
+ "name": "an example webhook",
460
+ "href": "http://example.org/webhooks/d2181b32-8b03-4daf-8cc0-d9168b2f6fac"
461
+ }
462
+ ],
463
+ "curies": [
464
+ {
465
+ "name": "pb",
466
+ "href": "http://example.org/doc/webhooks-{rel}",
467
+ "templated": true
468
+ }
469
+ ]
470
+ }
471
+ }
472
+ ```
473
+
474
+
475
+
476
+ ## Webhooks status
477
+
478
+ Path: `/pacts/provider/:provider_name/consumer/:consumer_name/webhooks/status`<br/>
479
+ Allowed methods: `GET`<br/>
480
+
481
+ ### GET
482
+
483
+ #### Request
484
+
485
+ Headers: `{"Accept":"application/hal+json"}`<br/>
486
+
487
+
488
+ #### Response
489
+
490
+ Status: `200`<br/>
491
+ Headers: `{"Content-Type":"application/hal+json;charset=utf-8"}`<br/>
492
+ Body:
493
+
494
+ ```
495
+ {
496
+ "summary": {
497
+ "successful": 0,
498
+ "failed": 0,
499
+ "notRun": 1
500
+ },
501
+ "_embedded": {
502
+ "triggeredWebhooks": [
503
+ {
504
+ "name": "POST example.org",
505
+ "status": "not_run",
506
+ "attemptsMade": 1,
507
+ "attemptsRemaining": 6,
508
+ "triggerType": "resource_creation",
509
+ "eventName": "contract_content_changed",
510
+ "triggeredAt": "2021-09-01T00:07:21+00:00",
511
+ "_links": {
512
+ "pb:logs": {
513
+ "href": "http://example.org/triggered-webhooks/6cd5cc48-db3c-4a4c-a36d-e9bedeb9d91e/logs",
514
+ "title": "Webhook execution logs",
515
+ "name": "POST example.org"
516
+ },
517
+ "pb:webhook": {
518
+ "href": "http://example.org/webhooks/d2181b32-8b03-4daf-8cc0-d9168b2f6fac",
519
+ "title": "Webhook",
520
+ "name": "POST example.org"
521
+ }
522
+ }
523
+ }
524
+ ]
525
+ },
526
+ "_links": {
527
+ "self": {
528
+ "href": "http://example.org/pacts/provider/Bar/consumer/Foo/webhooks/status",
529
+ "title": "Webhooks status"
530
+ },
531
+ "pb:error-logs": [
532
+
533
+ ],
534
+ "pb:pact-webhooks": {
535
+ "title": "Webhooks for the pact between Foo and Bar",
536
+ "href": "http://example.org/pacts/provider/Bar/consumer/Foo/webhooks"
537
+ },
538
+ "pb:pact-version": {
539
+ "href": "http://example.org/pacts/provider/Bar/consumer/Foo/version/2",
540
+ "title": "Pact",
541
+ "name": "Pact between Foo (2) and Bar"
542
+ },
543
+ "pb:consumer": {
544
+ "href": "http://example.org/pacticipants/Foo",
545
+ "title": "Consumer",
546
+ "name": "Foo"
547
+ },
548
+ "pb:provider": {
549
+ "href": "http://example.org/pacticipants/Bar",
550
+ "title": "Provider",
551
+ "name": "Bar"
552
+ }
553
+ }
554
+ }
555
+ ```
556
+
557
+
558
+
559
+ ## Executing a saved webhook
560
+
561
+ Path: `/webhooks/:uuid/execute`<br/>
562
+ Allowed methods: `POST`<br/>
563
+
564
+ ### POST
565
+
566
+ #### Request
567
+
568
+ Headers: `{"Content-Type":"application/json","Accept":"application/hal+json"}`<br/>
569
+
570
+
571
+ #### Response
572
+
573
+ Status: `200`<br/>
574
+ Headers: `{"Content-Type":"application/hal+json;charset=utf-8"}`<br/>
575
+ Body:
576
+
577
+ ```
578
+ {
579
+ "request": {
580
+ "headers": {
581
+ "accept": "*/*",
582
+ "user-agent": "Pact Broker v2.87.0",
583
+ "content-type": "application/json"
584
+ },
585
+ "body": {
586
+ "pactUrl": "http://example.org/pacts/provider/Bar/consumer/Foo/pact-version/3e193ecb37ad04b43ce974a38352c704b2e0ed6b/metadata/Y3ZuPTImdz10cnVl"
587
+ },
588
+ "url": "/example"
589
+ },
590
+ "response": {
591
+ "status": 200,
592
+ "headers": {
593
+ },
594
+ "body": ""
595
+ },
596
+ "logs": "[2021-09-01T10:07:21Z] DEBUG: Webhook context {\"base_url\":\"http://example.org\",\"event_name\":\"test\"}\n[2021-09-01T10:07:21Z] INFO: HTTP/1.1 POST https://example.org/example\n[2021-09-01T10:07:21Z] INFO: accept: */*\n[2021-09-01T10:07:21Z] INFO: user-agent: Pact Broker v2.87.0\n[2021-09-01T10:07:21Z] INFO: content-type: application/json\n[2021-09-01T10:07:21Z] INFO: {\"pactUrl\":\"http://example.org/pacts/provider/Bar/consumer/Foo/pact-version/3e193ecb37ad04b43ce974a38352c704b2e0ed6b/metadata/Y3ZuPTImdz10cnVl\"}\n[2021-09-01T10:07:21Z] INFO: HTTP/1.0 200 \n[2021-09-01T10:07:21Z] INFO: \n",
597
+ "success": true,
598
+ "_links": {
599
+ }
600
+ }
601
+ ```
602
+
603
+
604
+
605
+ ## Executing an unsaved webhook
606
+
607
+ Path: `/webhooks/execute`<br/>
608
+ Allowed methods: `POST`<br/>
609
+
610
+ ### POST
611
+
612
+ #### Request
613
+
614
+ Headers: `{"Content-Type":"application/json","Accept":"application/hal+json"}`<br/>
615
+ Body:
616
+
617
+ ```
618
+ {
619
+ "description": "an example webhook",
620
+ "events": [
621
+ {
622
+ "name": "contract_content_changed"
623
+ }
624
+ ],
625
+ "request": {
626
+ "method": "POST",
627
+ "url": "https://example.org/example",
628
+ "username": "username",
629
+ "password": "password",
630
+ "headers": {
631
+ "Accept": "application/json"
632
+ },
633
+ "body": {
634
+ "pactUrl": "${pactbroker.pactUrl}"
635
+ }
636
+ }
637
+ }
638
+ ```
639
+
640
+
641
+ #### Response
642
+
643
+ Status: `200`<br/>
644
+ Headers: `{"Content-Type":"application/hal+json;charset=utf-8"}`<br/>
645
+ Body:
646
+
647
+ ```
648
+ {
649
+ "request": {
650
+ "headers": {
651
+ "accept": "application/json",
652
+ "user-agent": "Pact Broker v2.87.0",
653
+ "authorization": "**********"
654
+ },
655
+ "body": {
656
+ "pactUrl": "http://example.org/pacts/provider/Bar/consumer/Foo/pact-version/3e193ecb37ad04b43ce974a38352c704b2e0ed6b/metadata/Y3ZuPTImdz10cnVl"
657
+ },
658
+ "url": "/example"
659
+ },
660
+ "response": {
661
+ "status": 200,
662
+ "headers": {
663
+ },
664
+ "body": ""
665
+ },
666
+ "logs": "[2021-09-01T10:07:21Z] DEBUG: Webhook context {\"base_url\":\"http://example.org\",\"event_name\":\"test\"}\n[2021-09-01T10:07:21Z] INFO: HTTP/1.1 POST https://example.org/example\n[2021-09-01T10:07:21Z] INFO: accept: application/json\n[2021-09-01T10:07:21Z] INFO: user-agent: Pact Broker v2.87.0\n[2021-09-01T10:07:21Z] INFO: authorization: **********\n[2021-09-01T10:07:21Z] INFO: {\"pactUrl\":\"http://example.org/pacts/provider/Bar/consumer/Foo/pact-version/3e193ecb37ad04b43ce974a38352c704b2e0ed6b/metadata/Y3ZuPTImdz10cnVl\"}\n[2021-09-01T10:07:21Z] INFO: HTTP/1.0 200 \n[2021-09-01T10:07:21Z] INFO: \n",
667
+ "success": true,
668
+ "_links": {
669
+ }
670
+ }
671
+ ```
672
+
673
+
674
+
675
+ ## Triggered webhooks for pact publication
676
+
677
+ Path: `/pacts/provider/:provider_name/consumer/:consumer_name/version/:consumer_version_number/triggered-webhooks`<br/>
678
+ Allowed methods: `GET`<br/>
679
+
680
+ ### GET
681
+
682
+ #### Request
683
+
684
+ Headers: `{"Accept":"application/hal+json"}`<br/>
685
+
686
+
687
+ #### Response
688
+
689
+ Status: `200`<br/>
690
+ Headers: `{"Content-Type":"application/hal+json;charset=utf-8"}`<br/>
691
+ Body:
692
+
693
+ ```
694
+ {
695
+ "_embedded": {
696
+ "triggeredWebhooks": [
697
+ {
698
+ "name": "POST example.org",
699
+ "status": "not_run",
700
+ "attemptsMade": 1,
701
+ "attemptsRemaining": 6,
702
+ "triggerType": "resource_creation",
703
+ "eventName": "contract_content_changed",
704
+ "triggeredAt": "2021-09-01T00:07:21+00:00",
705
+ "_links": {
706
+ "pb:logs": {
707
+ "href": "http://example.org/triggered-webhooks/6cd5cc48-db3c-4a4c-a36d-e9bedeb9d91e/logs",
708
+ "title": "Webhook execution logs",
709
+ "name": "POST example.org"
710
+ },
711
+ "pb:webhook": {
712
+ "href": "http://example.org/webhooks/d2181b32-8b03-4daf-8cc0-d9168b2f6fac",
713
+ "title": "Webhook",
714
+ "name": "POST example.org"
715
+ }
716
+ }
717
+ }
718
+ ]
719
+ },
720
+ "_links": {
721
+ "self": {
722
+ "title": "Webhooks triggered by the publication of the pact between Foo (2) and Bar",
723
+ "href": "http://example.org/pacts/provider/Bar/consumer/Foo/version/2/triggered-webhooks"
724
+ }
725
+ }
726
+ }
727
+ ```
728
+
729
+
730
+
731
+ ## Triggered webhooks for verification publication
732
+
733
+ Path: `/pacts/provider/:provider_name/consumer/:consumer_name/pact-version/:pact_version_sha/verification-results/:verification_number/triggered-webhooks`<br/>
734
+ Allowed methods: `GET`<br/>
735
+
736
+ ### GET
737
+
738
+ #### Request
739
+
740
+ Headers: `{"Accept":"application/hal+json"}`<br/>
741
+
742
+
743
+ #### Response
744
+
745
+ Status: `200`<br/>
746
+ Headers: `{"Content-Type":"application/hal+json;charset=utf-8"}`<br/>
747
+ Body:
748
+
749
+ ```
750
+ {
751
+ "_embedded": {
752
+ "triggeredWebhooks": [
753
+
754
+ ]
755
+ },
756
+ "_links": {
757
+ "self": {
758
+ "title": "Webhooks triggered by the publication of verification result 1",
759
+ "href": "http://example.org/pacts/provider/Bar/consumer/Foo/pact-version/3e193ecb37ad04b43ce974a38352c704b2e0ed6b/verification-results/1/triggered-webhooks"
760
+ }
761
+ }
762
+ }
763
+ ```
764
+
765
+
766
+
767
+ ## Logs of triggered webhook
768
+
769
+ Path: `/triggered-webhooks/:uuid/logs`<br/>
770
+ Allowed methods: `GET`<br/>
771
+
772
+ ### GET
773
+
774
+ #### Request
775
+
776
+ Headers: `{"Accept":"application/hal+json"}`<br/>
777
+
778
+
779
+ #### Response
780
+
781
+ Status: `200`<br/>
782
+ Headers: `{"Content-Type":"text/plain;charset=utf-8"}`<br/>
783
+ Body:
784
+
785
+ ```
786
+ logs
787
+ ```
788
+
789
+