https://prefect.io logo
Title
z

Zhilong Li

07/13/2021, 9:26 AM
Hi! I'm fairly new to prefect and I wanted to ask about the manual_only trigger for a task. For a task that's waiting for manual approval, does the server expose an API that I can call to send the approval signal? I have my Prefect server up on Kubernetes. Thanks in advance
n

nicholas

07/13/2021, 1:58 PM
Hi @Zhilong Li - yes! You can approve the task by setting the state of your task run to `Resume`; this can be done with this mutation:
mutation setTaskRunStates($input: [set_task_run_state_input!]!) {
  set_task_run_states(input: { states: $input }) {
    states {
      id
    }
  }
}
where
$input
is a payload that looks like this:
[{
"version": string,
"task_run_id": uuid!,
"state": {
  type: string!, ("Resume", in this case)
  message: string
}]
z

Zhilong Li

07/14/2021, 1:11 AM
ah, so i'll need to interface with the graphql api. Thank you for the response and thank you for building such a great product!
n

nicholas

07/14/2021, 1:17 AM
You don't need to use the api! The UI exposes tasks that are awaiting approval which can be resumed from there. However if you're interacting with the system through code you'll need to use the graphql api
Glad you're finding some value from the product 🙂
🙌 1