{"id":15138544,"url":"https://github.com/downgoon/autorest4db","last_synced_at":"2025-10-23T15:30:25.103Z","repository":{"id":77273822,"uuid":"88804702","full_name":"downgoon/autorest4db","owner":"downgoon","description":"automatically generate a RESTful API of your database (sqlite3 or mysql) **in runtime**.","archived":false,"fork":false,"pushed_at":"2017-05-04T09:20:13.000Z","size":35,"stargazers_count":41,"open_issues_count":2,"forks_count":25,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-30T19:11:14.863Z","etag":null,"topics":["automatic-api","cglib","java8","javassist","jresty","rest-api","sqlite3","vertx","vertx-web"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/downgoon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-04-20T00:52:29.000Z","updated_at":"2024-01-04T00:49:31.000Z","dependencies_parsed_at":null,"dependency_job_id":"bfbb4d67-0648-4271-8714-be25bc736296","html_url":"https://github.com/downgoon/autorest4db","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/downgoon%2Fautorest4db","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/downgoon%2Fautorest4db/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/downgoon%2Fautorest4db/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/downgoon%2Fautorest4db/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/downgoon","download_url":"https://codeload.github.com/downgoon/autorest4db/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237843805,"owners_count":19375206,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automatic-api","cglib","java8","javassist","jresty","rest-api","sqlite3","vertx","vertx-web"],"created_at":"2024-09-26T07:40:58.054Z","updated_at":"2025-10-23T15:30:24.737Z","avatar_url":"https://github.com/downgoon.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# autorest4db\n\nautomatically generate a RESTful API of your database (sqlite3 or mysql) in runtime.\n\n## QuickStart\n\n###  Install and start\n\n#### for any platform\n\ndownload [autorest4db-0.1.1.tar.gz](https://github.com/downgoon/autorest4db/releases/download/0.1.1/autorest4db-0.1.1.tar.gz) and decompress it\n\n``` bash\n$ wget https://github.com/downgoon/autorest4db/releases/download/0.1.1/autorest4db-0.1.1.tar.gz\n$ tar zxvf autorest4db-0.1.1.tar.gz\n$ cd autorest4db-0.1.1\n$ bin/autorest4db start\n```\n\nin IDE (such as Eclipse), just run ``AutoRestMain.java``\n\nBTW, how to build and package ?\n\n``` bash\ngit clone https://github.com/downgoon/autorest4db.git\ncd autorest4db\nmvn clean package\n```\n\n``autorest4db-0.1.1.tar.gz`` will be generated in the ``target`` directory.\n\n\n\u003eREQUIREMENT\n\u003e - JDK8 +\n\n#### for Mac platform (64bit)\n\n- download [autorest4db-0.1.1.pkg](https://github.com/downgoon/autorest4db/releases/download/0.1.1/autorest4db-0.1.1.pkg)\n- double click it and install\n- ``autorest4db start``\n\n![autorest4db install package on Mac](https://cloud.githubusercontent.com/assets/23731186/25697137/58f7bfbc-30ec-11e7-8afd-4db334227efa.png)\n\n---\n\n### Create dababase and tables\n\ncreate a database named ``default`` and several tables defined in ``default.sql`` script located in the root directory of the project just by uploading the script like as follows:\n\n``` java\n$ curl -F \"fname=@default.sql\" http://127.0.0.1:8080/dbmeta/default\n{\"fname\":\"SUCC\"}%\n```\nBTW, multi scripts can be supported.\n\ncontents of the sql script:\n\n``` sql\n\n-- employee table:  AUTOINCREMENT\n\nCREATE TABLE `employee` (\n    `id`    INTEGER PRIMARY KEY AUTOINCREMENT,\n    `name`    TEXT NOT NULL,\n    `age`    INTEGER,\n    `credit` NUMERIC\n    );\n\nINSERT INTO \"employee\" VALUES(2,'laoer',30,NULL);\nINSERT INTO \"employee\" VALUES(3,'tong ye',48,NULL);\nINSERT INTO \"employee\" VALUES(4,'zhangyi',36,NULL);\nINSERT INTO \"employee\" VALUES(5,'陈六子',38,NULL);\nINSERT INTO \"employee\" VALUES(6,'fds',4,NULL);\nINSERT INTO \"employee\" VALUES(7,'timer',12,NULL);\n\n-- friend table: composite keys\n\nCREATE TABLE `FRIEND` (\n    `USER_id`   INTEGER NOT NULL,\n    `FRIE_id`   INTEGER NOT NULL,\n    `degree`    INTEGER,\n    primary key ( `USER_id`, `FRIE_id` )\n);\n\nINSERT INTO FRIEND VALUES (1001, 1032, 4);\nINSERT INTO FRIEND VALUES (1001, 1033, 2);\nINSERT INTO FRIEND VALUES (1002, 1032, 6);\n\n```\n\n### CRUD operations\n\n- **list entity**\n\nget list of ``employee`` from database ``default``\n\n``` bash\n$ curl -i -X GET http://localhost:8080/dbapi/default/employee\nHTTP/1.1 200 OK\nServer: autorest4db\nContent-Type: application/json;charset=UTF-8\nContent-Length: 302\n\n{\"resources\":[{\"id\":2,\"name\":\"laoer\",\"age\":30,\"credit\":null},{\"id\":3,\"name\":\"tong ye\",\"age\":48,\"credit\":null},{\"id\":4,\"name\":\"zhangyi\",\"age\":36,\"credit\":null},{\"id\":5,\"name\":\"陈六子\",\"age\":38,\"credit\":null},{\"id\":6,\"name\":\"fds\",\"age\":4,\"credit\":null},{\"id\":7,\"name\":\"timer\",\"age\":12,\"credit\":null}]}%\n```\n\n- **view entity**\n\nget detail info of ``employee`` whose ``id`` is 4 from database ``default``\n\n``` bash\n$ curl -i -X GET http://localhost:8080/dbapi/default/employee/4\nHTTP/1.1 200 OK\nServer: autorest4db\nContent-Type: application/json;charset=UTF-8\nContent-Length: 48\n\n{\"id\":4,\"name\":\"zhangyi\",\"age\":36,\"credit\":null}\n```\n\n- **filter entity**\n\nget detail info of ``employee`` whose ``name`` is 'zhangyi' from database ``default``\n\n``` bash\n$ curl -i -X GET \"http://localhost:8080/dbapi/default/employee?name=zhangyi\"\nHTTP/1.1 200 OK\nServer: autorest4db\nContent-Type: application/json;charset=UTF-8\nContent-Length: 64\n\n{\"resources\":[{\"id\":4,\"name\":\"zhangyi\",\"age\":36,\"credit\":null}]}%\n```\n\n- **create entity**\n\ncreate an employee specified id=99\n\n``` bash\n$ curl -X POST -i -d '{\"id\": 99, \"name\": \"wangyi\", \"age\": 28, \"credit\": 9.3 }' -H \"Content-Type: application/json\" http://localhost:8080/dbapi/default/employee\nHTTP/1.1 200 OK\nServer: autorest4db\nContent-Type: application/json;charset=UTF-8\nContent-Length: 47\n\n{\"id\":99,\"name\":\"wangyi\",\"age\":28,\"credit\":9.3}%\n```\n\ncreate an employee without id\n\n``` bash\n$ curl -X POST -i -d '{\"name\": \"laoer\", \"age\": 30 }' -H \"Content-Type: application/json\" http://localhost:8080/dbapi/default/employee\nHTTP/1.1 200 OK\nServer: autorest4db\nContent-Type: application/json;charset=UTF-8\nContent-Length: 48\n\n{\"id\":100,\"name\":\"laoer\",\"age\":30,\"credit\":null}\n```\n\n- **update entity**\n\nupdate employee=99\n\n``` bash\n$ curl -X PUT -i -d '{\"name\": \"wangyiV2\", \"age\": 32 }' -H \"Content-Type: application/json\" http://localhost:8080/dbapi/default/employee/99\nHTTP/1.1 200 OK\nServer: autorest4db\nContent-Type: application/json;charset=UTF-8\nContent-Length: 28\n\n{\"name\":\"wangyiV2\",\"age\":32}\n\n$ curl -X GET http://localhost:8080/dbapi/default/employee/99\n{\"id\":99,\"name\":\"wangyiV2\",\"age\":32,\"credit\":9.3}%\n\n```\n\n- **delete entity**\n\n``` bash\n$ curl -i -X DELETE http://localhost:8080/dbapi/default/employee/99\nHTTP/1.1 200 OK\nServer: autorest4db\nContent-Type: application/json;charset=UTF-8\nContent-Length: 0\n\n$ curl -X GET http://localhost:8080/dbapi/default/employee/99\nNot Found%\n```\n\n- **composite keys**\n\n``` bash\n$ curl -i -X GET http://localhost:8080/dbapi/default/friend\nHTTP/1.1 200 OK\nServer: autorest4db\nContent-Type: application/json;charset=UTF-8\nContent-Length: 144\n\n{\"resources\":[{\"user_id\":1001,\"frie_id\":1032,\"degree\":4},{\"user_id\":1001,\"frie_id\":1033,\"degree\":2},{\"user_id\":1002,\"frie_id\":1032,\"degree\":6}]}%\n\n$ curl -i -X GET http://localhost:8080/dbapi/default/friend/1001-1032\nHTTP/1.1 200 OK\nServer: autorest4db\nContent-Type: application/json;charset=UTF-8\nContent-Length: 42\n\n{\"user_id\":1001,\"frie_id\":1032,\"degree\":4}%\n```\n\nthe composite key value '1001-1032' would be split into '1001' assigned to 'user_id' and '1032' assigned to 'frie_id'.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdowngoon%2Fautorest4db","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdowngoon%2Fautorest4db","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdowngoon%2Fautorest4db/lists"}