kingy444 114 Posted February 14, 2018 Posted February 14, 2018 I currently use the API for a multitude of different personal applications, looking to build a new interface but the swagger-ui no longer appears available. I remember seeing a post that it was undergoing some work some while ago but cant find that post again. Any info appreciated.
Happy2Play 9441 Posted February 14, 2018 Posted February 14, 2018 What do you mean? API link at bottom center of Dashboard. 1
kingy444 114 Posted February 15, 2018 Author Posted February 15, 2018 What do you mean? API link at bottom center of Dashboard. Thanks mate - i used to access it from the tray icon, guess that shows how long its been. never even paid attention to those links at the bottom before 1
kingy444 114 Posted February 15, 2018 Author Posted February 15, 2018 (edited) Looks like there might actually be a problem? I can access the API - but the swagger-ui isnt actually providing me with the info around a call. For Instance: One that I Know has parameters and works fine in some current calls reports no parameters and returns no results I cant even find anywhere on the page to input an API key? Edited February 15, 2018 by kingy444
ebr 15665 Posted February 15, 2018 Posted February 15, 2018 That looks like an end point that is provided by a community plug-in (AutoOrganize). Those will not be covered by Swagger.
kingy444 114 Posted February 16, 2018 Author Posted February 16, 2018 That looks like an end point that is provided by a community plug-in (AutoOrganize). Those will not be covered by Swagger. @@ebr This is just an example because i know it has parameters as I already use it. I assume that the below items query is inbuilt and expected in swagger. I havent seen an API end point listed correctly in swagger at all. On a side note - Why would something that is built to have an API endpoint not be in swagger? shouldnt that be a pre-requisite? otherwise it makes actually using said API quite difficult
Luke 40079 Posted February 16, 2018 Posted February 16, 2018 AutoOrganize is a standalone plugin. It was never intended to have an API for others to interact with. It is possible to figure it out and talk to it, but it wasn't designed for that.
ebr 15665 Posted February 16, 2018 Posted February 16, 2018 Yes we do know that the swagger implementation is not complete as we had to completely convert it over to a new version recently and that is still in process but, admittedly, on a back burner due to the lack of need.
kingy444 114 Posted February 17, 2018 Author Posted February 17, 2018 @@ebr @@Luke What i was trying to do is make an API call to force specific movies to "Refresh All Metadata" I have the info i need to make a call to /Items to get the Movie ID etc, could you provide an example string to refresh metadata on a specific Library Item? Would also be good to know how to restrict a call to a specific library. At the moment I use IncludeItemTypes=Movie and filter based on the Path of the item returned. Would be good to filter prior to getting the data
ebr 15665 Posted February 17, 2018 Posted February 17, 2018 Would also be good to know how to restrict a call to a specific library. At the moment I use IncludeItemTypes=Movie and filter based on the Path of the item returned. Would be good to filter prior to getting the data parentId=[libraryID] (or the ID of any container item). 1
diamondq 1 Posted February 20, 2018 Posted February 20, 2018 I ran into a similar problem with the current lack of information in the Swagger file. While waiting for the official version, I've spent some time adding a bunch of the parameters and data types for a number of the API calls (mostly around Items / Playlists at the moment). You might find my version helpful: https://github.com/diamondq/emby-swagger 1
Luke 40079 Posted February 20, 2018 Posted February 20, 2018 I ran into a similar problem with the current lack of information in the Swagger file. While waiting for the official version, I've spent some time adding a bunch of the parameters and data types for a number of the API calls (mostly around Items / Playlists at the moment). You might find my version helpful: https://github.com/diamondq/emby-swagger Very cool, thanks ! I need to do another round of development on swagger and get it completed.
Luke 40079 Posted February 21, 2018 Posted February 21, 2018 @@diamondq so it looks like you added more info to the json that gets fed into swagger. Did you figure out how to have swagger present a text field that you can enter an access token in? It used to have this and then the access token would go on the query string as api_key=xxx. But now with swagger 3.x, everything is restructured so I haven't looked at whatever the new method is. Thanks.
diamondq 1 Posted February 22, 2018 Posted February 22, 2018 (edited) I'm still using Swagger 2.0, since there isn't let great tool support for 3.0, but I added the following to to the global security definitions. This puts them all as headers, which works fine, even in the Swagger UI. You just have to click the 'Authorize' button to enter the data for either of the two fields. securityDefinitions: auth_header: name: X-Emby-Authorization description: Should be in the format of MediaBrowser Client="MyClient", DeviceId="MyDeviceId", Device="MyDeviceName", Version="MyVersion", UserId="MyUserId" type: apiKey in: header access_token: name: X-MediaBrowser-Token description: Token provided by Authenticate call type: apiKey in: header Edited February 22, 2018 by diamondq
Luke 40079 Posted February 23, 2018 Posted February 23, 2018 Ok we used to use Swagger v2 but at this point I've done much of the work on v3 that I don't really want to start over again and build based on v2. So I just need to set aside time to figure out how to do these things with v3. Thanks.
kingy444 114 Posted April 22, 2018 Author Posted April 22, 2018 @@ebr @@Luke quick one i hope you can answer before i kick this off - can you confirm if making a call to /Items/{0}/Refresh is the equivalent of "Replace all Metadata" and "Replace Existing Images" Long explanation to why i am trying to achieve this, but basically i would like to be able to force all metadata and replace existing images for certain items on task that i will run in the background - im sure i'm just a special use case who likes to automate everything Just need to know if there are some extra parameters that need to be passed to the API call to achieve the above
kingy444 114 Posted April 22, 2018 Author Posted April 22, 2018 Apparantly it doesnt work at all. I thought i muse be missing a parameter - but a call to "$($EmbyURL)/Items/731865995b6ce9d735859dd9721dea0c/Refresh?format=json&api_key=$($EmbyAPIKey)" (PowerShell) doesn't appear to do anything This made me dig through the l and find: 2018-04-22 11:05:10.433 Error HttpServer: Could not find handler for /Items/731865995b6ce9d735859dd9721dea0c/Refresh 731865995b6ce9d735859dd9721dea0c is the id= handler from emby url so i would assume there is something wrong with the API call?
Luke 40079 Posted April 22, 2018 Posted April 22, 2018 It works just fine. If it didn't work, then the refresh metadata function in the web app wouldn't work either. Try using the Chrome debugger to monitor the http requests with the web app. You should be able to use that to compare to yours and find out what is missing.
kingy444 114 Posted April 22, 2018 Author Posted April 22, 2018 It works just fine. If it didn't work, then the refresh metadata function in the web app wouldn't work either. Try using the Chrome debugger to monitor the http requests with the web app. You should be able to use that to compare to yours and find out what is missing. Thanks for the tip - i take it most of the api end points handle the same parameters as the web interface? Comparing the two it appears that when you call /Items/{0}/Refresh you get the 'Could not find a handler' error There are some additional parameters, of which im not sure which are mandatory but as i'm only emulating the web interface command i can now make it work with the below. Thanks for the help /Items/{0}/Refresh?Recursive=true&ImageRefreshMode=FullRefresh&MetadataRefreshMode=FullRefresh&ReplaceAllImages=true&ReplaceAllMetadata=true&api_key={2} @@diamondq - for info incase you are still maintaining your swagger doco
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now