I reckon I've run into the same problem. I've created one port profile from Meraki Dashboard. Then based the API call "updateDeviceSwitchPort", I wanted to apply the profile to one specific switch port. I used the parameter "profile={'enabled': True, 'iname': 'test_profile'}", but it gave me the error "400 Bad Request Port profile must belong to the same switch group as the port it is assigned to". Don't get it at all. If I applied the profile to the switchport from the Dashboard directly, saved it and then disabled it (removed the port profile from the switchport). Finally run that API call again with the same profile parameter, it worked and added the profile back to the switchport. But it made no sense to me if it has to be bound first from Dashboard
Another finding is that after the port profile is added to one switchport from Dashboard first, with get API call, there will be a profile id in the response output. By using this id instead of "iname" in the profile parameter, with API put call, this profile can be applied successfully to other switchports. HOWEVER, how could I know the profile id before I bound it with one switchport first? Total mess. Please let me know your thoughts or test results. Thx.