Hi,
I understand from documentation that published app will have an endpoint equal to https://<appname>.anvil.app/_/api
but what about an unpublished app which is only being executed via RUN button?
For instance, how would I go about finding my actual endpoint for a non-published app which runs the following server-side code
@anvil.server.http_endpoint("/data")
def ttn_endpoint_get():
print("Server request")
return anvil.server.HttpResponse(status=200, body="", headers=None)
I think if you open up the server code module that defines the http endpoint there should be a link that you can use…
Sorry not at my desk to check though.
Or check the Publish section and look for “Get a link to my development environment” and then append the endpoint as per the docs
EDIT
Also check out this section from the docs to get this url in code
Hi @begetomises,
What you’re looking for is a Debug environment! This allows you to get a secret URL for the endpoints of whatever you’re working on in the Editor, without publishing your app.
When you run the app in the Editor, it runs on a temporary secret URL - the method @rickhurlbatt links to above will let you fetch it at runtime. This is good if for some reason you’re calling the HTTP endpoint from the running app (instead of using anvil.server.call
), but if you’re testing webhooks or using curl from the command line or anything like that, a Debug environment is probably what you want.
3 Likes
Really appreciate your quick reply, doing
anvil.server.get_app_origin() + '/_/api'
actually returned a usable endpoint while having an unpublished app running.
Thank you!
Hi @meredydd.
I see that documentation mentions Environments dialog
but I’m not how do I get there.
Click the Publish button at the top right of the editor!
1 Like