Commits mAPI reference
Complete reference documentation for the Commits resource.
Commits
#To version the changes you make in your environments, Knock uses a commit model. When you make changes to a workflow, a layout, or a translation, you will need to commit them in your development environment, then promote to subsequent environments before those changes will appear in the respective environments.
You can retrieve all commits in a given environment, or show the details of one single commit based on the target commit id.
List commits
#Returns a paginated list of commits in a given environment. The commits are ordered from most recent first.
Endpoint
Query parameters
The environment slug. When omitted, the account's default environment is used.
The slug of a branch to use. When environment is omitted, the branch is resolved from Development after the account default is injected. When environment is supplied, it must be "development".
Whether to show commits in the given environment that have not been promoted to the subsequent environment (false) or commits which have been promoted (true).
Filter commits by resource type(s). Accepts a single type or array of types. Can be combined with resource_id to filter for specific resources.
Filter commits by resource identifier. Must be used together with resource_type. For most resources, this will be the resource key. In the case of translations, this will be the locale code and namespace, separated by a /. For example, en/courses or en.
Filter commits to those created by a single promote. Every commit copied into an environment by the same promote shares one promote_group_id.
Filter promoted commits by the slug of the environment or branch they were promoted from.
Only return commits created at or after this RFC 3339 timestamp. Useful for catching up after missed webhooks.
Only return commits created at or before this RFC 3339 timestamp.
The cursor to fetch entries after.
The cursor to fetch entries before.
The number of entries to fetch per-page.
Returns
A paginated list of Commit. Contains a list of entries and page information.
A list of entries.
The author of the commit.
The email address of the commit author.
The name of the commit author.
The optional message about the commit.
The timestamp of when the commit was created.
The environment of the commit.
The unique identifier for the commit.
The identifier of the promote that created this commit, shared by every commit copied into the environment by the same promote. Null if the commit was not created by a promote.
The ID of the commit this commit was promoted from. Null if the commit was not created by a promote.
The resource object associated with the commit.
The unique identifier for the resource.
The type of the resource object.
The information about a paginated result.
The cursor to fetch entries after. Will only be present if there are more entries to fetch.
The cursor to fetch entries before. Will only be present if there are more entries to fetch before the current page.
The number of entries to fetch per-page.
Commit all changes
#Commit all changes across all resources in the given environment. When writes are limited to development, this endpoint accepts the development environment.
Endpoint
Query parameters
The environment slug. When omitted, the account's default environment is used.
The slug of a branch to use. When environment is omitted, the branch is resolved from Development after the account default is injected. When environment is supplied, it must be "development".
An optional message to include in a commit.
When used with a single resource_type and resource_id, creates a new version with identical content and commits it if there are no unpublished changes.
Filter changes to commit by resource type(s). Accepts a single type or array of types. Can be combined with resource_id to filter for specific resources.
Filter changes to commit by resource identifier. Must be used together with resource_type.
Returns
The response from committing all changes.
The result of the commit operation.
Get a commit
#Retrieve a single commit by its ID.
Endpoint
Path parameters
The id of the commit to retrieve.
Returns
A commit is a change to a resource within an environment, made by an author.
The author of the commit.
The email address of the commit author.
The name of the commit author.
The optional message about the commit.
The timestamp of when the commit was created.
The environment of the commit.
The unique identifier for the commit.
The identifier of the promote that created this commit, shared by every commit copied into the environment by the same promote. Null if the commit was not created by a promote.
The ID of the commit this commit was promoted from. Null if the commit was not created by a promote.
The resource object associated with the commit.
The unique identifier for the resource.
The type of the resource object.
Promote all changes
#Promote all changes across all resources to the target environment from its preceding environment.
Endpoint
Query parameters
A slug of the target environment to which you want to promote all changes from its directly preceding environment.
For example, if you have three environments “development”, “staging”, and “production” (in that order), setting this param to “production” will promote all commits not currently in production from staging.
When this param is set to "development", the "branch" param must be provided.
The slug of the branch to promote all changes from.
Filter commits to promote by resource type(s). Accepts a single type or array of types. Can be combined with resource_id to filter for specific resources.
Filter commits to promote by resource identifier. Must be used together with resource_type.
Returns
The response from promoting all changes.
The result of the promote operation.
Promote one commit
#Promotes one change to the subsequent environment.
Endpoint
Path parameters
The target commit ID to promote to the subsequent environment.
Returns
Wraps the Commit response under the commit key.
A commit is a change to a resource within an environment, made by an author.
The author of the commit.
The email address of the commit author.
The name of the commit author.
The optional message about the commit.
The timestamp of when the commit was created.
The environment of the commit.
The unique identifier for the commit.
The identifier of the promote that created this commit, shared by every commit copied into the environment by the same promote. Null if the commit was not created by a promote.
The ID of the commit this commit was promoted from. Null if the commit was not created by a promote.
The resource object associated with the commit.
The unique identifier for the resource.
The type of the resource object.
A summary of a promote. Every commit copied into the destination environment by the same promote shares the group's ID, which you can use to list them with the promote_group_id filter on the list commits endpoint.
The user who performed the promote.
The number of commits copied into the destination environment.
The timestamp of when the promote happened.
The unique identifier for the promote group.
The slug of the environment or branch the commits were promoted from.
Whether the source is an environment or a branch.
The slug of the environment the commits were promoted to.
Commit
#A commit is a change to a resource within an environment, made by an author.
Attributes
The author of the commit.
The email address of the commit author.
The name of the commit author.
The optional message about the commit.
The timestamp of when the commit was created.
The environment of the commit.
The unique identifier for the commit.
The identifier of the promote that created this commit, shared by every commit copied into the environment by the same promote. Null if the commit was not created by a promote.
The ID of the commit this commit was promoted from. Null if the commit was not created by a promote.
The resource object associated with the commit.
The unique identifier for the resource.
The type of the resource object.
PromoteGroup
#A summary of a promote. Every commit copied into the destination environment by the same promote shares the group's ID, which you can use to list them with the promote_group_id filter on the list commits endpoint.
Attributes
The user who performed the promote.
The number of commits copied into the destination environment.
The timestamp of when the promote happened.
The unique identifier for the promote group.
The slug of the environment or branch the commits were promoted from.
Whether the source is an environment or a branch.
The slug of the environment the commits were promoted to.