Back

[SOLVED] Is there a way to get an endpoint for your deployed functions.

  • 0
  • Functions
  • Web
kunxl.gg
8 Jun, 2023, 05:30

The use case is simple. As much as I read, your deployed appwrite functions are only triggered by some appwrite event for example: making users, adding files, so and so forth. What I want is to get an api endpoint something like: https://appwrite.cloud/v1/function, which I can call from the client.

TL;DR
The user wants to know if there is a way to get an endpoint for deployed functions in Appwrite. There is no direct endpoint, but the user can use the `createExecution` endpoint in the Functions API to execute the function on demand from the client-side app.
safwan
8 Jun, 2023, 07:03

I'm not sure if there is an endpoint, but if you want to execute it on demand from your client-side app, you can use the createExecution endpoint in the Functions API

kunxl.gg
8 Jun, 2023, 07:04

ohh thanks

safwan
8 Jun, 2023, 07:04

The docs linked here are for v1.1, so feel free to change if you're on a different version 😄

kunxl.gg
8 Jun, 2023, 07:05

yaa

kunxl.gg
8 Jun, 2023, 07:05

so basically I can call this create execution api and the appwrite server would start running the function?

kunxl.gg
8 Jun, 2023, 07:06

this is what I understood from the docs

safwan
8 Jun, 2023, 07:07

Yes that's absolutely right!

safwan
8 Jun, 2023, 07:08
TypeScript
export async function executeTeamsFunction(id: string, mode: string, email: string) {
    try {
        if (id === '') {
            return;
        } else {
            const promise = await functions.createExecution(
                id,
                `{
                    "mode": "${mode}",
                    "email": "${email}"
                }`
            );
            return promise;
        }
    } catch (error) {
        if (error instanceof AppwriteException) {
            console.log(error.message);
        } else {
            console.log(error);
        }
    }
}```
Here's an example
kunxl.gg
8 Jun, 2023, 07:15

are you participating in the hackathon?

kunxl.gg
8 Jun, 2023, 07:15

what are you building

safwan
8 Jun, 2023, 07:16

I'm building a patient-doctor dashboard Please keep messages in <#1072905050399191082> threads related to issues. I'd be more than happy talking about my project in the <#1106531116317417564> 😄 <:appwritepeepo:902865250427215882>

kunxl.gg
8 Jun, 2023, 07:17

ohh sorry.

kunxl.gg
8 Jun, 2023, 07:17

atb

safwan
8 Jun, 2023, 07:17

No worries <:appwritemagician:946072299172409414>

Drake
8 Jun, 2023, 14:35

[SOLVED] Is there a way to get an endpoint for your deployed functions.

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more