REQUEST - how to POST?

Hi,

I would like to use the REQUEST function to make a POST, PUT, or DELETE request, to use Grist to modify external state. At first glance, this might seem like a crazy thing to want do, however, there is a sensible way to modify external state outside of Grist.

My use case is I would like to automatically install an n8n workflow using Grist, only using the document and not require any plugins.

I have an n8n_integrations table, and a toggle for “install n8n workflow”. Based on the value of $install_n8n_workflow, I would have another column that would use REQUEST to idempotently make the state of this n8n workflow installed or not installed, and return its current state.

I believe this way of doing it is consistent with a database-spreadsheet hybrid that supports Python.

How can I make REQUEST submit POST, PUT, and DELETE requests? Alternatively, which part of the source code should I modify to get this to work?

Thanks a lot

1 Like

Hi @John1, good job at forestalling my “this is crazy” response. Doing this would require source code changes. First I guess would be to add a slot for specifying the request method type here:

Then tweak the REQUEST method to let you pass it:

Then tweak the DocRequests method to honor the setting:

I think that’s it. If others can access your Grist instance, I’d strongly suggest setting up GRIST_HTTPS_PROXY before letting them make arbitrary api calls to any internal endpoints you have.

1 Like

Thanks @paul-grist - that helps massively!

Ok - now done! Please can you take a look at my PR? REQUEST now supports POST by johncant · Pull Request #588 · gristlabs/grist-core · GitHub

1 Like