Jump to content

create a new user with emby api


Recommended Posts

Posted
5 hours ago, Wane2506 said:

Respon api

 

{"Name":"aaa12","ServerId":"187e8c799f59462ebeb0f4d84b9b6a0e","Prefix":"A","DateCreated":"2024-11-18T06:54:14.1435392Z","Id":"f354199ebd394f428da69fcceeea22a2","HasPassword":false,"HasConfiguredPassword":false,"Configuration":{"PlayDefaultAudioTrack":true,"DisplayMissingEpisodes":false,"SubtitleMode":"Smart","OrderedViews":[],"LatestItemsExcludes":[],"MyMediaExcludes":[],"HidePlayedInLatest":true,"HidePlayedInMoreLikeThis":false,"HidePlayedInSuggestions":false,"RememberAudioSelections":true,"RememberSubtitleSelections":true,"EnableNextEpisodeAutoPlay":true,"ResumeRewindSeconds":0,"IntroSkipMode":"ShowButton","EnableLocalPassword":false},"Policy":{"IsAdministrator":false,"IsHidden":false,"IsHiddenRemotely":true,"IsHiddenFromUnusedDevices":false,"IsDisabled":false,"LockedOutDate":0,"AllowTagOrRating":false,"BlockedTags":[],"IsTagBlockingModeInclusive":false,"IncludeTags":[],"EnableUserPreferenceAccess":true,"AccessSchedules":[],"BlockUnratedItems":[],"EnableRemoteControlOfOtherUsers":false,"EnableSharedDeviceControl":true,"EnableRemoteAccess":true,"EnableLiveTvManagement":true,"EnableLiveTvAccess":true,"EnableMediaPlayback":true,"EnableAudioPlaybackTranscoding":true,"EnableVideoPlaybackTranscoding":true,"EnablePlaybackRemuxing":true,"EnableContentDeletion":false,"RestrictedFeatures":[],"EnableContentDeletionFromFolders":[],"EnableContentDownloading":true,"EnableSubtitleDownloading":true,"EnableSubtitleManagement":false,"EnableSyncTranscoding":true,"EnableMediaConversion":true,"EnabledChannels":[],"EnableAllChannels":true,"EnabledFolders":[],"EnableAllFolders":true,"InvalidLoginAttemptCount":0,"EnablePublicSharing":true,"RemoteClientBitrateLimit":0,"ExcludedSubFolders":[],"SimultaneousStreamLimit":0,"EnabledDevices":[],"EnableAllDevices":true,"AllowCameraUpload":true,"AllowSharingPersonalItems":false},"HasConfiguredEasyPassword":false}

Hi, what do you mean by cannot apply? What are you trying to do?

Posted
19 minutes ago, Luke said:

Hai, apa maksud Anda dengan tidak dapat mendaftar? Apa yang Anda coba lakukan?

I want to create a user account via bot Telegram,

example :

/new <username> <password>

/new aaa12 123

 

The user account has been successfully created,

but the password is still empty

so just an account without a password

hthgihwaymonk
Posted

This is what I use to set the password for a user
 

def set_emby_user_password(emby_api_key, emby_server_url, user_id):
    endpoint = f"{emby_server_url}/Users/{user_id}/Password"
    headers = {
        "Content-Type": "application/x-www-form-urlencoded",
        "X-Emby-Token": emby_api_key
    }
    payload = {
        "NewPw": config.default_password
    }
    response = requests.post(endpoint, headers=headers, data=payload)
    if response.status_code in [200, 204]:
        print(f"Password set successfully for user ID {user_id}")
    else:
        print(f"Failed to set password for user ID {user_id}. Status code: {response.status_code}")

 

Posted
14 hours ago, hthgihwaymonk said:

This is what I use to set the password for a user
 

def set_emby_user_password(emby_api_key, emby_server_url, user_id):
    endpoint = f"{emby_server_url}/Users/{user_id}/Password"
    headers = {
        "Content-Type": "application/x-www-form-urlencoded",
        "X-Emby-Token": emby_api_key
    }
    payload = {
        "NewPw": config.default_password
    }
    response = requests.post(endpoint, headers=headers, data=payload)
    if response.status_code in [200, 204]:
        print(f"Password set successfully for user ID {user_id}")
    else:
        print(f"Failed to set password for user ID {user_id}. Status code: {response.status_code}")

 

I have implemented it,

and it worked.

thank you very much for helping me. @hthgihwaymonk

 

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...