I wonder if there is another non-coder way of doing it that would be less restrictive than sheetlabs. Spreadsheets can be easily saved as CSV, so if you find a tool that converts CSVs to JSON APIs that would do the job.
But I guess the 'coder way' is to create a web application, instead of using an existing service to provide your API. You wouldn't normally expose the actual database to the outside world.
One way of doing that is something like django rest framework. It might be a steep learning curve though because it's made for web developers and it builds on top of another python library (django). Roughly what you'd have to do would be:
Create URL patterns for your rv and vs endpoints. This connects the URLs users enter with the code that handles their requests
Create python classes (models) that describe the tables in your database (this turns a database row into a python object)
Write a serializer for each one that turns that python object into a JSON object
If you use this, then you get a lot of stuff for free out of the box. For example, it will generate some API documentation for you, the same way sheetlabs does.
Alternatively you could build something with flask, which is a simpler web framework. Here's an example of how you could build an API in it: blog.miguelgrinberg.com/post/desig...
In this case you could use any python database library to connect to your DB, then you would write some code to transform the database data into a list of dictionaries, which you can pass to jsonify to get the JSON output.
For hosting, maybe have a look at heroku when you have something that works on your computer. I think their free tier support databases with up to 10,000 rows in. I'd recommend against trying to host it yourself on a raspberry pi because it'll take more effort to keep the site running and you run the risk of people hacking you.
I am technical writer. I taught myself Python so I could explore all of the interesting APIs out there. At the moment, I am building a Mahabharat chatbot (API too, hopefully?)
Thank you for your thoughtful reply, Mat. I have tried (and abandoned) the django route as too complicated for me, but looks like Flask is doable. I'll try it out.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I wonder if there is another non-coder way of doing it that would be less restrictive than sheetlabs. Spreadsheets can be easily saved as CSV, so if you find a tool that converts CSVs to JSON APIs that would do the job.
But I guess the 'coder way' is to create a web application, instead of using an existing service to provide your API. You wouldn't normally expose the actual database to the outside world.
One way of doing that is something like django rest framework. It might be a steep learning curve though because it's made for web developers and it builds on top of another python library (django). Roughly what you'd have to do would be:
list
method, like the first example here: django-rest-framework.org/api-guid...If you use this, then you get a lot of stuff for free out of the box. For example, it will generate some API documentation for you, the same way sheetlabs does.
Alternatively you could build something with flask, which is a simpler web framework. Here's an example of how you could build an API in it: blog.miguelgrinberg.com/post/desig...
In this case you could use any python database library to connect to your DB, then you would write some code to transform the database data into a list of dictionaries, which you can pass to jsonify to get the JSON output.
For hosting, maybe have a look at heroku when you have something that works on your computer. I think their free tier support databases with up to 10,000 rows in. I'd recommend against trying to host it yourself on a raspberry pi because it'll take more effort to keep the site running and you run the risk of people hacking you.
Thank you for your thoughtful reply, Mat. I have tried (and abandoned) the django route as too complicated for me, but looks like Flask is doable. I'll try it out.