Alexa API endpoint method not allowed

Whenever I try to use

https://jamiesaunders.duckdns.org:8123/api/alexa?api_password=REDACTED

I get : {"result": "error", "message": "405: Method Not Allowed"} but otherwise, everything else is ok with the API, such as /api/services… Amazon also complains it can’t use the URL. I’m not sure what is going wrong?

Are you forwarding port 443 to port 8123 the internal IP of your HA server like the instructions suggest? If so, then you don’t need to specify the port in the return URL.

https://jamiesaunders.duckdns.org/api/alexa?api_password=REDACTED

Should work. Can you get to HA by going to https://jamiesaunders.duckdns.org? It doesn’t seem to work for me. I should at least get a login page. You need to check that first.

Well, it can be accessed wit:

https://jamiesaunders.duckdns.org:8123/api/alexa?api_password=REDACTED

But that’s giving me the method not allowed. Sorry, I forgot to include the port number in my original URL.

I cannot get to your site at all using any of the combinations of URLs.

http://jamiessaunders.duckdns.org:8123
https://jamiessaunders.duckdns.org:8123
https://jamiessaunders.duckdns.org
http://jamiessaunders.duckdns.org

At least one of these should take me to a login page for your HA or some webpage but nothing. I think you have to look into that first.

1 Like

So, after spending hours with “I don’t understand, I know what I’m doing and this should be working” and the NAT redirecting me from the URL to the local IP fine.

… I restarted my crappy ISP provided router and it fixed it. That’s all it took.

https://jamiesaunders.duckdns.org:8123

So … now my Method not allowed problem …

Great job getting that sorted out. But I’m wondering if the problem is the port.

On my system, I have the router redirecting all traffic on port 443 to port 8123 on my Pi. This way, when I type in:

https://mydomain.org

It goes right to my HA instance on the P without having to specify the port. Since this is the way I started, using the directions on @brusc’s video on setting up Let’s Encrypt, I don’t know for sure but I would bet that Amazon may be having a problem with port argument in the URL.

Did you ever get this figured out? I am having the same issue.

I forgot about this, I was so busy!

Well, regardless of whether it is accessible outside or not (which it is), the API is returning nothing. I’m actually getting a 404 now I’ve just tried.

Are you having problem with Let’s Encrypt, or with the API returning a method not allowed?

I am getting the 405 method not allowed when trying to access the alexa api. When I access /api it say it is running.

I’m glad it’s not just me.

Which version are you running?

405 errors mean the method (GET, POST, PUT, etc.) you are using to access the endpoint (HA API) isn’t valid. Check the URL you are using to speak to the HA API.

404 errors mean there’s nothing on that end responding. That’s a communications issue.

I already know all of this.

Oh, then you already know the answer then. My mistake, sorry. I’ll move on to helping someone else then.

Sorry, that came off a lot more annoyed and bitchy than intended.

I’m just dealing with EA whilst I reply to this and I’m a bit moody.

1 Like

It’s cool. How can I help?

EDIT:
@jmesaunders are you still using the same URL as above to access from the outside?

https://jamiesaunders.duckdns.org:8123

If so, I still think this is why you are getting the method not allowed error. I think AWS requires a ‘straight’ SSL path, without a port. I don’t think you can redirect SSL port 443 to 8123 within the URL; AWS is probably not allowing that.

@pstapley

What URL are you using for your endpoint?

I am running 0.30.2

https://stapley.duckdns.org:8123/api/alexa?api_password=redacted

Same problem.

You guys have to go into your router and forward requests from port 443 on your HA host to redirect to 8123. It’s going to be a little different for each router so I can’t really tell you how to do yours but you can get a good idea on how it works from watching this video (@brusc for the win once again!) :

Once you can go to your HA instance with a straight https://yourdomain.duckdns.org WITHOUT the port 8123, you should no longer get the 405 error. I’m pretty sure that’s why you are getting “Method not allowed”; because AWS doesn’t allow you to specify a port in the URL.

Yeah I am still having the issue, I am not exactly sure where to start troubleshooting.

https://stapley.duckdns.org/api/alexa?api_password=redacted

Is there anything in the config that would affect this?

Annoyingly port forwarding on my ISP supplied router will only let me do same external to same internal port. I don’t think the port matters at all. Having the port number wouldn’t affect it in any other situation, plus the API is reporting as method not allowed, even in the browser (so that’s a GET request)