How to upload images in a specific folder using API

The problem is solved.
Actually in the regular WordPress API for uploading media
wp/v2/media
please add one more form data entry rmlFolder: <the_id_of_destination_folder>
That is all, it gets uploaded in the correct folder.

I am posting my code (in Java based on a library not written by me)

Before the patch for supporting RML plugin

After the patch
After the patch for supporting RML plugin