Skip to Content
Mock ServerPin or follow a branch

Pin or follow a branch

A mock server always serves exactly one commit. Its update strategy decides how that commit changes. Both types of mock server support both strategies.

Pin to commitFollow branch
ServesThe commit it was published fromThe latest good commit of the branch
UpdatesWhen you publish it againAutomatically, at every update of the branch
Good forA released version, a partner sandbox, a reproducible testA development or integration environment
PlansEvery planTeam and Enterprise

Pinning is the default in the publish dialog.

Follow a branch

When you publish from a branch, choose Follow branch under Update Strategy. The mock is published from the head of the branch and is republished at every update of it: a push, a merged pull request, a file saved in the APIGit editor, or a pull-mirror sync.

Several updates in quick succession are combined, and the mock goes straight to the newest head.

Update Strategy on a mock server's Setting page

The URL, the access token and, for a code-based mock, the state stay the same across updates, so clients never need to change anything.

Change the strategy later

Open the mock server, choose Setting, and change Update Strategy:

  • Pin to commit it serves now stops the updates and keeps the current commit.
  • Follow branch publishes the head of the chosen branch at once and follows it from then on. Use this to point a mock at a different branch too.

A failed update never takes the mock down

If a new commit cannot be published, the mock server keeps serving its last good commit, and its page shows the reason and the commit that failed. The next update of the branch tries again.

What happenedWhat the mock doesWhat to do
The new commit cannot be published: a served document was deleted or is invalid, a document has a remote $ref, the limits are exceeded, or apigit-mock/ is missing or over 2 MiBKeeps serving the last good commitFix it on the branch. The next update publishes normally.
The branch was deleted or renamedKeeps serving its last commitPoint the mock at another branch, or pin it
The publisher’s account moved to the Free planKeeps serving its last commit and stops updatingUpgrade or pin. Following resumes on a paid plan.

Published API documents have the same two strategies. See Publish an API Document.

Last updated on