Commits Management API 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.
The slug of a branch to use. This option can only be used when environment is "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.
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 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 development environment.
Endpoint
Query parameters
The environment slug.
The slug of a branch to use. This option can only be used when environment is "development".
An optional message to include in a commit.
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 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 resource object associated with the commit.
The unique identifier for the resource.
The type of the resource object.
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 resource object associated with the commit.
The unique identifier for the resource.
The type of the resource object.