Jump to content

Swagger API Help


ShadowKindjal

Recommended Posts

ShadowKindjal

I'm not sure if I have something configured incorrectly on my server but I've never been able to use the API button on the bottom of my dashboard to test API calls via swagger. I always have to open a command prompt or use postman to test my scripts for what seems to be simple issue. For some reason the web address under Servers on my swagger page begins with http instead of https. This means all my API calls done from that page fail but when I populate the command with https and use the same variables it works just fine. Is there a simple way for me to fix this?

image.png.81514fa6053e5613320cffb890754910.png

image.png.2bc7d9b28a56ef3c50dbabca0b2357de.png

 

Edited by ShadowKindjal
Link to comment
Share on other sites

rbjtech

Yea the link is http which is wrong - as swagger no longer supports this.

ps - you might wanna blank out your FQDN in the 2nd screen grab ... ;)

Swagger > Emby also needs to use https - or if you are not using https - then http via localhost will work.

This is browser restriction - there are a few posts on it as I originally raised it - try a search.

 

Edited by rbjtech
Link to comment
Share on other sites

ShadowKindjal
Quote

Yea the link is http which is wrong - as swagger no longer supports this.

Yea, I had managed to  come to that conclusion but I don't know where swagger is getting that from. my server is set up for https

Quote

ps - you might wanna blank out your FQDN in the 2nd screen grab ... ;)

I honestly thought I had caught all of em so thx for that catch.

Quote

 

Swagger > Emby also needs to use https - or if you are not using https - then http via localhost will work.

This is browser restriction - there are a few posts on it as I originally raised it - try a search.

 

So how do I get swagger to use https? All I'm doing is clicking the API button at the bottom of my dashboard. I only access my server via HTTPS.

Link to comment
Share on other sites

rbjtech

So if you click on the API button in the deashboard - do you not get https ?

edit - Ah - you are still on 4.7.x.x - this is fixed in the latest Beta 4.8.0.6

https://swagger.emby.media/?url=XXXXXXX ?

If it uses http - then just overtype with https

As your emby server is https - then there should not be any further complication.  Both swagger and emby need to use https.

 

Edited by rbjtech
Link to comment
Share on other sites

ShadowKindjal

If I click on the API link it takes me to a HTTPS page but the dropdown for servers has a HTTP link I can't change. Is this the functionality that is fixed in the latest beta?

Link to comment
Share on other sites

rbjtech

This is what I get - is this what you need ?

image.thumb.png.d10eccb96028b90b45ed0bad84beda1d.png

 

Edited by rbjtech
Link to comment
Share on other sites

ShadowKindjal
2 minutes ago, rbjtech said:

This is what I get - is this what you need ?

image.thumb.png.1532ee534e88877ddd4361941a89eb8e.png

Just a heads up but you forgot to hide your domain under the "EMBY Server REST API (BETA)

Link to comment
Share on other sites

rbjtech
Just now, ShadowKindjal said:

Just a heads up but you forgot to hide your domain under the "EMBY Server REST API (BETA)

lol - yea, saw that after I posted it - haha - edited now - thanks !

Link to comment
Share on other sites

rbjtech

Right - with you now - you don't get the https in the server selection box 🤔

I would suggest this was fixed with a later emby version - but can't be 100% sure

@Luke

Please could you confirm ?

 

Link to comment
Share on other sites

ShadowKindjal
26 minutes ago, Q-Droid said:

If you launch/login to Emby from your HTTPS URL then the rest should be correct.

 

The screenshot I posted above is from an EMBY session launched with the HTTPS URL

Link to comment
Share on other sites

Q-Droid

That's odd. I'm on the stable release and the API and drop down links are correct. Are you behind a proxy? If so might need some tweaks. 

 

Link to comment
Share on other sites

  • 2 weeks later...
On 7/18/2022 at 12:12 PM, ShadowKindjal said:

This is my output when I click the API button in my dashboard

 

image.thumb.png.2ae824d70752defaf12d31b4a5409ce4.png 

Do you have a proxy server that redirects to http?

Link to comment
Share on other sites

ShadowKindjal
1 hour ago, Luke said:

Do you have a proxy server that redirects to http?

Yes, I have a nginx reverse proxy that redirects to the local ip over http. I've attached conf file.

emby.subdomain.conf

Link to comment
Share on other sites

ShadowKindjal
21 hours ago, Luke said:

Have you compared to this?

 

I've updated my conf file with all of the settings from pir8radio's example and it has not resolved my issue.

Link to comment
Share on other sites

pir8radio

What is the issue that is happening?     If you are using my config I disable remote access to swagger in this line of the nginx config:
 

     location ^~ /swagger {   ## Disables access to swagger interface
        return 404;

 

Link to comment
Share on other sites

ShadowKindjal
22 minutes ago, pir8radio said:

What is the issue that is happening?     If you are using my config I disable remote access to swagger in this line of the nginx config:
 

     location ^~ /swagger {   ## Disables access to swagger interface
        return 404;

 

I commented out that line specifically. I'm just trying to use swagger but the drop-down in the app has the http address instead of the https address so i can't use any test anything from the page.

Link to comment
Share on other sites

pir8radio
8 minutes ago, ShadowKindjal said:

I commented out that line specifically. I'm just trying to use swagger but the drop-down in the app has the http address instead of the https address so i can't use any test anything from the page.

oh...  im not sure how they tell swagger that you are using https..  let me read up above more...    ok.  well i assume its because emby doesnt really know you are actually using https..  whfat are your network settings set to for Secure connection mode: should be "handled by proxy"  if it is and still doesnt work, @Luke may need to read the header to see if the connection was originally requested via https, then address accordingly..     You can also fix it in nginx,    its called sub_filter   but i dont think its baked into standard nginx,  maybe it is now.   but google sub_filter you can dynamically rewrite text as it passes through nginx..   so you can say something like the below to rewrite any text that passes by as https..   could have some side effects, its always good to make that as specific as possible  more like  http://yourdomain.com/swagger       to https://yourdomain.com/swagger   or something.    

sub_filter 'http://'  'https://';
Link to comment
Share on other sites

ShadowKindjal
On 8/6/2022 at 4:50 PM, pir8radio said:

oh...  im not sure how they tell swagger that you are using https..  let me read up above more...    ok.  well i assume its because emby doesnt really know you are actually using https..  whfat are your network settings set to for Secure connection mode: should be "handled by proxy"  if it is and still doesnt work, @Luke may need to read the header to see if the connection was originally requested via https, then address accordingly..     You can also fix it in nginx,    its called sub_filter   but i dont think its baked into standard nginx,  maybe it is now.   but google sub_filter you can dynamically rewrite text as it passes through nginx..   so you can say something like the below to rewrite any text that passes by as https..   could have some side effects, its always good to make that as specific as possible  more like  http://yourdomain.com/swagger       to https://yourdomain.com/swagger   or something.    

sub_filter 'http://'  'https://';

My secure connection mode is indeed "handled by reverse proxy" and my swagger URL in the dropdown is still HTTP instead of HTTPS in Swagger. I will have to look into the sub_filter option for nginx but I imagine that to fix this issue it would require an emby update.

Link to comment
Share on other sites

  • 3 weeks later...

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