New: Make an API for your Anvil app

Sometimes we want to connect other programs with our Anvil apps. Whether it’s a native mobile app, a shell script, or a web service like Twilio, most things expect to make REST or plain HTTP requests.

As of today, this is all it takes to publish an HTTP API that returns some JSON:

@anvil.server.http_endpoint("/greet/:name")
def greet(name, **qs):
  return {'message': 'Hello, ' + name + '!'}

We can demonstrate it with the curl command-line program:

curl https://http-endpoint-demo.anvilapp.net/_/api/greet/Joanne {"message":"Hello, Joanne!"}

You can open this example in Anvil right now:


Want to know more?

To learn more, read our step-by-step guide to building an HTTP REST API. You can also explore all the details in our reference docs.