Jump to content

First use of API POST help (was Help for recover emby configuration)


nbedendo

Recommended Posts

nbedendo

Sorry if is ot the right place but i do not have so much time with the vpn who i use for be on the forum now... today on reddit and then on discord (i have restriction here for website but not for the above social) i did a post where i asked:

___

Question about set a value using API

 

Hi, i’m totally new to API and before to make some mistake just a question. If I want to change a single value I can just send the POST with the single value as json or i need to send back all the dictionary? I want to create an automation who when i leave my house set “EnableRemoteAccess” on true and viceversa

-------

Than i was not able to wait and did my first POST and the result is that i did something wrong and Emby now ask me to setup instead of the login page.

BTW i had the backup plugin and hope that this help.. hope to receive help and be able to read here :)

Edited by nbedendo
Link to comment
Share on other sites

nbedendo

tnx for moving

the post… now beside the wrong use of the API i just need to know if using the backup file on mac server i can restore my conf cause now i think that that my error only impacted on the system.xml but before increase the problem i just prefer to ask….

after that i would like also know what i did wrong or at lest know how to send a post call for change a value in a dictio ary :)

Link to comment
Share on other sites

nbedendo

Ok i was able to restart my server with an old version then update and now look than i do not have lost nothing in my library and this is the most important result, BUT i was again in the situation where all my media in any single dir now look grouped and i have to manually do the "Split Version Apart" like discussed here. While in future version you will add a setting for disable this feature there any way to al least know what media emby grouped? I really go crazy to rename manually on the metadata manager and then replace the nfo file who i backup in a separate dir using an homemade bash script. I will realy appreciate to go deeper in that operation.. mayne in a log i can see the "group" task and save time to first find the media who was grouped instead of see one be one if 1 media hidden others media inside in a 12000 file :P

Then back to the action who create that situation i did something wrong in the POST api call to and i due to the fact that i never used API since 30 day ago and till now i just used alway for GET the data for sure i did something wrong if the result was the Emby ask to be configured like after fresh install.

Let me share with you what i want to do and what i did and i will be gratefull to have just a tip on what i did wrong.

I would like to have a simple automation who when i leave my house change the value: "EnableRemoteAccess" from false to true in using http://192.168.1.16:8096/emby/System/Configuration?api_key=Value and in order to do this i use an nfc tag who is the trigger for a routine who include other task related to the same action.

I use automation in IOS15.3.1 who basically have a "flow language" who is a sort of graphical versione of typesript but i do not think that is relevant.

The action is simple

---

GET DATA FROM ENDPOINT (who behind the scene do a CURL command)

GET DICTIPONARY FROM RESPONSE (i told to the interpreter that the response is a dictionary json)

GET VALUE FOR EnableRemoteAccess IN DICTIONARY

IF VALUE IS "true" SET VALUE TO "false"

POST DICTIONARY AS BODY TO ENDPOINT

---

This is the DICTIONARY who i sent:

---

{"EnableDashboardResponseCaching":true,"HttpsPortNumber":8920,"EnableAutomaticRestart":true,"DatabaseAnalysisLimit":400,"EnableUPnP":true,"UninstalledPlugins":[],"HttpServerPortNumber":8096,"IsPortAuthorized":false,"PreferredMetadataLanguage":"en","EnableHttps":false,"LocalNetworkAddresses":[],"EnableExternalContentInSuggestions":true,"VacuumDatabaseOnStartup":false,"DatabaseCacheSizeMB":96,"SortRemoveWords":["the","a","an","das","der","el","la"],"LogFileRetentionDays":3,"LogAllQueryTimes":false,"UICulture":"en-us","IsBehindProxy":false,"EnableDebugLevelLogging":false,"IsStartupWizardCompleted":false,"LibraryMonitorDelay":60,"LocalNetworkSubnets":[],"ChannelOptionsUpgraded":false,"RemoteClientBitrateLimit":0,"SaveMetadataHidden":false,"PublicHttpsPort":8920,"RequireHttps":false,"OptimizeDbOnShutdown":false,"MetadataCountryCode":"US","PublicPort":8096,"RemoteIPFilter":[],"AutoRunWebApp":true,"CollectionsMigratedToTags":false,"CollectionFolderIdsMigrated":false,"EnableCaseSensitiveItemIds":true,"PathSubstitutions":[],"CollapseVideoFolders":true,"EnableOriginalTrackTitles":false,"IsRemoteIPFilterBlacklist":false,"ImageExtractionTimeoutMs":0,"ImageSavingConvention":"Compatible","DisplaySpecialsWithinSeasons":true,"SaveMetadataHiddenMigrated":false,"SimultaneousStreamLimit":0,"CollectionOptionsMigrated":false,"EnableAutoUpdate":true,"RunAtStartup":true,"EnableSqLiteMmio":false,"NextUpUpgraded":false,"EnableRemoteAccess":false}

---

and if i understood correctly in my check this are value then when the server receive as JSON from the api they will change the file:

-rw-r--r--  1 nico  staff   2,9K 11 Feb 20:45 .config/emby-server/config/system.xml

so if that is true i think that something who i sent was wrong maybe in the format who the POST have to be done... i do not know... and here is where i will apreciate to have a suggestion from someone who have more experience than me (all of you) just because i do not want to do the above procedure to recover the server for any possible test since to find the right one :)

Tnx in advance

Link to comment
Share on other sites

Link to comment
Share on other sites

  • 2 weeks later...
nbedendo
On 2/15/2022 at 7:57 PM, Luke said:

Hi Luke, tnx for your reply, i was unable to log in here since now to reply to the post. By the way i did some test since now but after any error i'm back in the situation described in the beginning where i have to reconfigure the server and the use the backup for fix it... but any time i have to deal again with my big issue about the "split a part" where all my library became 10 media instead og 10.000 because of the automatic group.. and i cant deal with split an edit again any metadata again.. so for i raise the white flag and i will wait when i have the change to install a new emby server just for try this api call and than apply to the main one... tnx for the support in any case.

Re the split a part... there is a way to avoid that problem since a i cant rename the file in a way where the emby do not think that are part of the same one??

Or just to know: when this operation happen? during Scan library or scan metadata or booth? i really tired about that and i do not want to stop to use emby because of that but i have to find a way to circumavigate the issue till you do not add the option to disable that in the setting.

Tnx for that

Link to comment
Share on other sites

nbedendo
12 hours ago, Luke said:

What exactly is getting joined that you don't want?

As i wrote in one of my older post i cant follow the folder and naming rules and my file structure is something:

ROOT/

A/

B/

....

Z/

and any file in each dir is ABC - XXX - 123.mp4

So any time ad add a new media to any dir or something happen like the "recovery reinstall" like happen in this case. All the content of the dir where i had a file or the entire library in the worst case scenario became a single file who include all the same file with the same first group (ABC).

Than i have to use the split a part (easy) but also edit one by one the metadata bedase all keep the same who during the group...

i spent to many time do that procedure at least 200 time since i purchased the license and i want to find a solution because i tried different strategy:

1) copy all the nfo and the name of the file of my entire library with a python script and rewrite all when happen... not working
2) copy the db file for the library each day and replace... no

... a lot more

any suggestion will be super usefull.. i love emby
 

Link to comment
Share on other sites

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...