REST API associate specific VM

api/compute_resources/<id>/associate is not working for me. Keep getting
"interfaces should have vm or template" error. From the GUI I can easily
associate a specific VM by opening it from "Virtual Machines" tab, but
can't do the same from REST API. Is it there and I am missing it?
I have access to foreman installation. Is there a patch I can install for
this to work?