# Method: projects.locations.environments.pollAirflowCommand

- [HTTP request](https://docs.cloud.google.com/composer/docs/reference/rest/v1/projects.locations.environments/pollAirflowCommand#body.HTTP_TEMPLATE)
- [Path parameters](https://docs.cloud.google.com/composer/docs/reference/rest/v1/projects.locations.environments/pollAirflowCommand#body.PATH_PARAMETERS)
- [Request body](https://docs.cloud.google.com/composer/docs/reference/rest/v1/projects.locations.environments/pollAirflowCommand#body.request_body)
  - [JSON representation](https://docs.cloud.google.com/composer/docs/reference/rest/v1/projects.locations.environments/pollAirflowCommand#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://docs.cloud.google.com/composer/docs/reference/rest/v1/projects.locations.environments/pollAirflowCommand#body.response_body)
  - [JSON representation](https://docs.cloud.google.com/composer/docs/reference/rest/v1/projects.locations.environments/pollAirflowCommand#body.PollAirflowCommandResponse.SCHEMA_REPRESENTATION)
- [Authorization scopes](https://docs.cloud.google.com/composer/docs/reference/rest/v1/projects.locations.environments/pollAirflowCommand#body.aspect)
- [Line](https://docs.cloud.google.com/composer/docs/reference/rest/v1/projects.locations.environments/pollAirflowCommand#Line)
  - [JSON representation](https://docs.cloud.google.com/composer/docs/reference/rest/v1/projects.locations.environments/pollAirflowCommand#Line.SCHEMA_REPRESENTATION)
- [ExitInfo](https://docs.cloud.google.com/composer/docs/reference/rest/v1/projects.locations.environments/pollAirflowCommand#ExitInfo)
  - [JSON representation](https://docs.cloud.google.com/composer/docs/reference/rest/v1/projects.locations.environments/pollAirflowCommand#ExitInfo.SCHEMA_REPRESENTATION)
- [Try it!](https://docs.cloud.google.com/composer/docs/reference/rest/v1/projects.locations.environments/pollAirflowCommand#try-it)

Polls Airflow CLI command execution and fetches logs.

### HTTP request

`POST https://composer.googleapis.com/v1/{environment=projects/*/locations/*/environments/*}:pollAirflowCommand`

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

### Path parameters

| Parameters ||
|---|---|
| `environment` | `string` The resource name of the environment in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}" Authorization requires the following [IAM](https://cloud.google.com/iam/docs/) permission on the specified resource `environment`: - `composer.environments.executeAirflowCommand` |

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { "executionId": string, "pod": string, "podNamespace": string, "nextLineNumber": integer } ``` |

| Fields ||
|---|---|
| `executionId` | `string` The unique ID of the command execution. |
| `pod` | `string` The name of the pod where the command is executed. |
| `podNamespace` | `string` The namespace of the pod where the command is executed. |
| `nextLineNumber` | `integer` Line number from which new logs should be fetched. |

### Response body

Response to PollAirflowCommandRequest.

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

| JSON representation |
|---|
| ``` { "output": [ { object (`https://docs.cloud.google.com/composer/docs/reference/rest/v1/projects.locations.environments/pollAirflowCommand#Line`) } ], "outputEnd": boolean, "exitInfo": { object (`https://docs.cloud.google.com/composer/docs/reference/rest/v1/projects.locations.environments/pollAirflowCommand#ExitInfo`) } } ``` |

| Fields ||
|---|---|
| `output[]` | ``object (`https://docs.cloud.google.com/composer/docs/reference/rest/v1/projects.locations.environments/pollAirflowCommand#Line`)`` Output from the command execution. It may not contain the full output and the caller may need to poll for more lines. |
| `outputEnd` | `boolean` Whether the command execution has finished and there is no more output. |
| `exitInfo` | ``object (`https://docs.cloud.google.com/composer/docs/reference/rest/v1/projects.locations.environments/pollAirflowCommand#ExitInfo`)`` The result exit status of the command. |

### Authorization scopes

Requires one of the following OAuth scopes:

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

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

## Line

Contains information about a single line from logs.

| JSON representation |
|---|
| ``` { "lineNumber": integer, "content": string } ``` |

| Fields ||
|---|---|
| `lineNumber` | `integer` Number of the line. |
| `content` | `string` Text content of the log line. |

## ExitInfo

Information about how a command ended.

| JSON representation |
|---|
| ``` { "exitCode": integer, "error": string } ``` |

| Fields ||
|---|---|
| `exitCode` | `integer` The exit code from the command execution. |
| `error` | `string` Error message. Empty if there was no error. |