BatchGetCommits - Amazon CodeCommit
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

BatchGetCommits

Returns information about the contents of one or more commits in a repository.

Request Syntax

{ "commitIds": [ "string" ], "repositoryName": "string" }

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

The request accepts the following data in JSON format.

commitIds

The full commit IDs of the commits to get information about.

Note

You must supply the full SHA IDs of each commit. You cannot use shortened SHA IDs.

Type: Array of strings

Required: Yes

repositoryName

The name of the repository that contains the commits.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 100.

Pattern: [\w\.-]+

Required: Yes

Response Syntax

{ "commits": [ { "additionalData": "string", "author": { "date": "string", "email": "string", "name": "string" }, "commitId": "string", "committer": { "date": "string", "email": "string", "name": "string" }, "message": "string", "parents": [ "string" ], "treeId": "string" } ], "errors": [ { "commitId": "string", "errorCode": "string", "errorMessage": "string" } ] }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

commits

An array of commit data type objects, each of which contains information about a specified commit.

Type: Array of Commit objects

errors

Returns any commit IDs for which information could not be found. For example, if one of the commit IDs was a shortened SHA ID or that commit was not found in the specified repository, the ID returns an error object with more information.

Type: Array of BatchGetCommitsError objects

Errors

For information about the errors that are common to all actions, see Common Errors.

CommitIdsLimitExceededException

The maximum number of allowed commit IDs in a batch request is 100. Verify that your batch requests contains no more than 100 commit IDs, and then try again.

HTTP Status Code: 400

CommitIdsListRequiredException

A list of commit IDs is required, but was either not specified or the list was empty.

HTTP Status Code: 400

EncryptionIntegrityChecksFailedException

An encryption integrity check failed.

HTTP Status Code: 500

EncryptionKeyAccessDeniedException

An encryption key could not be accessed.

HTTP Status Code: 400

EncryptionKeyDisabledException

The encryption key is disabled.

HTTP Status Code: 400

EncryptionKeyNotFoundException

No encryption key was found.

HTTP Status Code: 400

EncryptionKeyUnavailableException

The encryption key is not available.

HTTP Status Code: 400

InvalidRepositoryNameException

A specified repository name is not valid.

Note

This exception occurs only when a specified repository name is not valid. Other exceptions occur when a required repository parameter is missing, or when a specified repository does not exist.

HTTP Status Code: 400

RepositoryDoesNotExistException

The specified repository does not exist.

HTTP Status Code: 400

RepositoryNameRequiredException

A repository name is required, but was not specified.

HTTP Status Code: 400

Examples

Example

This example illustrates one usage of BatchGetCommits.

Sample Request

>POST / HTTP/1.1 Host: codecommit.us-east-1.amazonaws.com Accept-Encoding: identity Content-Length: 105 X-Amz-Target: CodeCommit_20150413.BatchGetCommits X-Amz-Date: 20190724T201222Z User-Agent: aws-cli/1.11.187 Python/3.4.9 Windows/10 Content-Type: application/x-amz-json-1.1 Authorization: AWS4-HMAC-SHA256 Credential=AKIAI44QH8DHBEXAMPLE/20151028/us-east-1/codecommit/aws4_request, SignedHeaders=content-type;host;user-agent;x-amz-date;x-amz-target, Signature=8d9b5998EXAMPLE { "repositoryName": "MyDemoRepo", "commitIds": [ 317f8570EXAMPLE, 4c925148EXAMPLE ] }

Sample Response

HTTP/1.1 200 OK x-amzn-RequestId: 0728aaa8-EXAMPLE Content-Type: application/x-amz-json-1.1 Content-Length: 1218 Date: Wed, 24 Jul 2019 20:12:13 GMT { "commits": [ { "additionalData": "", "committer": { "date": "1508280564 -0800", "name": "Mary Major", "email": "mary_major@example.com" }, "author": { "date": "1508280564 -0800", "name": "Mary Major", "email": "mary_major@example.com" }, "commitId": "317f8570EXAMPLE", "treeId": "1f330709EXAMPLE", "parents": [ "6e147360EXAMPLE" ], "message": "Change variable name and add new response element" }, { "additionalData": "", "committer": { "date": "1508280542 -0800", "name": "Li Juan", "email": "li_juan@example.com" }, "author": { "date": "1508280542 -0800", "name": "Li Juan", "email": "li_juan@example.com" }, "commitId": "4c925148EXAMPLE", "treeId": "1f330709EXAMPLE", "parents": [ "317f8570EXAMPLE" ], "message": "Added new class" } }

See Also

For more information about using this API in one of the language-specific Amazon SDKs, see the following: