python-plexapi
python-plexapi copied to clipboard
Add support for new Single Item Sharing
Describe the issue Add support to Plex's new Single Item Share
Code snipppets
For server admin accounts
Retrieve shared items:
GET
https://plex.tv/api/v2/shared_sources/owned
https://plex.tv/api/v2/shared_sources/received # unknown returns
Additional params:
ownerId={USER_ID}&includeItems=true
X-Plex-Token and X-Plex-Client-Identifier are required.
owned results:
<sharedSources>
<sharedSource id="5607" origin="server://{MACHINE_ID}" name="SERVERNAME" serverId="{serverId}" status="accepted" sharedItemsCount="1" createdAt="2020-06-12 12:28:51 UTC" accessToken="TOKEN">
<invited id="SHAREDUSERID" uuid="SHAREDUSERuuid" title="SHARED_USERTITLE" username="SHAREDUSERNAME" restricted="0" thumb="https://plex.tv/users/SHAREDUSERuuid/avatar?c=xxxx"/>
<owner id="ADMINUSERID" uuid="ADMINUSERuuid" title="ADMINUSER_TITLE" username="ADMINUSERNAME" restricted="0" thumb="https://plex.tv/users/ADMINUSERuuid/avatar?c=xxxxxx"/>
<sharedItems>
<sharedItem id="9244" uri="server://{MACHINE_ID}/com.plexapp.plugins.library/library/metadata/{RATING_KEY}" status="accepted" title="{TITLE}" type={MEDIA_TYPE} createdAt="2020-06-12 12:41:43 UTC"/>
</sharedItems>
</sharedSource>
</sharedSources>
Share a single item:
POST
https://plex.tv/api/v2/shared_items
Payload
{"items":[{"uri":"server://{MACHINE_ID}/com.plexapp.plugins.library/library/metadata/{RATING_KEY}","type":"{MEDIA_TYPE}","title":"{TITLE}"}],"invitedId":{USERID}}
Only one item can be shared to one user at a time.
To delete a shared item:
DELETE
https://plex.tv/api/v2/shared_items/{SHARED_ITEMID}
For non admin accounts
Get shared items
GET
https://{SERVER_IP:PORT}/library/shared/all?includeMeta=1
Expected behavior Share a single time. Get shared items. Delete single items.