# IRPCBackgroundOperationsAdmin.QueueAndGetLatestAsyncTask

Location: [gRPC API](https://developer.m-files.com/APIs/gRPC-API/index.md) > [Administration API](https://developer.m-files.com/APIs/gRPC-API/admin/index.md) > [Background operations](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCBackgroundOperationsAdmin/index.md)

HTML version: https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCBackgroundOperationsAdmin/QueueAndGetLatestAsyncTask/

Badges: `Administration API / specialized` `admin` `session` `idempotent`

Gets the newest asynchronous task of the vault and asks the server to queue pending tasks for
running now.

- **Service:** [Background operations](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCBackgroundOperationsAdmin/index.md) `MFiles.IRPCBackgroundOperationsAdmin`
- **gRPC method:** `/MFiles.IRPCBackgroundOperationsAdmin/QueueAndGetLatestAsyncTask`
- **HTTP (mf-http-grpc):** `POST /grpc/v1/queue-and-get-latest-async-task`
- **Request:** [`QueueAndGetLatestAsyncTaskRequest`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCBackgroundOperationsAdmin/QueueAndGetLatestAsyncTask/index.md#request)
- **Response:** [`QueueAndGetLatestAsyncTaskResponse`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCBackgroundOperationsAdmin/QueueAndGetLatestAsyncTask/index.md#response)
- **Book and level:** Administration API, specialized
- **Kind:** admin
- **Session:** Required: the session ID from LogIn in the mfiles-session-id-bin metadata.
- **Idempotent:** yes
- **Returns metadata structure version:** no
- **Streaming:** none (unary)

<a id="remarks"></a>

## Remarks

- Requires a vault session and the vault right `change_metadata_structure`.
- When a task exists, the server queues the vault's pending tasks for running instead of
  waiting for its next scheduling round, on this server and, by broadcast, on the others.
- Use the returned ID as the starting point when waiting for background work (see the service
  overview).

<a id="request"></a>

## Request: QueueAndGetLatestAsyncTaskRequest

No fields.

<a id="response"></a>

## Response: QueueAndGetLatestAsyncTaskResponse

> Nested message fields are expanded to depth 3; follow a type link for deeper levels and for the type's own page.

| Field | Type | Description |
|---|---|---|
| `is_available` | `bool` | True if the vault has at least one asynchronous task. |
| `async_task` | [`AsyncTask`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.AsyncTask/index.md) | The newest task (highest ID). Valid only if `is_available` is true. |
| `async_task.id` | `int64` | Task ID. |
| `async_task.type` | `string` | Task type name. |
| `async_task.definition` | `string` | The display string of the task definition. |
| `async_task.is_running` | `bool` | True if the task is currently running. |
| `async_task.last_run_started_utc` | [`google.protobuf.Timestamp`](https://protobuf.dev/reference/protobuf/google.protobuf/#timestamp) | The last time the task ran started. Zero to indicate that the task has never run (or is still running for the first time). |
| `async_task.last_run_ended_utc` | [`google.protobuf.Timestamp`](https://protobuf.dev/reference/protobuf/google.protobuf/#timestamp) | The last time the task ran ended. Zero to indicate that the task has never run (or is still running for the first time). |
| `async_task.last_run_succeeded` | `bool` | True if the last run was successful, false otherwise. |
| `async_task.last_run_errors` | `string` | Error string from the last run (if any). |
| `async_task.canceled` | `bool` | True if the task is canceled. |
| `async_task.progress_info` | `string` | The progress info string of the task. |
| `async_task.output_info` | `string` | The output info string of the task. |
