Skip to main content

Publishing pacts

Allowed methods: PUT

A pact is published to the broker using a combination of the provider name, the consumer name, and the consumer application version. The consumer application version will be used to determine which revision of the pact is the "latest" to return to the provider for verification, and will allow you to determine which versions of the consumer and provider are compatible with each other.

The pact generated by your passing consumer tests should be published to the broker during each CI build. Tools exist for this exist in most languages that have an implementation of pact.

Example:

PUT http://broker/pacts/provider/Bar/consumer/Foo/version/1.2.104

{
"consumer": {
"name": "Bar"
},
"provider": {
"name": "Foo"
},
"interactions": [
{
"description" : "a request for something",
"provider_state": "something exists",
"request": {
"method": "get",
"path" : "/something"
},
"response": {
"status": 200,
"body" : "something"
}
}
]
}