# Method: projects.locations.connections.gitRepositoryLinks.fetchGitRefs

- [HTTP request](https://docs.cloud.google.com/developer-connect/docs/api/reference/rest/v1/projects.locations.connections.gitRepositoryLinks/fetchGitRefs#body.HTTP_TEMPLATE)
- [Path parameters](https://docs.cloud.google.com/developer-connect/docs/api/reference/rest/v1/projects.locations.connections.gitRepositoryLinks/fetchGitRefs#body.PATH_PARAMETERS)
- [Query parameters](https://docs.cloud.google.com/developer-connect/docs/api/reference/rest/v1/projects.locations.connections.gitRepositoryLinks/fetchGitRefs#body.QUERY_PARAMETERS)
- [Request body](https://docs.cloud.google.com/developer-connect/docs/api/reference/rest/v1/projects.locations.connections.gitRepositoryLinks/fetchGitRefs#body.request_body)
- [Response body](https://docs.cloud.google.com/developer-connect/docs/api/reference/rest/v1/projects.locations.connections.gitRepositoryLinks/fetchGitRefs#body.response_body)
  - [JSON representation](https://docs.cloud.google.com/developer-connect/docs/api/reference/rest/v1/projects.locations.connections.gitRepositoryLinks/fetchGitRefs#body.FetchGitRefsResponse.SCHEMA_REPRESENTATION)
- [Authorization scopes](https://docs.cloud.google.com/developer-connect/docs/api/reference/rest/v1/projects.locations.connections.gitRepositoryLinks/fetchGitRefs#body.aspect)
- [IAM Permissions](https://docs.cloud.google.com/developer-connect/docs/api/reference/rest/v1/projects.locations.connections.gitRepositoryLinks/fetchGitRefs#body.aspect_1)
- [RefType](https://docs.cloud.google.com/developer-connect/docs/api/reference/rest/v1/projects.locations.connections.gitRepositoryLinks/fetchGitRefs#RefType)
- [Try it!](https://docs.cloud.google.com/developer-connect/docs/api/reference/rest/v1/projects.locations.connections.gitRepositoryLinks/fetchGitRefs#try-it)

Fetch the list of branches or tags for a given repository.

### HTTP request

`GET https://developerconnect.googleapis.com/v1/{gitRepositoryLink=projects/*/locations/*/connections/*/gitRepositoryLinks/*}:fetchGitRefs`

The URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.

### Path parameters

| Parameters ||
|---|---|
| `gitRepositoryLink` | `string` Required. The resource name of GitRepositoryLink in the format `projects/*/locations/*/connections/*/gitRepositoryLinks/*`. |

### Query parameters

| Parameters ||
|---|---|
| `refType` | ``enum (`https://docs.cloud.google.com/developer-connect/docs/api/reference/rest/v1/projects.locations.connections.gitRepositoryLinks/fetchGitRefs#RefType`)`` Required. Type of refs to fetch. |
| `pageSize` | `integer` Optional. Number of results to return in the list. Default to 20. |
| `pageToken` | `string` Optional. Page start. |

### Request body

The request body must be empty.

### Response body

Response for fetching git refs.

If successful, the response body contains data with the following structure:

| JSON representation |
|---|
| ``` { "refNames": [ string ], "nextPageToken": string } ``` |

| Fields ||
|---|---|
| `refNames[]` | `string` Name of the refs fetched. |
| `nextPageToken` | `string` A token identifying a page of results the server should return. |

### Authorization scopes

Requires the following OAuth scope:

- `https://www.googleapis.com/auth/cloud-platform`

For more information, see the [Authentication Overview](https://docs.cloud.google.com/docs/authentication#authorization-gcp).

### IAM Permissions

Requires the following [IAM](https://cloud.google.com/iam/docs) permission on the `gitRepositoryLink` resource:

- `developerconnect.gitRepositoryLinks.fetchGitRefs`

For more information, see the [IAM documentation](https://cloud.google.com/iam/docs).

## RefType

Type of refs.

| Enums ||
|---|---|
| `REF_TYPE_UNSPECIFIED` | No type specified. |
| `TAG` | To fetch tags. |
| `BRANCH` | To fetch branches. |