How to send file as Form data to Connect REST API

I am trying to send a file to service as Multipart Form Data as content type to Connect Rest POST method. I tried with the solution given in pdn to use pyRequestAttachmentPage. But I am facing 400 error from the service. I want to know how to check if the file is being passed on to the service and how the configuration has to be in the REST rule for it.

This article helped to resolve the issue.

thanks