# Datasets_RelinkTask

`POST /v1/accounts/{account}/datasets/{dataset}:relinkTask`

Moves an upload's or a merged dataset's Task link to the Task's newest
published revision, and the links of its takes that name the
same Task, then starts the checks a finished preparation starts: the
heuristic checks and the graph check, as the caller, capped at max_cost.
Publishing a revision relinks nothing and starts no check; this is how a
dataset takes it up (Dataset.latest_task_revision above
linked_task_revision). validate_only answers what it would relink and
the graph run's credit bound, changing nothing. FAILED_PRECONDITION, in
words and with nothing relinked, when nothing is linked or already at
the newest revision, when the Task has no published revision, when
max_cost is below the bound, or when a heuristic check it would rerun is
still running on the dataset. A VLM run on the dataset refuses nothing:
the graph run is queued behind it. ABORTED, nothing relinked, when what
it read changed before it wrote: a link (another RelinkTask moved it, or
UpdateDataset moved the dataset to another Task), the uploads a merged
dataset holds, or the Task's newest revision (one was published since);
ask again.

- Base URL: `https://junction-api.qualiastudios.dev`
- Authentication: an API key in the `X-API-Key` header

## Parameters

- `account` (path, string, required): The account id.
- `dataset` (path, string, required): The dataset id.

## Request body

Required: `application/json` `qualia.v1.RelinkTaskRequest`

## Responses

- `200` OK: `application/json` `qualia.v1.RelinkTaskResponse`
- `default` Default error response: `application/json` `google.rpc.Status`

## Schemas

```yaml
qualia.v1.RelinkTaskRequest:
  required:
    - name
  type: object
  properties:
    name:
      type: string
      description: "accounts/{account}/datasets/{dataset}: an upload or a merged dataset."
    validateOnly:
      type: boolean
      description: |-
        Relink nothing and start nothing: answer what a call would relink and
        the credit bound of the runs it would start.
    maxCost:
      type: string
      description: |-
        The most the graph run may reserve, in credits. Unset: the bound. Below
        the bound: FAILED_PRECONDITION, and nothing is relinked. 0 relinks only
        while no graph run would start: a preview's credit_bound of 0, confirmed.
    requestId:
      type: string
      description: |-
        A UUID naming this call for the heuristic run's admission, so a retry
        starts it once; empty: a new one.
  description: Request for Datasets.RelinkTask.
qualia.v1.RelinkTaskResponse:
  type: object
  properties:
    task:
      type: string
      description: "accounts/{account}/tasks/{task}: the Task the dataset links."
    taskDisplayName:
      type: string
      description: The Task's display name, as its newest revision has it.
    previousRevision:
      type: integer
      description: |-
        The revision the dataset's link carried before; 0 when it was made while
        the Task was a draft.
      format: int32
    revision:
      type: integer
      description: The revision it carries now (with validate_only, would carry).
      format: int32
    relinkedEpisodeCount:
      type: integer
      description: Takes whose own link to the Task moved with it (or would).
      format: int32
    checkRuns:
      type: array
      items:
        type: string
      description: |-
        accounts/{account}/checks/{check}/runs/{run}: the runs started, heuristic
        first; empty with validate_only. The graph run is left out when it has
        nothing to read (no take with a published video).
    creditBound:
      type: string
      description: |-
        The credit bound of the graph run: its estimate, what it may reserve at
        most. 0 when no graph run starts. Heuristic runs reserve nothing.
  description: Response for Datasets.RelinkTask.
google.rpc.Status:
  oneOf:
    - $ref: "#/components/schemas/ApiError"
    - $ref: "#/components/schemas/GatewayError"
  description: "The body of a failed call: one of the two shapes below."
ApiError:
  title: API error
  type: object
  required:
    - code
    - message
    - retryable
    - details
  properties:
    code:
      type: string
      description: The gRPC code name in upper case, e.g. `NOT_FOUND`.
    message:
      type: string
    retryable:
      type: boolean
      description: Whether the same call may succeed if retried.
    details:
      type: array
      items:
        type: object
      description: "Empty, except when a dataset copy or move is refused: then one `google.rpc.ErrorInfo` with the refusal's `reason` code, its `domain` and, in `metadata`, the datasets it names."
  description: A refusal from the API itself.
GatewayError:
  title: Gateway error
  type: object
  required:
    - detail
  properties:
    detail:
      type: string
      description: What went wrong.
  description: A refusal from the gateway before the call reaches the API, for example `401` bad or missing API key, `403` key lacks the scope or environment closed, `413` body too large.
```
