#Any way to enable PUT method for API Calls ??

17 messages · Page 1 of 1 (latest)

hasty atlas
#

Hi Team
Just wondering if there is any configuration that would enable to use PUT methods for API calls to directus for updating records. I am aware of the PATCH method that exists currently for the updation of the record but I am using APPGyver for frontend of app which does not support the PATCH method to update.

Or if there is any workaround other than using any API gateway to transform the api calls from PATCH to PUT method ??

autumn marsh
rotund oasis
hasty atlas
#

Thanks @rotund oasis I am trying to find other way rather to write code which is not my speciality. Rightnow I have written a express server that translates the request. Going to see how long it would serve the purpose yet.

#

I am going to look into custom API endpoints as @autumn marsh suggested !! Thanks Kevin

rotund oasis
#

Great. You can however modify directus itself and submit a PR supporting the feature.

rotund oasis
hasty atlas
#

Yes...I think it would be a much better idea than managing a seperate process and seperate reverse proxy config on nginx that I am using. However I am not very good at coding and trying to look for example to follow for same. Basically I am trying to pipe PATCH request that directus support with PUT request.

rotund oasis
#

But i think you can write some custom JavaScript in the AppGyver itself, like a fetch request and use PATCH method.

#

That will be more cleaner than meddling with directus

hasty atlas
#

I quickly wrote a small node file to translate all PUT request to forward to PATCH request. It is currently working fine but I will ultimately move to custom endpoint within directus to catch all PUT request and forward as PATCH request.

rotund oasis
#

That’s great

#

Can you share the code ?

hasty atlas
#

Sure...

#

This is my working node app code

#

Sorry I am trying to paste source code as text but this gets automatically converted to image