Back

[SOLVED] execute a function via rest api without headers?

  • 0
  • Functions
arpentnoir
6 Apr, 2023, 03:21

I'm hoping to use appwrite function as handler for inbound webhook from xero. Can't add custom authentication to xero webhook (i.e. can't configure to include x-appwrite-project).

So, I can create function execution via rest api fine with x-appwrite-project header, but if I try to use the project query param I'm getting Function with the requested ID could not be found.

Is it possible to execute a function without appwrite headers?

TL;DR
User is asking if it's possible to execute a function via a REST API without headers. A couple of solutions are suggested, including using a proxy and including the necessary information in the request body. The user eventually discovers that the issue is related to the project ID and permissions. The thread is marked as solved.
Drake
6 Apr, 2023, 03:23
arpentnoir
6 Apr, 2023, 03:31

yep, I was going off that example. so trying something like this is what's returning the error above

https://[MY_APPWRITE_URL]/v1/functions/[FUNCTION_ID]/executions?project=[MY_PROJECT_ID]

Drake
6 Apr, 2023, 03:37

You sure the project is correct? And request method is post? And permissions are set to any?

arpentnoir
6 Apr, 2023, 03:42

yep. project id in url is the same as project id in header (in postman) if I toggle the x-appwrite-project header on, I can create function execution, if I toggle off (with project id as query param) then it fails with Function with the requested ID could not be found.

Drake
6 Apr, 2023, 03:48

How about if you include it in the request body?

arpentnoir
6 Apr, 2023, 03:50

yep, that works

arpentnoir
6 Apr, 2023, 03:51

but same issue as with headers re xero webhook...

Drake
6 Apr, 2023, 03:53

Honestly, functions don't work so well as a web hook right now. It will in a future release 😁

For now, you might need a proxy in front of Appwrite

arpentnoir
6 Apr, 2023, 03:55

ahh, cool. thanks @Steven

yep, I was hoping to avoid that, but need it for another reason anyway - i.e. parsing and transforming the resposne structure from function execution to conform with openapi spec...

joeyouss
6 Apr, 2023, 15:56

Hey @arpentnoir - shall I close this post if your doubt is resolved?

arpentnoir
6 Apr, 2023, 19:54

yes, thanks

Tessa
7 Apr, 2023, 21:06

[SOLVED] execute a function via rest api without headers?

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