Docs
/
/

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

GET/v1/commits

Query parameters

environment
string

The environment slug.

branch
string

The slug of a branch to use. This option can only be used when environment is "development".

promoted
boolean

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).

resource_type
2 possible types

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.

resource_id
string

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.

after
string

The cursor to fetch entries after.

before
string

The cursor to fetch entries before.

limit
integer

The number of entries to fetch per-page.

Returns

PaginatedCommitResponse

A paginated list of Commit. Contains a list of entries and page information.

entries

A list of entries.

author
CommitAuthor
Required

The author of the commit.

email
string
Required

The email address of the commit author.

name
string

The name of the commit author.

commit_message
string

The optional message about the commit.

created_at
string(date-time)
Required

The timestamp of when the commit was created.

environment
string
Required

The environment of the commit.

id
string(uuid)
Required

The unique identifier for the commit.

resource
CommitResource
Required

The resource object associated with the commit.

identifier
string
Required

The unique identifier for the resource.

type
enum(string)
Required

The type of the resource object.

audienceemail_layoutguidemessage_typepartialtranslationworkflow
page_info

The information about a paginated result.

after
string

The cursor to fetch entries after. Will only be present if there are more entries to fetch.

before
string

The cursor to fetch entries before. Will only be present if there are more entries to fetch before the current page.

page_size
integer

The number of entries to fetch per-page.

Commit all changes

#

Commit all changes across all resources in the development environment.

Endpoint

PUT/v1/commits

Query parameters

environment
string

The environment slug.

branch
string

The slug of a branch to use. This option can only be used when environment is "development".

commit_message
string

An optional message to include in a commit.

resource_type
2 possible types

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.

resource_id
string

Filter changes to commit by resource identifier. Must be used together with resource_type.

Returns

CommitAllResponse

The response from committing all changes.

result
string

The result of the commit operation.

Get a commit

#

Retrieve a single commit by its ID.

Endpoint

GET/v1/commits/{id}

Path parameters

id
string(uuid)

The id of the commit to retrieve.

Returns

A commit is a change to a resource within an environment, made by an author.

author
CommitAuthor

The author of the commit.

email
string

The email address of the commit author.

name
string

The name of the commit author.

commit_message
string

The optional message about the commit.

created_at
string(date-time)

The timestamp of when the commit was created.

environment
string

The environment of the commit.

id
string(uuid)

The unique identifier for the commit.

resource
CommitResource

The resource object associated with the commit.

identifier
string

The unique identifier for the resource.

type
enum(string)

The type of the resource object.

audienceemail_layoutguidemessage_typepartialtranslationworkflow

Promote all changes

#

Promote all changes across all resources to the target environment from its preceding environment.

Endpoint

PUT/v1/commits/promote

Query parameters

to_environment
string

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.

branch
string

The slug of the branch to promote all changes from.

resource_type
2 possible types

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.

resource_id
string

Filter commits to promote by resource identifier. Must be used together with resource_type.

Returns

PromoteAllResponse

The response from promoting all changes.

result
string

The result of the promote operation.

Promote one commit

#

Promotes one change to the subsequent environment.

Endpoint

PUT/v1/commits/{id}/promote

Path parameters

id
string

The target commit ID to promote to the subsequent environment.

Returns

WrappedCommitResponse

Wraps the Commit response under the commit key.

commit

A commit is a change to a resource within an environment, made by an author.

author
CommitAuthor

The author of the commit.

email
string
Required

The email address of the commit author.

name
string

The name of the commit author.

commit_message
string

The optional message about the commit.

created_at
string(date-time)

The timestamp of when the commit was created.

environment
string

The environment of the commit.

id
string(uuid)

The unique identifier for the commit.

resource
CommitResource

The resource object associated with the commit.

identifier
string
Required

The unique identifier for the resource.

type
enum(string)
Required

The type of the resource object.

audienceemail_layoutguidemessage_typepartialtranslationworkflow

Commit

#

A commit is a change to a resource within an environment, made by an author.

Attributes

author
CommitAuthor

The author of the commit.

email
string

The email address of the commit author.

name
string

The name of the commit author.

commit_message
string

The optional message about the commit.

created_at
string(date-time)

The timestamp of when the commit was created.

environment
string

The environment of the commit.

id
string(uuid)

The unique identifier for the commit.

resource
CommitResource

The resource object associated with the commit.

identifier
string

The unique identifier for the resource.

type
enum(string)

The type of the resource object.

audienceemail_layoutguidemessage_typepartialtranslationworkflow
New chat