POST method using HTTP request with Ray Serve

Hello guys,

I am using Ray Serve to deploy my DL models for image classification. So I want to send an image through an HTTP request to Ray Serv. I am using the curl command but I got this error

" methods post not allwoed. Available HTTP methods are [‘GET’] "

How can I fix it please!

Thanks guys :wink:

Hi @aamrani-dev, try adding 'POST' to the methods parameter in create_endpoint for your Serve endpoint: Serve API Reference — Ray v2.0.0.dev0

I came across this question because I was looking for the same answer. From what I can tell, create_endpoint was deprecated in ray 1.5.0. The latest docs for 1.9.0 have ray.serve.deployment() but I do not see a setting for methods. Is there any other documentation on how to post a request body that I am missing?

Hi @aggiemaster, yes the latest way will be using fastapi Calling Deployments via HTTP and Python — Ray v1.9.0 (and we will make sure not to make back-ward incompatible change going forward)

Thanks for the reply! i’ll take a look at that documentation.

@simon-mo The FastAPI setup worked for me. Thanks for the help!