How to create HostSets of multiple hosts using API

Dear Team,

I am trying to create host sets in HX using API ( but I am getting multiple errors (raise RemoteDisconnected(“Remote end closed connection without”
urllib3.exceptions.ProtocolError: (‘Connection aborted.’, RemoteDisconnected(‘Remote end closed connection without response’))

Can anyone please explain me on how to create this? Even when I perform curl I am getting empty reply from server. Please assist.