All of the Pact client libraries should have an API to allow you to publish pacts directly through that API. If your implementation is missing this feature, please raise an issue.
The recommended way to publish pacts if you can't do so through your Pact client library, is to use the CLI tools which make administration a breeze:
Pacts are published by making a
PUT request to the path
/pacts/provider/PROVIDER/consumer/CONSUMER/version/CONSUMER_VERSION_NUMBER with the pact json document as the body.
Or on Windows:
You most likely won't need to get your hands dirty with curl however, as pact publishing is built in to most of the native pact libraries already. See the Language Support section of the documentation on "Sharing Pacts" on docs.pact.io to find out how to configure pact publishing in your language.
Please read about Pacticipant version numbers to ensure you are using the correct format.
If you are using an older broker, note that the "latest" pact may be determined by inspecting the consumer version number of the pact according to semantic versioning rules, not by the timestamp.
The following URL will return the latest pact between a specified consumer and provider. Keep reading however, as it is not necessarily the URL you should use for retrieving the pact to verify.
latest endpoint returns the latest pact, regardless of tags. If you want to use tagging to enable you to effectively make "feature branch pacts" (RECOMMENDED!), then you should use one of the following two URLs to retrieve the "latest" pact for verification.
To retrieve the latest pact for a given tag (eg.
To retrieve the latest pact without any tags, use:
Use the built in HAL Browser at
/hal-browser/browser.html to explore more endpoints in the pact broker.