"No route to resource/endpoint" at startup for RESTful switch pointing to own API

I have a RESTful switch configured which calls the HASS’s own API (I’m trying to change an entity’s “hidden” state), however it fails and the log shows “No route to resource/endpoint”. I’m able to curl to the endpoint at the same address, so what I think might be happening is that the RESTful switch is checking the endpoint before the API is online.

A couple of questions:

  1. Is there a better way to change an entity’s hidden state? I don’t want to put it into its own group and use the group show/hide.
  2. Any other ideas how to call HASS’s own API from a switch?

Thanks!

Can’t you just set it to hidden: true in your config?

some entity:
   hidden: true

Yes, thanks, I’ve already done that. I need to toggle its visibility on or off in response to an event/automation. I was hoping to use a RESTful switch to toggle its hidden state property, since it doesn’t appear that I can manipulate its state directly from within another HA event (but I can turn a switch to “on”).

Thanks!