API: /clients endpoint returns no clients

I’m new to Plex. For a custom coding project (Crestron), I’m using Postman to explore what is known about the unofficial API, principally using the info at Home · Arcanemagus/plex-api Wiki · GitHub. I am using Plex Web to serve from a Win11 PC to an Apple TV 4K (2022); both are on the same local network. That works, and I can use various API endpoints to recover Now Playing info as well as metadata about my library. For playback control, I want to obtain the X-Plex-Target-Client identifier. However, the /clients endpoint returns no clients. This is true even though the /devices endpoint understands about the Apple TV and returns what appears to be a valid clientIdentifier. What am I missing here?

The issue seems to be identical to one posted but not resolved on Reddit some years ago. The user wrote:

The /clients endpoint on my Plex Server isn’t returning any clients:

<?xml version="1.0" encoding="UTF-8"?>
<MediaContainer size="0"></MediaContainer>

I’ve been trying to use the /player/playback/{command} endpoint. But it gives me the error that the identifier is not found. I’ve checked the source code via the stacktrace I get back to /usr/lib/plexmediaserver/Resources/Plug-ins-31d3c0c65/System.bundle/Contents/Code/playerservice.py which checks the endpoint /clients and looks at the machineIdentifiers (of which a valid value I am passing which I got from the localStorage or https://plex.tv/devices.xml). But because /clients returns an empty list it always gives a 500 Internal Server error saying the identifier doesn’t exist. I’ve tried to make a post on the forums, but all of my posts on the forum so far have been ignored.

Does anyone know what could be the cause of this? I’ve seen people mention bad firewall setups (which I’ve disabled for testing and that doesn’t change anything).

Your advice would be much appreciated. Thanks.

Did you include your token?

Yes, I did include the token. If one doesn’t, one gets an “Unauthorized” response. With the token, I get a valid response, but it’s an array of size 0.

This issue may or may not be related to the fact that the Apple TV 4K has almost never shown up when I press the Select Player button on the web interface. Once, when I tried signing out and back in again to the Apple TV, it showed up briefly under Select Player. But it went away when I clicked on it, and I haven’t been able to get it back, either by signing out of everything, restarting, rebooting, etc. It would be helpful if someone could confirm that they have been able to control the newest version of the Apple TV 4K with Plex, either by using Select Player or through the /clients endpoint.

Just to be clear, the Plex Settings button for Advertise Player is checked. I used Wireshark to look at the traffic between my PC and the network. In response to the query sent out by Select Player, the Apple TV does send something (encrypted) back.

I understand that the Companion protocol is superceding (or has superceded) previous remote-control protocols. Can these issues have anything to do with that? The sparse documentation I have been able to find is several years old.

Thanks.

Is GDM enabled on the server?

Yes, GDM (local network discovery) is enabled.

  • Is the clients on the same IP Net?
  • Did you make sure, that the NIC used belongs to the Private FW profile, so GDM is allowed?

Yes, the server and the client are on the same VLAN (as stated in my original post).

The Windows 11 Network Profile is set to Private.

For a short test, could you try and disable the FW on the PMS server?

Turning off the firewall on my Windows machine makes no difference; I had already tried that, and I tried it again just to be sure.

The firewall is set to allow the following ports:

TCP: 32400
UDP: 32410, 32412, 32413, 32414

I have spent more time looking at Wireshark traffic. When I issue a GET /clients message from Postman, I can see the server do a UDP broadcast to my local network. Once out of dozens of tries, I then got a response from the Apple TV 4K that had in it some clear text that looked like an ID. But the request still gave me a client list of size 0. And that was just once. Similarly, just once (a different time) the Apple TV 4K showed up (for a few seconds) in the Select Player list. Surely the behavior shouldn’t be erratic like that.

Clearly, the Apple TV is indeed a client of the PMS server, since I can play things through it (and of course it shows up as one of the Authorized Devices). Given that, can you think of circumstances in which the /clients endpoint would nevertheless not return client information for that device?

Thanks.