Part of my routine for handling planned and unplanned maintenance events involves using the API to write Run Job tasks for the jobs that will be / have been missed, so I know the API can do it when creating a new task. I've never tried changing the job a task invokes or trying to refer to a variable - I think they're usually deliberate about turning ON variable expansion, so I doubt that would work, but changing the $task.JobTaskControl.JobID and then writing it back to the server probably would if you don't need to specify any variables.
Of course, I've also only ever used the API to add jobs and not to modify existing ones, come to think of it.