MediaBrowser / Emby

Emby Server is a personal media server with apps on just about every device.
https://emby.media
GNU General Public License v2.0
3.99k stars 792 forks source link

Update the .Policy.SimultaneousStreamLimit with API #3809

Closed bilyboy785 closed 5 months ago

bilyboy785 commented 5 months ago

Hello,

i'm trying to update the .Policy.SimultaneousStreamLimit value of each users with API, but seem's to not be OK.

API returns :

Value cannot be null. (Parameter 'newName')

I tried :

curl -X POST 'https://domain.com/Users/XXXXXXXX?api_key=XXXXXXXX' -H 'accept: application/json' -d '{"Name":"mail@domain.com","Policy":{"SimultaneousStreamLimit":"3"}}'

I tried the full json output too...

Someone can help me to do it ?

LukePulverenti commented 5 months ago

HI, you need to first retrieve the full user object, update the value, and then send the whole thing back.

In the upcoming 4.8 release, some api's have been added that will accept partial json, so gradually over time you'll be able to do what you're doing more and more.

bilyboy785 commented 5 months ago

Thank's @LukePulverenti , I already tried this, but got this error :

#  curl -X POST 'https://domain.com/Users/xxxxxxxxxx?api_key=xxxxxxxxxx' -H 'accept: application/json' -d @data.json
Form key length limit 2048 exceeded.
bilyboy785 commented 5 months ago

@LukePulverenti do you have any idea about this error ?

bilyboy785 commented 5 months ago

I found the solution by get /user full Json, filtering only the Policy array and sending this updated Policy array on the /user/ID/Policy POST api method ;)

LukePulverenti commented 5 months ago

Thanks for following up !