How to change port profile in UniFi Switch 48 via API/SSH/not-gui

Hi guys,

I have an issue with my freeNAS which uses Mellanox SFP+ card which sometimes will refuse to connect unless either the cable is replugged or port is flapped by changing port profile in UniFI controller to Disabled and then reneabling it by setting it to what it was before.

I tried looking for it already but all I found was code snippets for turning off POE which is not what I want.