GetFile
Gets the contents of a file from a repository branch. Files can be up to 1 MiB. The AWS Management Console uses this operation when you create an app from a repository. To view files in detail, use your Git provider.
Request Syntax
GET /git-connections/file?branch=Branch&filePath=FilePath&owner=Owner&provider=Provider&repositoryName=RepositoryName&repositoryPath=RepositoryPath HTTP/1.1
URI Request Parameters
The request uses the following URI parameters.
- Branch
-
The name of the branch to read from.
Length Constraints: Minimum length of 1. Maximum length of 1024.
Required: Yes
- FilePath
-
The path of the file, relative to the root of the repository, for example package.json.
Length Constraints: Minimum length of 1. Maximum length of 4096.
Required: Yes
- Owner
-
The account that the Git connection is for. The value depends on the provider:
-
For GitHub, specify the user or organization name.
-
For GitLab, specify the user name.
To get this value, call ListGitConnections.
Length Constraints: Minimum length of 1. Maximum length of 255.
Required: Yes
-
- Provider
-
The Git provider.
Valid Values:
GITHUB | GITLABRequired: Yes
- RepositoryName
-
The name of the repository, which is the last segment of RepositoryPath.
Length Constraints: Minimum length of 1. Maximum length of 255.
- RepositoryPath
-
The full path of the repository in the Git provider, for example my-org/my-app. GitLab paths can include subgroups, for example my-group/subgroup/my-app. To get this value, call ListRepositories.
Length Constraints: Minimum length of 1. Maximum length of 1024.
Required: Yes
Request Body
The request does not have a request body.
Response Syntax
HTTP/1.1 200
Content-type: application/json
{
"Content": blob,
"FilePath": "string",
"Sha": "string",
"Size": number
}
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.
- Content
-
The contents of the file.
Type: Base64-encoded binary data object
- FilePath
-
The path of the file that was returned.
Type: String
- Sha
-
The Git object ID (blob SHA) of the file's contents. It changes whenever the file's contents change.
Type: String
- Size
-
The size of the file, in bytes.
Type: Long
Errors
For information about the errors that are common to all actions, see Common Error Types.
- AccessDeniedException
-
You do not have sufficient permissions to perform this action.
- message
-
A message that describes the error.
HTTP Status Code: 403
- GitConnectionDisconnectedException
-
The Git connection doesn't exist, or the Git provider no longer accepts its access. For example, the app was uninstalled or access was revoked. Reconnect the Git provider account, and then try again.
- message
-
A message that describes the error.
HTTP Status Code: 409
- InternalServerException
-
An internal error occurred. Retry the request.
- message
-
A message that describes the error.
- retryAfterSeconds
-
The number of seconds to wait before you retry the request.
HTTP Status Code: 500
- ThrottlingException
-
The request was denied because the request rate exceeds the allowed limit.
- message
-
A message that describes the error.
- quotaCode
-
The code of the service quota that caused the throttling.
- retryAfterSeconds
-
The number of seconds to wait before you retry the request.
- serviceCode
-
The code of the service that the quota belongs to.
HTTP Status Code: 429
- ValidationException
-
The request contains invalid parameters or is otherwise malformed.
- message
-
A message that describes the error.
HTTP Status Code: 400
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: