Refactor API requests code

We need to change the task status to error if the request failed for
some reason otherwise the validators won't work.

Moved all pending actions to use the unified function for requesting
stuff
Apply pending validators only on creation, not updates
Make sure to always use actual ids, not names