How to update a file in a server

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By DodoIta

I’m pretty new to this kind of stuff. I tried looking for something related in the Q&A but I couldn’t find anything useful, so I’ll ask it here: how can I update a file (say, a JSON) which is stored in an online server?

:bust_in_silhouette: Reply From: Calinou

To interact with an online resource in general, it’s usually best to set up a REST API that can be contacted using HTTPRequest. Developing the API itself is out of the scope of this question, but pretty much any Web framework can be used for this. Microframeworks such as Flask tend to be popular for this use case.

In your case, your API will need to have one endpoint that will modify the JSON file when it’s called. Remember that you will probably need to set up some sort of authentication mechanism too.