Exposing MySQL database/table using REST

2020-01-30 08:00发布

What would be the easiest way to expose a MySQL database using a REST interface?

The only guidelines that I can find on the Internet is just using NetBeans. I am not a big fan of NetBeans...

I'd like to retrieve that and be able to update data on the database using this REST interface.

FYI, this is for an iPhone application that I am currently working on.

标签: mysql rest
15条回答
三岁会撩人
2楼-- · 2020-01-30 08:18

Another option is restSQL, an ultra-lightweight persistence framework. http://restsql.org. It supports MySQL and PostgreSQL and runs in a standard Java EE container, e.g. Apache Tomcat.

restSQL is a very unconventional data access layer. restSQL is not an object-oriented view of the database. It presents flat or hierarchical "views" of relational database tables. These views are query-able and updatable through a simple REST-based HTTP or Java API. The HTTP interface is based on REST principles, which use HTTP’s built-in features, rather than abstracting away from them.

查看更多
forever°为你锁心
3楼-- · 2020-01-30 08:18

For just GET requests, DBSlayer looks promising. Here is a google one that also sounds interesting. I have not used it though/

查看更多
甜甜的少女心
4楼-- · 2020-01-30 08:21

One of the easiest ways to create REST APIs for any MySql database is to use Xmysql

  • Xmysql with one command you can get literally thousands of APIs within seconds (based on num of tables).
  • Xmysql not only generates CRUD but also some sophisticated aggregate APIs too.
  • Xmysql has a really well written documentation that accompanies in the repo.
  • There is docker support as well
查看更多
【Aperson】
5楼-- · 2020-01-30 08:27

My recommendation in 2020 would be using metamug console. Metamug console is language agnostic and builds APIs with a MySQL connection and no extra setup.

Metamug Connect to MySQL Database

Resource Editor

The console comes with a resource editor that helps you map requests to sql statements. You can add parameter validation and parameters into the queries.

enter image description here

Documentation

It generates resource documentation. enter image description here

Other Features you may need.

  • It can handle complex JSON requests along with multipart and URL-encoded data
  • Implements standard status codes and error handling so you don't have to sweat.
  • Comes with built-in query testing to fail fast development.
  • Role-based per resource authentication.

You can ask questions with metamug tag

Disclaimer: I'm part of the dev team. And we have been working on metamug console from last 3 years.

You can easily export the apis build with metamug console to be used in production and the exported webapp is built on top of open source mason library

查看更多
祖国的老花朵
6楼-- · 2020-01-30 08:28

Another option is Slash db which "automatically generates a REST API from relational databases."

As of June 2017, it works for SQL databases without adjustment, but other kinds of data stores require a custom developed plugin.

I've only read about this service (not a user). I have no affiliation with them.

查看更多
女痞
7楼-- · 2020-01-30 08:32

As dorkitude commented, it depends on what languages you can use / want to use.

I found the project PHPRestSQL which seems to do what you want: http://phprestsql.sourceforge.net/ - haven't tried it myself though.

查看更多
登录 后发表回答