I\'m trying to create a toggle switch that communicates with an API, but I\'m struggling to get hold of the appropriate logic for this scenario. The toggle information is define