Custom fields when creating tasking using API

Custom fields when creating tasking using API

Hi, 

How can we populate task's custom field when creating task with API?

Or, how to update a task, and update custom fields?